lucent-ui 0.33.0 → 0.35.0

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/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("./LucentProvider-DQ46gmxN.cjs"),c=require("react"),J=require("react-dom"),wt={id:"button",name:"Button",tier:"atom",domain:"neutral",specVersion:"1.0",description:"A clickable control that triggers an action. The primary interactive primitive in Lucent UI.",designIntent:'Buttons communicate available actions. Variant conveys hierarchy: use "primary" for the single most important action in a view, "secondary" for supporting actions, "ghost" for low-emphasis actions in dense UIs, "outline" for bordered buttons with transparent background, and "danger" exclusively for destructive or irreversible operations. Use "danger-ghost" for low-emphasis destructive actions (red text, no fill) and "danger-outline" for bordered destructive buttons (also transparent background). Size should match surrounding content density — prefer "md" as the default, "sm" for toolbars or tables, "xs" for compact UIs like customizer panels, and "2xs" for ultra-dense inline controls (~22px height) such as table-inline actions or toolbar icon triggers. Icon-only buttons (leftIcon/rightIcon without children) automatically render as square with aspect-ratio: 1.',props:[{name:"variant",type:"enum",required:!1,default:"primary",description:'Visual style conveying action hierarchy. "primary" — filled accent for the single most important action. "secondary" — subtle accent-tinted fill for supporting actions. "outline" — bordered with no fill, for neutral secondary actions. "ghost" — transparent with no border, for low-emphasis or inline actions. "danger" — filled red for irreversible destructive actions (e.g. "Delete account"). "danger-outline" — red border + red text for destructive actions that need visual weight without a filled background. "danger-ghost" — red text only, for low-emphasis destructive actions (e.g. "Remove" in a list row).',enumValues:["primary","secondary","outline","ghost","danger","danger-outline","danger-ghost"]},{name:"size",type:"enum",required:!1,default:"md",description:'Controls height and padding. "lg" (48px) — hero sections, onboarding flows. "md" (42px) — default for most forms and dialogs. "sm" (34px) — toolbars, table headers, card actions. "xs" (26px) — compact UIs like customizer panels, inline controls. "2xs" (22px) — ultra-dense inline icon triggers, table-row actions, dashboard toolbar buttons.',enumValues:["2xs","xs","sm","md","lg"]},{name:"children",type:"ReactNode",required:!1,description:"Button label or content. Omit for icon-only buttons (provide leftIcon or rightIcon instead)."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and applies disabled styling."},{name:"loading",type:"boolean",required:!1,default:"false",description:"Shows a spinner and prevents interaction while an async action is in progress."},{name:"fullWidth",type:"boolean",required:!1,default:"false",description:"Stretches the button to fill its container width."},{name:"bordered",type:"boolean",required:!1,default:"true",description:"When false removes the button border entirely, producing a flat look."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon element rendered before the label."},{name:"rightIcon",type:"ReactNode",required:!1,description:"Icon element rendered after the label."},{name:"chevron",type:"boolean",required:!1,default:"false",description:"Appends a chevron-down icon after the label. Useful for dropdown triggers."},{name:"spread",type:"boolean",required:!1,default:"false",description:"Spaces content to the edges (justify-content: space-between). Useful with fullWidth + rightIcon/chevron."},{name:"onClick",type:"function",required:!1,description:"Called when the button is clicked and not disabled or loading."},{name:"type",type:"enum",required:!1,default:"button",description:"Native button type attribute.",enumValues:["button","submit","reset"]}],usageExamples:[{title:"Primary action",code:'<Button variant="primary" onClick={handleSave}>Save changes</Button>'},{title:"Destructive action",code:'<Button variant="danger" onClick={handleDelete}>Delete account</Button>'},{title:"Loading state",code:'<Button variant="primary" loading={isSaving}>Save changes</Button>'},{title:"With icon",code:'<Button variant="secondary" leftIcon={<PlusIcon />}>Add member</Button>'},{title:"Ghost in toolbar",code:'<Button variant="ghost" size="sm">Edit</Button>'},{title:"Full-width submit",code:'<Button variant="primary" type="submit" fullWidth>Sign in</Button>'},{title:"Outline with swatch",code:`<Button size="xs" variant="outline" leftIcon={<span style={{ width: 8, height: 8, borderRadius: '50%', background: '#6366f1' }} />}>Indigo</Button>`},{title:"Dropdown trigger",code:'<Button variant="outline" chevron>Options</Button>'},{title:"Bordered destructive action",code:'<Button variant="danger-outline" onClick={handleRevoke}>Revoke access</Button>'},{title:"Low-emphasis destructive action",code:'<Button variant="danger-ghost" onClick={handleRemove}>Remove</Button>'},{title:"Dense inline action",code:'<Button variant="ghost" size="2xs" leftIcon={<RefreshIcon />}>Retry</Button>'},{title:"Icon-only (square)",code:'<Button variant="outline" size="2xs" leftIcon={<CloseIcon />} aria-label="Close" />',description:"Omitting children auto-sizes the button as a square via aspect-ratio: 1."}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["aria-disabled","aria-busy"],keyboardInteractions:["Enter — activates the button","Space — activates the button"]}},kt={id:"input",name:"Input",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A single-line text field with optional label, helper text, and error state.",designIntent:"Always pair with a visible label — never rely on placeholder text alone as it disappears on input and is inaccessible. Use errorText (not helperText) to surface validation failures; the component applies danger styling automatically. leftElement and rightElement accept icons or small controls (e.g. currency symbol, clear button).",props:[{name:"size",type:"enum",required:!1,default:"md",description:"Controls height, font size, and padding. Label and helper text scale accordingly.",enumValues:["sm","md","lg"]},{name:"type",type:"enum",required:!1,default:"text",description:"HTML input type.",enumValues:["text","number","password","email","tel","url","search","color"]},{name:"label",type:"string",required:!1,description:"Visible label rendered above the input."},{name:"helperText",type:"string",required:!1,description:"Supplementary hint shown below the input."},{name:"errorText",type:"string",required:!1,description:"Validation error message. When set, input renders in error state."},{name:"leftElement",type:"ReactNode",required:!1,description:"Icon or adornment rendered inside the left edge."},{name:"rightElement",type:"ReactNode",required:!1,description:"Icon or adornment rendered inside the right edge."},{name:"placeholder",type:"string",required:!1,description:"Placeholder text. Use as a hint, not a label."},{name:"prefix",type:"ReactNode",required:!1,description:'Inset label attached to the left of the field (e.g. "$", "https://").'},{name:"suffix",type:"ReactNode",required:!1,description:'Inset label attached to the right of the field (e.g. "kg", ".com").'},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the input."},{name:"value",type:"string",required:!1,description:"Controlled value."},{name:"onChange",type:"function",required:!1,description:"Change handler."}],usageExamples:[{title:"Basic",code:'<Input label="Email" type="email" placeholder="you@example.com" />'},{title:"With helper text",code:'<Input label="Username" helperText="3–20 characters, letters and numbers only" />'},{title:"Error state",code:'<Input label="Password" type="password" value={value} errorText="Must be at least 8 characters" />'},{title:"With icon",code:'<Input label="Search" leftElement={<SearchIcon />} placeholder="Search…" />'}],compositionGraph:[],accessibility:{role:"textbox",ariaAttributes:["aria-invalid","aria-describedby","aria-label"],keyboardInteractions:["Tab — focuses the input"]}},St={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Tt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ct={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},nt=c.forwardRef(({label:t,helperText:r,errorText:n,autoResize:o=!1,maxLength:a,showCount:i=!1,size:l="md",id:s,value:d,onChange:f,disabled:m,style:p,...k},x)=>{const g=c.useRef(null),h=x??g,u=s??`lucent-textarea-${Math.random().toString(36).slice(2,7)}`,b=!!n,w=!!m,y=typeof d=="string"?d.length:0;c.useEffect(()=>{if(!o)return;const I=h.current;I&&(I.style.height="auto",I.style.height=`${I.scrollHeight}px`)},[d,o,h]);const S=w?"transparent":b?"var(--lucent-danger-default)":"var(--lucent-border-default)";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",width:"100%"},children:[t&&e.jsx("label",{htmlFor:u,style:{fontSize:Tt[l],fontWeight:"var(--lucent-font-weight-medium)",color:w?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:t}),e.jsx("textarea",{ref:h,id:u,maxLength:a,value:d,onChange:f,disabled:m,"aria-invalid":b,"aria-describedby":b?`${u}-error`:r?`${u}-helper`:void 0,style:{width:"100%",minHeight:"100px",padding:Ct[l],fontSize:St[l],fontFamily:"var(--lucent-font-family-base)",color:w?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",background:w?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",border:`1px solid ${S}`,borderRadius:"var(--lucent-radius-lg)",outline:"none",resize:o?"none":"vertical",boxSizing:"border-box",lineHeight:"var(--lucent-line-height-base)",cursor:w?"not-allowed":void 0,transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),...p},onMouseEnter:I=>{var v;!w&&I.currentTarget!==document.activeElement&&(I.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-strong)"),(v=k.onMouseEnter)==null||v.call(k,I)},onMouseLeave:I=>{var v;!w&&I.currentTarget!==document.activeElement&&(I.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-default)"),(v=k.onMouseLeave)==null||v.call(k,I)},onFocus:I=>{var v;w||(I.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-accent-border)",I.currentTarget.style.boxShadow=`0 0 0 3px ${b?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`,(v=k.onFocus)==null||v.call(k,I))},onBlur:I=>{var v;w||(I.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-default)",I.currentTarget.style.boxShadow="none",(v=k.onBlur)==null||v.call(k,I))},...k}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[b&&e.jsx("span",{id:`${u}-error`,role:"alert",style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:n}),!b&&r&&e.jsx("span",{id:`${u}-helper`,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:r})]}),(i||a)&&e.jsxs("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:a&&y>=a?"var(--lucent-danger-text)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-mono)",flexShrink:0,marginLeft:"var(--lucent-space-2)"},children:[y,a?`/${a}`:""]})]})]})});nt.displayName="Textarea";const It={id:"textarea",name:"Textarea",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A multi-line text input with optional auto-resize and character count.",designIntent:"Use autoResize for open-ended fields (bio, description) where content length is unpredictable. Use maxLength + showCount for fields with hard limits (tweet-style). Behaves identically to Input for label/helper/error patterns.",props:[{name:"label",type:"string",required:!1,description:"Visible label above the textarea."},{name:"helperText",type:"string",required:!1,description:"Hint text shown below."},{name:"errorText",type:"string",required:!1,description:"Validation error. Triggers error styling."},{name:"autoResize",type:"boolean",required:!1,default:"false",description:"Grows with content, disables manual resize handle."},{name:"maxLength",type:"number",required:!1,description:"Character limit. Displays counter when set."},{name:"showCount",type:"boolean",required:!1,default:"false",description:"Always show character counter even without maxLength."},{name:"value",type:"string",required:!1,description:"Controlled value."},{name:"onChange",type:"function",required:!1,description:"Change handler."},{name:"placeholder",type:"string",required:!1,description:"Placeholder text."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls font size and padding.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the textarea."}],usageExamples:[{title:"Basic",code:'<Textarea label="Bio" placeholder="Tell us about yourself…" />'},{title:"Auto-resize",code:'<Textarea label="Description" autoResize value={value} onChange={e => setValue(e.target.value)} />'},{title:"With character count",code:'<Textarea label="Tweet" maxLength={280} showCount value={value} onChange={e => setValue(e.target.value)} />'},{title:"Error state",code:'<Textarea label="Notes" errorText="Required" value="" />'}],compositionGraph:[],accessibility:{role:"textbox",ariaAttributes:["aria-multiline","aria-invalid","aria-describedby"],keyboardInteractions:["Tab — focuses the textarea"]}},jt={id:"badge",name:"Badge",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A small inline label for status, count, or category.",designIntent:'Badges communicate status or category at a glance. Match variant to semantic meaning — never use "danger" for non-critical states or "success" for neutral counts. Use dot=true when a single colour indicator is enough context (e.g. online status). Keep badge text short: 1–3 words maximum.',props:[{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","success","warning","danger","info","accent"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size.",enumValues:["sm","md"]},{name:"dot",type:"boolean",required:!1,default:"false",description:"Prepends a coloured dot indicator."},{name:"children",type:"ReactNode",required:!0,description:"Badge label."}],usageExamples:[{title:"Status",code:'<Badge variant="success" dot>Active</Badge>'},{title:"Count",code:'<Badge variant="danger">12</Badge>'},{title:"Category",code:'<Badge variant="info">Beta</Badge>'},{title:"Neutral tag",code:"<Badge>Draft</Badge>"}],compositionGraph:[],accessibility:{role:"status",notes:"Use aria-label on the parent element when badge meaning depends on context."}},Mt={neutral:{bg:"var(--lucent-surface-secondary)",color:"var(--lucent-text-secondary)",border:"var(--lucent-border-default)",hoverBg:"var(--lucent-surface-hover, #e5e7eb)",hoverBorder:"var(--lucent-border-strong)"},accent:{bg:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",border:"var(--lucent-accent-default)",hoverBg:"var(--lucent-accent-hover)",hoverBorder:"var(--lucent-accent-hover)"},success:{bg:"var(--lucent-success-subtle)",color:"var(--lucent-success-text)",border:"var(--lucent-success-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-success-default) 15%, var(--lucent-success-subtle))",hoverBorder:"var(--lucent-success-default)"},warning:{bg:"var(--lucent-warning-subtle)",color:"var(--lucent-warning-text)",border:"var(--lucent-warning-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-warning-default) 15%, var(--lucent-warning-subtle))",hoverBorder:"var(--lucent-warning-default)"},danger:{bg:"var(--lucent-danger-subtle)",color:"var(--lucent-danger-text)",border:"var(--lucent-danger-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-danger-default) 15%, var(--lucent-danger-subtle))",hoverBorder:"var(--lucent-danger-default)"},info:{bg:"var(--lucent-info-subtle)",color:"var(--lucent-info-text)",border:"var(--lucent-info-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-info-default) 15%, var(--lucent-info-subtle))",hoverBorder:"var(--lucent-info-default)"}},zt={sm:{fontSize:"var(--lucent-font-size-xs)",height:"calc(var(--lucent-space-5) * 0.5 + 10px)",padding:"var(--lucent-space-1) var(--lucent-space-2)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-2)",iconSize:12,dotSize:6,gap:"var(--lucent-space-1)"},md:{fontSize:"var(--lucent-font-size-sm)",height:"calc(var(--lucent-space-6) * 0.5 + 12px)",padding:"var(--lucent-space-1) var(--lucent-space-2)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-2)",iconSize:14,dotSize:7,gap:"var(--lucent-space-2)"},lg:{fontSize:"var(--lucent-font-size-md)",height:"calc(var(--lucent-space-8) * 0.5 + 14px)",padding:"var(--lucent-space-1) var(--lucent-space-3)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-2) var(--lucent-space-1) var(--lucent-space-3)",iconSize:16,dotSize:8,gap:"var(--lucent-space-2)"}},Et=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),I=require("./LucentProvider-we0nRXn-.cjs"),c=require("react"),J=require("react-dom"),wt={id:"button",name:"Button",tier:"atom",domain:"neutral",specVersion:"1.0",description:"A clickable control that triggers an action. The primary interactive primitive in Lucent UI.",designIntent:'Buttons communicate available actions. Variant conveys hierarchy: use "primary" for the single most important action in a view, "secondary" for supporting actions, "ghost" for low-emphasis actions in dense UIs, "outline" for bordered buttons with transparent background, and "danger" exclusively for destructive or irreversible operations. Use "danger-ghost" for low-emphasis destructive actions (red text, no fill) and "danger-outline" for bordered destructive buttons (also transparent background). Size should match surrounding content density — prefer "md" as the default, "sm" for toolbars or tables, "xs" for compact UIs like customizer panels, and "2xs" for ultra-dense inline controls (~22px height) such as table-inline actions or toolbar icon triggers. Icon-only buttons (leftIcon/rightIcon without children) automatically render as square with aspect-ratio: 1.',props:[{name:"variant",type:"enum",required:!1,default:"primary",description:'Visual style conveying action hierarchy. "primary" — filled accent for the single most important action. "secondary" — subtle accent-tinted fill for supporting actions. "outline" — bordered with no fill, for neutral secondary actions. "ghost" — transparent with no border, for low-emphasis or inline actions. "danger" — filled red for irreversible destructive actions (e.g. "Delete account"). "danger-outline" — red border + red text for destructive actions that need visual weight without a filled background. "danger-ghost" — red text only, for low-emphasis destructive actions (e.g. "Remove" in a list row).',enumValues:["primary","secondary","outline","ghost","danger","danger-outline","danger-ghost"]},{name:"size",type:"enum",required:!1,default:"md",description:'Controls height and padding. "lg" (48px) — hero sections, onboarding flows. "md" (42px) — default for most forms and dialogs. "sm" (34px) — toolbars, table headers, card actions. "xs" (26px) — compact UIs like customizer panels, inline controls. "2xs" (22px) — ultra-dense inline icon triggers, table-row actions, dashboard toolbar buttons.',enumValues:["2xs","xs","sm","md","lg"]},{name:"children",type:"ReactNode",required:!1,description:"Button label or content. Omit for icon-only buttons (provide leftIcon or rightIcon instead)."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and applies disabled styling."},{name:"loading",type:"boolean",required:!1,default:"false",description:"Shows a spinner and prevents interaction while an async action is in progress."},{name:"fullWidth",type:"boolean",required:!1,default:"false",description:"Stretches the button to fill its container width."},{name:"bordered",type:"boolean",required:!1,default:"true",description:"When false removes the button border entirely, producing a flat look."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon element rendered before the label."},{name:"rightIcon",type:"ReactNode",required:!1,description:"Icon element rendered after the label."},{name:"chevron",type:"boolean",required:!1,default:"false",description:"Appends a chevron-down icon after the label. Useful for dropdown triggers."},{name:"spread",type:"boolean",required:!1,default:"false",description:"Spaces content to the edges (justify-content: space-between). Useful with fullWidth + rightIcon/chevron."},{name:"onClick",type:"function",required:!1,description:"Called when the button is clicked and not disabled or loading."},{name:"type",type:"enum",required:!1,default:"button",description:"Native button type attribute.",enumValues:["button","submit","reset"]}],usageExamples:[{title:"Primary action",code:'<Button variant="primary" onClick={handleSave}>Save changes</Button>'},{title:"Destructive action",code:'<Button variant="danger" onClick={handleDelete}>Delete account</Button>'},{title:"Loading state",code:'<Button variant="primary" loading={isSaving}>Save changes</Button>'},{title:"With icon",code:'<Button variant="secondary" leftIcon={<PlusIcon />}>Add member</Button>'},{title:"Ghost in toolbar",code:'<Button variant="ghost" size="sm">Edit</Button>'},{title:"Full-width submit",code:'<Button variant="primary" type="submit" fullWidth>Sign in</Button>'},{title:"Outline with swatch",code:`<Button size="xs" variant="outline" leftIcon={<span style={{ width: 8, height: 8, borderRadius: '50%', background: '#6366f1' }} />}>Indigo</Button>`},{title:"Dropdown trigger",code:'<Button variant="outline" chevron>Options</Button>'},{title:"Bordered destructive action",code:'<Button variant="danger-outline" onClick={handleRevoke}>Revoke access</Button>'},{title:"Low-emphasis destructive action",code:'<Button variant="danger-ghost" onClick={handleRemove}>Remove</Button>'},{title:"Dense inline action",code:'<Button variant="ghost" size="2xs" leftIcon={<RefreshIcon />}>Retry</Button>'},{title:"Icon-only (square)",code:'<Button variant="outline" size="2xs" leftIcon={<CloseIcon />} aria-label="Close" />',description:"Omitting children auto-sizes the button as a square via aspect-ratio: 1."}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["aria-disabled","aria-busy"],keyboardInteractions:["Enter — activates the button","Space — activates the button"]}},kt={id:"input",name:"Input",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A single-line text field with optional label, helper text, and error state.",designIntent:"Always pair with a visible label — never rely on placeholder text alone as it disappears on input and is inaccessible. Use errorText (not helperText) to surface validation failures; the component applies danger styling automatically. leftElement and rightElement accept icons or small controls (e.g. currency symbol, clear button).",props:[{name:"size",type:"enum",required:!1,default:"md",description:"Controls height, font size, and padding. Label and helper text scale accordingly.",enumValues:["sm","md","lg"]},{name:"type",type:"enum",required:!1,default:"text",description:"HTML input type.",enumValues:["text","number","password","email","tel","url","search","color"]},{name:"label",type:"string",required:!1,description:"Visible label rendered above the input."},{name:"helperText",type:"string",required:!1,description:"Supplementary hint shown below the input."},{name:"errorText",type:"string",required:!1,description:"Validation error message. When set, input renders in error state."},{name:"leftElement",type:"ReactNode",required:!1,description:"Icon or adornment rendered inside the left edge."},{name:"rightElement",type:"ReactNode",required:!1,description:"Icon or adornment rendered inside the right edge."},{name:"placeholder",type:"string",required:!1,description:"Placeholder text. Use as a hint, not a label."},{name:"prefix",type:"ReactNode",required:!1,description:'Inset label attached to the left of the field (e.g. "$", "https://").'},{name:"suffix",type:"ReactNode",required:!1,description:'Inset label attached to the right of the field (e.g. "kg", ".com").'},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the input."},{name:"value",type:"string",required:!1,description:"Controlled value."},{name:"onChange",type:"function",required:!1,description:"Change handler."}],usageExamples:[{title:"Basic",code:'<Input label="Email" type="email" placeholder="you@example.com" />'},{title:"With helper text",code:'<Input label="Username" helperText="3–20 characters, letters and numbers only" />'},{title:"Error state",code:'<Input label="Password" type="password" value={value} errorText="Must be at least 8 characters" />'},{title:"With icon",code:'<Input label="Search" leftElement={<SearchIcon />} placeholder="Search…" />'}],compositionGraph:[],accessibility:{role:"textbox",ariaAttributes:["aria-invalid","aria-describedby","aria-label"],keyboardInteractions:["Tab — focuses the input"]}},St={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Tt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ct={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},nt=c.forwardRef(({label:t,helperText:r,errorText:n,autoResize:o=!1,maxLength:a,showCount:i=!1,size:s="md",id:l,value:d,onChange:p,disabled:m,style:f,...w},y)=>{const g=c.useRef(null),h=y??g,u=l??`lucent-textarea-${Math.random().toString(36).slice(2,7)}`,b=!!n,x=!!m,k=typeof d=="string"?d.length:0;c.useEffect(()=>{if(!o)return;const C=h.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[d,o,h]);const S=x?"transparent":b?"var(--lucent-danger-default)":"var(--lucent-border-default)";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",width:"100%"},children:[t&&e.jsx("label",{htmlFor:u,style:{fontSize:Tt[s],fontWeight:"var(--lucent-font-weight-medium)",color:x?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:t}),e.jsx("textarea",{ref:h,id:u,maxLength:a,value:d,onChange:p,disabled:m,"aria-invalid":b,"aria-describedby":b?`${u}-error`:r?`${u}-helper`:void 0,style:{width:"100%",minHeight:"100px",padding:Ct[s],fontSize:St[s],fontFamily:"var(--lucent-font-family-base)",color:x?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",background:x?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",border:`1px solid ${S}`,borderRadius:"var(--lucent-radius-lg)",outline:"none",resize:o?"none":"vertical",boxSizing:"border-box",lineHeight:"var(--lucent-line-height-base)",cursor:x?"not-allowed":void 0,transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),...f},onMouseEnter:C=>{var v;!x&&C.currentTarget!==document.activeElement&&(C.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-strong)"),(v=w.onMouseEnter)==null||v.call(w,C)},onMouseLeave:C=>{var v;!x&&C.currentTarget!==document.activeElement&&(C.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-default)"),(v=w.onMouseLeave)==null||v.call(w,C)},onFocus:C=>{var v;x||(C.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-accent-border)",C.currentTarget.style.boxShadow=`0 0 0 3px ${b?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`,(v=w.onFocus)==null||v.call(w,C))},onBlur:C=>{var v;x||(C.currentTarget.style.borderColor=b?"var(--lucent-danger-default)":"var(--lucent-border-default)",C.currentTarget.style.boxShadow="none",(v=w.onBlur)==null||v.call(w,C))},...w}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[b&&e.jsx("span",{id:`${u}-error`,role:"alert",style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:n}),!b&&r&&e.jsx("span",{id:`${u}-helper`,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:r})]}),(i||a)&&e.jsxs("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:a&&k>=a?"var(--lucent-danger-text)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-mono)",flexShrink:0,marginLeft:"var(--lucent-space-2)"},children:[k,a?`/${a}`:""]})]})]})});nt.displayName="Textarea";const It={id:"textarea",name:"Textarea",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A multi-line text input with optional auto-resize and character count.",designIntent:"Use autoResize for open-ended fields (bio, description) where content length is unpredictable. Use maxLength + showCount for fields with hard limits (tweet-style). Behaves identically to Input for label/helper/error patterns.",props:[{name:"label",type:"string",required:!1,description:"Visible label above the textarea."},{name:"helperText",type:"string",required:!1,description:"Hint text shown below."},{name:"errorText",type:"string",required:!1,description:"Validation error. Triggers error styling."},{name:"autoResize",type:"boolean",required:!1,default:"false",description:"Grows with content, disables manual resize handle."},{name:"maxLength",type:"number",required:!1,description:"Character limit. Displays counter when set."},{name:"showCount",type:"boolean",required:!1,default:"false",description:"Always show character counter even without maxLength."},{name:"value",type:"string",required:!1,description:"Controlled value."},{name:"onChange",type:"function",required:!1,description:"Change handler."},{name:"placeholder",type:"string",required:!1,description:"Placeholder text."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls font size and padding.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the textarea."}],usageExamples:[{title:"Basic",code:'<Textarea label="Bio" placeholder="Tell us about yourself…" />'},{title:"Auto-resize",code:'<Textarea label="Description" autoResize value={value} onChange={e => setValue(e.target.value)} />'},{title:"With character count",code:'<Textarea label="Tweet" maxLength={280} showCount value={value} onChange={e => setValue(e.target.value)} />'},{title:"Error state",code:'<Textarea label="Notes" errorText="Required" value="" />'}],compositionGraph:[],accessibility:{role:"textbox",ariaAttributes:["aria-multiline","aria-invalid","aria-describedby"],keyboardInteractions:["Tab — focuses the textarea"]}},jt={id:"badge",name:"Badge",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A small inline label for status, count, or category.",designIntent:'Badges communicate status or category at a glance. Match variant to semantic meaning — never use "danger" for non-critical states or "success" for neutral counts. Use dot=true when a single colour indicator is enough context (e.g. online status). Keep badge text short: 1–3 words maximum.',props:[{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","success","warning","danger","info","accent"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size.",enumValues:["sm","md"]},{name:"dot",type:"boolean",required:!1,default:"false",description:"Prepends a coloured dot indicator."},{name:"children",type:"ReactNode",required:!0,description:"Badge label."}],usageExamples:[{title:"Status",code:'<Badge variant="success" dot>Active</Badge>'},{title:"Count",code:'<Badge variant="danger">12</Badge>'},{title:"Category",code:'<Badge variant="info">Beta</Badge>'},{title:"Neutral tag",code:"<Badge>Draft</Badge>"}],compositionGraph:[],accessibility:{role:"status",notes:"Use aria-label on the parent element when badge meaning depends on context."}},Mt={neutral:{bg:"var(--lucent-surface-secondary)",color:"var(--lucent-text-secondary)",border:"var(--lucent-border-default)",hoverBg:"var(--lucent-surface-hover, #e5e7eb)",hoverBorder:"var(--lucent-border-strong)"},accent:{bg:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",border:"var(--lucent-accent-default)",hoverBg:"var(--lucent-accent-hover)",hoverBorder:"var(--lucent-accent-hover)"},success:{bg:"var(--lucent-success-subtle)",color:"var(--lucent-success-text)",border:"var(--lucent-success-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-success-default) 15%, var(--lucent-success-subtle))",hoverBorder:"var(--lucent-success-default)"},warning:{bg:"var(--lucent-warning-subtle)",color:"var(--lucent-warning-text)",border:"var(--lucent-warning-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-warning-default) 15%, var(--lucent-warning-subtle))",hoverBorder:"var(--lucent-warning-default)"},danger:{bg:"var(--lucent-danger-subtle)",color:"var(--lucent-danger-text)",border:"var(--lucent-danger-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-danger-default) 15%, var(--lucent-danger-subtle))",hoverBorder:"var(--lucent-danger-default)"},info:{bg:"var(--lucent-info-subtle)",color:"var(--lucent-info-text)",border:"var(--lucent-info-subtle)",hoverBg:"color-mix(in srgb, var(--lucent-info-default) 15%, var(--lucent-info-subtle))",hoverBorder:"var(--lucent-info-default)"}},zt={sm:{fontSize:"var(--lucent-font-size-xs)",height:"calc(var(--lucent-space-5) * 0.5 + 10px)",padding:"var(--lucent-space-1) var(--lucent-space-2)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-2)",iconSize:12,dotSize:6,gap:"var(--lucent-space-1)"},md:{fontSize:"var(--lucent-font-size-sm)",height:"calc(var(--lucent-space-6) * 0.5 + 12px)",padding:"var(--lucent-space-1) var(--lucent-space-2)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-1) var(--lucent-space-2)",iconSize:14,dotSize:7,gap:"var(--lucent-space-2)"},lg:{fontSize:"var(--lucent-font-size-md)",height:"calc(var(--lucent-space-8) * 0.5 + 14px)",padding:"var(--lucent-space-1) var(--lucent-space-3)",paddingDismiss:"var(--lucent-space-1) var(--lucent-space-2) var(--lucent-space-1) var(--lucent-space-3)",iconSize:16,dotSize:8,gap:"var(--lucent-space-2)"}},Et=`
2
2
  @keyframes lucent-chip-pulse {
3
3
  0% { transform: scale(1); opacity: 0.6; }
4
4
  100% { transform: scale(2.8); opacity: 0; }
5
- }`;function se({children:t,variant:r="neutral",size:n="md",onDismiss:o,onClick:a,leftIcon:i,swatch:l,dot:s=!1,pulse:d=!1,borderless:f=!1,ghost:m=!1,disabled:p=!1,style:k}){const x=Mt[r],g=zt[n],[h,u]=c.useState(!1),b=s&&d,w=s&&!t,y=!p&&(o||a),S=`color-mix(in srgb, ${x.color} 8%, transparent)`,I=g.dotSize*3,v={display:"inline-flex",alignItems:"center",justifyContent:w?"center":void 0,gap:w?void 0:g.gap,height:w?I:g.height,width:w?I:void 0,padding:w?0:o?g.paddingDismiss:g.padding,fontSize:g.fontSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,borderRadius:w?"var(--lucent-radius-full)":"var(--lucent-radius-lg)",background:m?h&&y?S:"transparent":h&&y?x.hoverBg:x.bg,color:x.color,border:m||f?"1px solid transparent":`1px solid ${h&&y?x.hoverBorder:x.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:p?.5:1,transform:h&&y?"translateY(-1px)":"none",boxShadow:h&&y&&!m?`0 2px 4px ${x.hoverBorder}22`:"none",transition:["transform var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)","border-color var(--lucent-duration-fast) var(--lucent-easing-default)","background var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),cursor:y?"pointer":"default",...a?{outline:"none"}:{},...k},A=e.jsxs(e.Fragment,{children:[b&&e.jsx("style",{children:Et}),l&&e.jsx("span",{style:{width:g.dotSize+2,height:g.dotSize+2,borderRadius:"50%",background:l,border:"1px solid rgba(0,0,0,0.1)",flexShrink:0}}),s&&!l&&e.jsxs("span",{style:{position:"relative",width:g.dotSize,height:g.dotSize,flexShrink:0},children:[e.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"currentColor"}}),b&&e.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"currentColor",animation:"lucent-chip-pulse 1.5s ease-out infinite"}})]}),i&&!l&&!s&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:g.iconSize,height:g.iconSize,flexShrink:0},children:i}),t,o&&e.jsx("button",{type:"button",onClick:p?void 0:z=>{z.stopPropagation(),o()},disabled:p,"aria-label":"Dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:g.iconSize+2,height:g.iconSize+2,padding:0,border:"none",borderRadius:"var(--lucent-radius-lg)",background:"transparent",color:"inherit",cursor:p?"not-allowed":"pointer",flexShrink:0,lineHeight:1},children:e.jsx("svg",{width:g.iconSize-2,height:g.iconSize-2,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",children:e.jsx("path",{d:"M2 2L8 8M8 2L2 8"})})})]}),T={onMouseEnter:()=>{p||u(!0)},onMouseLeave:()=>u(!1)};return a?e.jsx("button",{type:"button",onClick:p?void 0:a,disabled:p,style:v,...T,children:A}):e.jsx("span",{style:v,...T,children:A})}const At={id:"chip",name:"Chip",tier:"atom",domain:"neutral",specVersion:"1.0",description:"A compact label for filters, tags, statuses, and categories. Combines the roles of Badge and Tag into a single flexible component.",designIntent:"Chip is the universal label primitive — use it anywhere you need a compact visual marker. It replaces both Badge (static status) and Tag (dismissible filter) with a single component. Use `onDismiss` for removable chips (filters, multi-select values). Use `onClick` for clickable/selectable chips (filter toggles, category navigation). Use `dot` for status indicators (online/offline). Use `dot` + `pulse` to show in-progress or live states (deploying, syncing, live incident). Use `ghost` + `dot` for subtle inline status that blends into surrounding text or table rows. Omit `children` with `dot` for a minimal dot-only indicator — great for table cells or avatar badges. Use `swatch` for color-coded categories. Use `leftIcon` for chips with leading icons (folders, file types, flags). Use `borderless` for a softer, filled-only appearance in dense UIs. Variant conveys semantic meaning — default to neutral for user-generated content.",props:[{name:"children",type:"ReactNode",required:!1,description:"Chip label content. When omitted with dot=true, renders as a compact dot-only indicator."},{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","accent","success","warning","danger","info"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height, font size, and icon size.",enumValues:["sm","md","lg"]},{name:"onDismiss",type:"function",required:!1,description:"Renders an x button that calls this handler. Use for removable filters and multi-select values."},{name:"onClick",type:"function",required:!1,description:"Makes the chip clickable (renders as <button>). Use for filter toggles and category links."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon or element rendered before the label (emoji, flag, avatar)."},{name:"swatch",type:"string",required:!1,description:"Hex color string. Renders a small color dot before the label."},{name:"dot",type:"boolean",required:!1,default:"false",description:"Renders a status dot using the variant colour. Omit children for a compact dot-only indicator."},{name:"pulse",type:"boolean",required:!1,default:"false",description:"Adds a pulsing ring animation to the status dot. Only applies when dot=true. Use for running, deploying, or live states."},{name:"borderless",type:"boolean",required:!1,default:"false",description:"Removes the border for a filled-only look."},{name:"ghost",type:"boolean",required:!1,default:"false",description:"Transparent background with text color only. Pairs well with dot for subtle inline statuses in tables or lists."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Dims the chip and prevents interaction."},{name:"style",type:"object",required:!1,description:"Inline style overrides."}],usageExamples:[{title:"Status dot",code:'<Chip variant="success" dot>Online</Chip>'},{title:"Pulsing status (in-progress)",code:'<Chip variant="warning" dot pulse>Deploying</Chip>'},{title:"Ghost status (inline/table)",code:'<Chip variant="success" ghost dot>Active</Chip>'},{title:"Ghost pulsing",code:'<Chip variant="danger" ghost dot pulse>Live incident</Chip>'},{title:"Dot only (minimal)",code:'<Chip variant="success" dot />'},{title:"Dot only pulsing",code:'<Chip variant="danger" dot pulse />'},{title:"Dismissible filter",code:"<Chip onDismiss={() => removeFilter('react')}>React</Chip>"},{title:"Color swatch",code:'<Chip swatch="#6366f1" onDismiss={() => {}}>Indigo</Chip>'},{title:"With icon",code:"<Chip leftIcon={<FolderIcon />} onDismiss={() => {}}>Documents</Chip>"},{title:"Clickable category",code:`<Chip variant="accent" onClick={() => navigate('/ux')}>UX</Chip>`},{title:"Borderless",code:'<Chip variant="warning" borderless>Pending</Chip>'},{title:"Static label",code:'<Chip variant="info">Beta</Chip>'}],compositionGraph:[],accessibility:{role:"group",notes:'When onClick is provided, renders as <button> with native button semantics. Dismiss button has aria-label="Dismiss" and stopPropagation to prevent parent click handlers.',keyboardInteractions:["Enter / Space — activates onClick or dismiss button when focused"]}},qt={xs:24,sm:32,md:40,lg:56,xl:80},Dt={xs:"var(--lucent-font-size-xs)",sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-lg)",xl:"var(--lucent-font-size-xl)"};function Rt(t,r){var o,a,i;if(r)return r.slice(0,2).toUpperCase();const n=t.trim().split(/\s+/);return n.length===1?(((o=n[0])==null?void 0:o[0])??"").toUpperCase():((((a=n[0])==null?void 0:a[0])??"")+(((i=n[n.length-1])==null?void 0:i[0])??"")).toUpperCase()}function Bt({src:t,alt:r,size:n="md",initials:o,style:a,...i}){const l=qt[n],s=Rt(r,o),d={width:l,height:l,borderRadius:"var(--lucent-radius-full)",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",userSelect:"none",...a};return t?e.jsx("img",{src:t,alt:r,width:l,height:l,style:{...d,objectFit:"cover"},...i}):e.jsx("span",{role:"img","aria-label":r,style:{...d,background:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",fontSize:Dt[n],fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)"},children:s})}const Pt={id:"avatar",name:"Avatar",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A circular user image with initials fallback.",designIntent:"Always provide alt for accessibility — it is used to derive initials automatically when src is absent or fails. Use initials prop to override auto-derived initials (e.g. for non-Latin names). Size xs/sm suit table rows and compact lists; md is the default for comment threads; lg/xl for profile headers.",props:[{name:"src",type:"string",required:!1,description:"Image URL. Falls back to initials if omitted or fails to load."},{name:"alt",type:"string",required:!0,description:"Alt text and source for auto-derived initials."},{name:"size",type:"enum",required:!1,default:"md",description:"Diameter of the avatar.",enumValues:["xs","sm","md","lg","xl"]},{name:"initials",type:"string",required:!1,description:"Override auto-derived initials (max 2 characters)."}],usageExamples:[{title:"With image",code:'<Avatar src="/avatars/jane.jpg" alt="Jane Doe" />'},{title:"Initials fallback",code:'<Avatar alt="Jane Doe" />'},{title:"Large profile",code:'<Avatar src={user.avatar} alt={user.name} size="lg" />'},{title:"Custom initials",code:'<Avatar alt="张伟" initials="张" size="md" />'}],compositionGraph:[],accessibility:{role:"img",ariaAttributes:["aria-label"],notes:'When src is present, renders as <img> with alt. When showing initials, renders as <span role="img" aria-label>.'}},Lt={xs:12,sm:16,md:24,lg:36},Ft={xs:2.5,sm:2.5,md:2,lg:2};function rt({size:t="md",label:r="Loading…",color:n}){const o=Lt[t],a=Ft[t];return e.jsxs("span",{role:"status","aria-label":r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:[e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"lucent-spin 0.7s linear infinite",color:n??"currentColor"},children:[e.jsx("style",{children:"@keyframes lucent-spin { to { transform: rotate(360deg); } }"}),e.jsx("circle",{cx:12,cy:12,r:10,stroke:"currentColor",strokeWidth:a,strokeOpacity:.2}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round"})]}),e.jsx("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap"},children:r})]})}const Nt={id:"spinner",name:"Spinner",tier:"atom",domain:"neutral",specVersion:"0.1",description:"An animated loading indicator for async operations.",designIntent:"Use Spinner for indeterminate loading states of short duration (< 3s). For full-page or skeleton-level loading, prefer Skeleton instead. The label prop is visually hidden but read by screen readers — always set it to a meaningful description of what is loading.",props:[{name:"size",type:"enum",required:!1,default:"md",description:"Spinner diameter.",enumValues:["xs","sm","md","lg"]},{name:"label",type:"string",required:!1,default:"Loading…",description:"Visually hidden accessible label."},{name:"color",type:"string",required:!1,description:"Override colour (CSS value). Defaults to currentColor."}],usageExamples:[{title:"Default",code:"<Spinner />"},{title:"Inside button",code:'<Button loading><Spinner size="sm" label="Saving…" /></Button>'},{title:"Full-page overlay",code:`<div style={{ display: 'grid', placeItems: 'center', minHeight: '100vh' }}><Spinner size="lg" label="Loading dashboard…" /></div>`}],compositionGraph:[],accessibility:{role:"status",ariaAttributes:["aria-label"],notes:'The visible SVG is aria-hidden. The label is conveyed via a visually-hidden span inside role="status".'}};function $t({orientation:t="horizontal",label:r,spacing:n="0",style:o}){return t==="vertical"?e.jsx("span",{role:"separator","aria-orientation":"vertical",style:{display:"inline-block",width:"1px",alignSelf:"stretch",background:"var(--lucent-border-default)",margin:`0 ${n}`,flexShrink:0,...o}}):r?e.jsxs("div",{role:"separator","aria-label":r,style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",margin:`${n} 0`,...o},children:[e.jsx("span",{style:{flex:1,height:"1px",background:"var(--lucent-border-default)"}}),e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)",whiteSpace:"nowrap",letterSpacing:"var(--lucent-letter-spacing-wide)",textTransform:"uppercase"},children:r}),e.jsx("span",{style:{flex:1,height:"1px",background:"var(--lucent-border-default)"}})]}):e.jsx("hr",{role:"separator",style:{border:"none",borderTop:"1px solid var(--lucent-border-default)",margin:`${n} 0`,width:"100%",...o}})}const Wt={id:"divider",name:"Divider",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A visual separator between content sections, horizontal or vertical.",designIntent:'Use horizontal Divider to separate sections in a layout. Use vertical Divider inline between sibling elements (e.g. nav links, toolbar buttons). Use the label prop for "OR" separators in auth flows or form sections — never use a plain text node next to a divider for this.',props:[{name:"orientation",type:"enum",required:!1,default:"horizontal",description:"Direction of the divider line.",enumValues:["horizontal","vertical"]},{name:"label",type:"string",required:!1,description:'Optional centered label (horizontal only). Common use: "OR", "AND", section titles.'},{name:"spacing",type:"string",required:!1,default:"0",description:'Margin on the axis perpendicular to the line. Defaults to 0 so parent gap-based layouts (Stack, Row) control spacing. Pass an explicit value like "var(--lucent-space-4)" for standalone use outside flex/grid containers.'}],usageExamples:[{title:"Section separator",code:"<Divider />"},{title:"With label",code:'<Divider label="OR" />'},{title:"Vertical in nav",code:`<nav style={{ display: 'flex', alignItems: 'center' }}><a>Home</a><Divider orientation="vertical" /><a>About</a></nav>`}],compositionGraph:[],accessibility:{role:"separator",ariaAttributes:["aria-orientation","aria-label"]}},Ot={sm:14,md:16,lg:20},Vt={sm:"calc(var(--lucent-space-8) * 0.5 + 16px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px)"},Ht=`
5
+ }`;function se({children:t,variant:r="neutral",size:n="md",onDismiss:o,onClick:a,leftIcon:i,swatch:s,dot:l=!1,pulse:d=!1,borderless:p=!1,ghost:m=!1,disabled:f=!1,style:w}){const y=Mt[r],g=zt[n],[h,u]=c.useState(!1),b=l&&d,x=l&&!t,k=!f&&(o||a),S=`color-mix(in srgb, ${y.color} 8%, transparent)`,C=g.dotSize*3,v={display:"inline-flex",alignItems:"center",justifyContent:x?"center":void 0,gap:x?void 0:g.gap,height:x?C:g.height,width:x?C:void 0,padding:x?0:o?g.paddingDismiss:g.padding,fontSize:g.fontSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,borderRadius:x?"var(--lucent-radius-full)":"var(--lucent-radius-lg)",background:m?h&&k?S:"transparent":h&&k?y.hoverBg:y.bg,color:y.color,border:m||p?"1px solid transparent":`1px solid ${h&&k?y.hoverBorder:y.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:f?.5:1,transform:h&&k?"translateY(-1px)":"none",boxShadow:h&&k&&!m?`0 2px 4px ${y.hoverBorder}22`:"none",transition:["transform var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)","border-color var(--lucent-duration-fast) var(--lucent-easing-default)","background var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),cursor:k?"pointer":"default",...a?{outline:"none"}:{},...w},z=e.jsxs(e.Fragment,{children:[b&&e.jsx("style",{children:Et}),s&&e.jsx("span",{style:{width:g.dotSize+2,height:g.dotSize+2,borderRadius:"50%",background:s,border:"1px solid rgba(0,0,0,0.1)",flexShrink:0}}),l&&!s&&e.jsxs("span",{style:{position:"relative",width:g.dotSize,height:g.dotSize,flexShrink:0},children:[e.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"currentColor"}}),b&&e.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"currentColor",animation:"lucent-chip-pulse 1.5s ease-out infinite"}})]}),i&&!s&&!l&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:g.iconSize,height:g.iconSize,flexShrink:0},children:i}),t,o&&e.jsx("button",{type:"button",onClick:f?void 0:E=>{E.stopPropagation(),o()},disabled:f,"aria-label":"Dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:g.iconSize+2,height:g.iconSize+2,padding:0,border:"none",borderRadius:"var(--lucent-radius-lg)",background:"transparent",color:"inherit",cursor:f?"not-allowed":"pointer",flexShrink:0,lineHeight:1},children:e.jsx("svg",{width:g.iconSize-2,height:g.iconSize-2,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",children:e.jsx("path",{d:"M2 2L8 8M8 2L2 8"})})})]}),T={onMouseEnter:()=>{f||u(!0)},onMouseLeave:()=>u(!1)};return a?e.jsx("button",{type:"button",onClick:f?void 0:a,disabled:f,style:v,...T,children:z}):e.jsx("span",{style:v,...T,children:z})}const At={id:"chip",name:"Chip",tier:"atom",domain:"neutral",specVersion:"1.0",description:"A compact label for filters, tags, statuses, and categories. Combines the roles of Badge and Tag into a single flexible component.",designIntent:"Chip is the universal label primitive — use it anywhere you need a compact visual marker. It replaces both Badge (static status) and Tag (dismissible filter) with a single component. Use `onDismiss` for removable chips (filters, multi-select values). Use `onClick` for clickable/selectable chips (filter toggles, category navigation). Use `dot` for status indicators (online/offline). Use `dot` + `pulse` to show in-progress or live states (deploying, syncing, live incident). Use `ghost` + `dot` for subtle inline status that blends into surrounding text or table rows. Omit `children` with `dot` for a minimal dot-only indicator — great for table cells or avatar badges. Use `swatch` for color-coded categories. Use `leftIcon` for chips with leading icons (folders, file types, flags). Use `borderless` for a softer, filled-only appearance in dense UIs. Variant conveys semantic meaning — default to neutral for user-generated content.",props:[{name:"children",type:"ReactNode",required:!1,description:"Chip label content. When omitted with dot=true, renders as a compact dot-only indicator."},{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","accent","success","warning","danger","info"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height, font size, and icon size.",enumValues:["sm","md","lg"]},{name:"onDismiss",type:"function",required:!1,description:"Renders an x button that calls this handler. Use for removable filters and multi-select values."},{name:"onClick",type:"function",required:!1,description:"Makes the chip clickable (renders as <button>). Use for filter toggles and category links."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon or element rendered before the label (emoji, flag, avatar)."},{name:"swatch",type:"string",required:!1,description:"Hex color string. Renders a small color dot before the label."},{name:"dot",type:"boolean",required:!1,default:"false",description:"Renders a status dot using the variant colour. Omit children for a compact dot-only indicator."},{name:"pulse",type:"boolean",required:!1,default:"false",description:"Adds a pulsing ring animation to the status dot. Only applies when dot=true. Use for running, deploying, or live states."},{name:"borderless",type:"boolean",required:!1,default:"false",description:"Removes the border for a filled-only look."},{name:"ghost",type:"boolean",required:!1,default:"false",description:"Transparent background with text color only. Pairs well with dot for subtle inline statuses in tables or lists."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Dims the chip and prevents interaction."},{name:"style",type:"object",required:!1,description:"Inline style overrides."}],usageExamples:[{title:"Status dot",code:'<Chip variant="success" dot>Online</Chip>'},{title:"Pulsing status (in-progress)",code:'<Chip variant="warning" dot pulse>Deploying</Chip>'},{title:"Ghost status (inline/table)",code:'<Chip variant="success" ghost dot>Active</Chip>'},{title:"Ghost pulsing",code:'<Chip variant="danger" ghost dot pulse>Live incident</Chip>'},{title:"Dot only (minimal)",code:'<Chip variant="success" dot />'},{title:"Dot only pulsing",code:'<Chip variant="danger" dot pulse />'},{title:"Dismissible filter",code:"<Chip onDismiss={() => removeFilter('react')}>React</Chip>"},{title:"Color swatch",code:'<Chip swatch="#6366f1" onDismiss={() => {}}>Indigo</Chip>'},{title:"With icon",code:"<Chip leftIcon={<FolderIcon />} onDismiss={() => {}}>Documents</Chip>"},{title:"Clickable category",code:`<Chip variant="accent" onClick={() => navigate('/ux')}>UX</Chip>`},{title:"Borderless",code:'<Chip variant="warning" borderless>Pending</Chip>'},{title:"Static label",code:'<Chip variant="info">Beta</Chip>'}],compositionGraph:[],accessibility:{role:"group",notes:'When onClick is provided, renders as <button> with native button semantics. Dismiss button has aria-label="Dismiss" and stopPropagation to prevent parent click handlers.',keyboardInteractions:["Enter / Space — activates onClick or dismiss button when focused"]}},qt={xs:24,sm:32,md:40,lg:56,xl:80},Dt={xs:"var(--lucent-font-size-xs)",sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-lg)",xl:"var(--lucent-font-size-xl)"};function Rt(t,r){var o,a,i;if(r)return r.slice(0,2).toUpperCase();const n=t.trim().split(/\s+/);return n.length===1?(((o=n[0])==null?void 0:o[0])??"").toUpperCase():((((a=n[0])==null?void 0:a[0])??"")+(((i=n[n.length-1])==null?void 0:i[0])??"")).toUpperCase()}function Bt({src:t,alt:r,size:n="md",initials:o,style:a,...i}){const s=qt[n],l=Rt(r,o),d={width:s,height:s,borderRadius:"var(--lucent-radius-full)",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",userSelect:"none",...a};return t?e.jsx("img",{src:t,alt:r,width:s,height:s,style:{...d,objectFit:"cover"},...i}):e.jsx("span",{role:"img","aria-label":r,style:{...d,background:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",fontSize:Dt[n],fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)"},children:l})}const Pt={id:"avatar",name:"Avatar",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A circular user image with initials fallback.",designIntent:"Always provide alt for accessibility — it is used to derive initials automatically when src is absent or fails. Use initials prop to override auto-derived initials (e.g. for non-Latin names). Size xs/sm suit table rows and compact lists; md is the default for comment threads; lg/xl for profile headers.",props:[{name:"src",type:"string",required:!1,description:"Image URL. Falls back to initials if omitted or fails to load."},{name:"alt",type:"string",required:!0,description:"Alt text and source for auto-derived initials."},{name:"size",type:"enum",required:!1,default:"md",description:"Diameter of the avatar.",enumValues:["xs","sm","md","lg","xl"]},{name:"initials",type:"string",required:!1,description:"Override auto-derived initials (max 2 characters)."}],usageExamples:[{title:"With image",code:'<Avatar src="/avatars/jane.jpg" alt="Jane Doe" />'},{title:"Initials fallback",code:'<Avatar alt="Jane Doe" />'},{title:"Large profile",code:'<Avatar src={user.avatar} alt={user.name} size="lg" />'},{title:"Custom initials",code:'<Avatar alt="张伟" initials="张" size="md" />'}],compositionGraph:[],accessibility:{role:"img",ariaAttributes:["aria-label"],notes:'When src is present, renders as <img> with alt. When showing initials, renders as <span role="img" aria-label>.'}},Lt={xs:12,sm:16,md:24,lg:36},Ft={xs:2.5,sm:2.5,md:2,lg:2};function rt({size:t="md",label:r="Loading…",color:n}){const o=Lt[t],a=Ft[t];return e.jsxs("span",{role:"status","aria-label":r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:[e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"lucent-spin 0.7s linear infinite",color:n??"currentColor"},children:[e.jsx("style",{children:"@keyframes lucent-spin { to { transform: rotate(360deg); } }"}),e.jsx("circle",{cx:12,cy:12,r:10,stroke:"currentColor",strokeWidth:a,strokeOpacity:.2}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round"})]}),e.jsx("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap"},children:r})]})}const Nt={id:"spinner",name:"Spinner",tier:"atom",domain:"neutral",specVersion:"0.1",description:"An animated loading indicator for async operations.",designIntent:"Use Spinner for indeterminate loading states of short duration (< 3s). For full-page or skeleton-level loading, prefer Skeleton instead. The label prop is visually hidden but read by screen readers — always set it to a meaningful description of what is loading.",props:[{name:"size",type:"enum",required:!1,default:"md",description:"Spinner diameter.",enumValues:["xs","sm","md","lg"]},{name:"label",type:"string",required:!1,default:"Loading…",description:"Visually hidden accessible label."},{name:"color",type:"string",required:!1,description:"Override colour (CSS value). Defaults to currentColor."}],usageExamples:[{title:"Default",code:"<Spinner />"},{title:"Inside button",code:'<Button loading><Spinner size="sm" label="Saving…" /></Button>'},{title:"Full-page overlay",code:`<div style={{ display: 'grid', placeItems: 'center', minHeight: '100vh' }}><Spinner size="lg" label="Loading dashboard…" /></div>`}],compositionGraph:[],accessibility:{role:"status",ariaAttributes:["aria-label"],notes:'The visible SVG is aria-hidden. The label is conveyed via a visually-hidden span inside role="status".'}};function $t({orientation:t="horizontal",label:r,spacing:n="0",style:o}){return t==="vertical"?e.jsx("span",{role:"separator","aria-orientation":"vertical",style:{display:"inline-block",width:"1px",alignSelf:"stretch",background:"var(--lucent-border-default)",margin:`0 ${n}`,flexShrink:0,...o}}):r?e.jsxs("div",{role:"separator","aria-label":r,style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",margin:`${n} 0`,...o},children:[e.jsx("span",{style:{flex:1,height:"1px",background:"var(--lucent-border-default)"}}),e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)",whiteSpace:"nowrap",letterSpacing:"var(--lucent-letter-spacing-wide)",textTransform:"uppercase"},children:r}),e.jsx("span",{style:{flex:1,height:"1px",background:"var(--lucent-border-default)"}})]}):e.jsx("hr",{role:"separator",style:{border:"none",borderTop:"1px solid var(--lucent-border-default)",margin:`${n} 0`,width:"100%",...o}})}const Wt={id:"divider",name:"Divider",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A visual separator between content sections, horizontal or vertical.",designIntent:'Use horizontal Divider to separate sections in a layout. Use vertical Divider inline between sibling elements (e.g. nav links, toolbar buttons). Use the label prop for "OR" separators in auth flows or form sections — never use a plain text node next to a divider for this.',props:[{name:"orientation",type:"enum",required:!1,default:"horizontal",description:"Direction of the divider line.",enumValues:["horizontal","vertical"]},{name:"label",type:"string",required:!1,description:'Optional centered label (horizontal only). Common use: "OR", "AND", section titles.'},{name:"spacing",type:"string",required:!1,default:"0",description:'Margin on the axis perpendicular to the line. Defaults to 0 so parent gap-based layouts (Stack, Row) control spacing. Pass an explicit value like "var(--lucent-space-4)" for standalone use outside flex/grid containers.'}],usageExamples:[{title:"Section separator",code:"<Divider />"},{title:"With label",code:'<Divider label="OR" />'},{title:"Vertical in nav",code:`<nav style={{ display: 'flex', alignItems: 'center' }}><a>Home</a><Divider orientation="vertical" /><a>About</a></nav>`}],compositionGraph:[],accessibility:{role:"separator",ariaAttributes:["aria-orientation","aria-label"]}},Ot={sm:14,md:16,lg:20},Vt={sm:"calc(var(--lucent-space-8) * 0.5 + 16px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px)"},Ht=`
6
6
  @keyframes lucent-cb-pop {
7
7
  0% { transform: scale(1); }
8
8
  35% { transform: scale(0.82); }
@@ -14,7 +14,7 @@
14
14
  60% { transform: scale(1.15) rotate(2deg); }
15
15
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
16
16
  }
17
- `,be=c.forwardRef(({label:t,size:r="md",indeterminate:n=!1,contained:o=!1,helperText:a,checked:i,defaultChecked:l,disabled:s,id:d,onChange:f,style:m,...p},k)=>{const x=c.useRef(null),g=d??`lucent-checkbox-${Math.random().toString(36).slice(2,7)}`,h=Ot[r],u=i!==void 0,[b,w]=c.useState(l??!1),y=u?!!i:b,S=c.useRef(y),[I,v]=c.useState(0);c.useEffect(()=>{!s&&S.current!==y&&(S.current=y,v(j=>j+1))},[y,s]);const A=c.useCallback(j=>{x.current=j,typeof k=="function"?k(j):k&&(k.current=j)},[k]);c.useEffect(()=>{x.current&&(x.current.indeterminate=n)},[n]);const T=j=>{u||w(j.target.checked),f==null||f(j)},z=s?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",F={width:h,height:h,borderRadius:"4px",border:`1.5px solid ${s?"transparent":y||n?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:s?"var(--lucent-surface-secondary)":y||n?"var(--lucent-accent-default)":"var(--lucent-surface)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",animation:I>0?"lucent-cb-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0},R=e.jsxs("label",{style:{display:"inline-flex",alignItems:a?"flex-start":"center",gap:"var(--lucent-space-2)",cursor:s?"not-allowed":"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:r==="sm"?"var(--lucent-font-size-sm)":"var(--lucent-font-size-md)",color:s?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",userSelect:"none",...o?{}:m},children:[e.jsx("input",{ref:A,type:"checkbox",id:g,checked:u?i:b,disabled:s,onChange:T,style:{position:"absolute",opacity:0,width:0,height:0,margin:0,pointerEvents:"none"},...p}),e.jsxs("span",{"aria-hidden":!0,style:F,children:[y&&!n&&e.jsx("svg",{width:h-4,height:h-4,viewBox:"0 0 10 10",fill:"none",style:{animation:"lucent-cb-mark 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards"},children:e.jsx("path",{d:"M1.5 5L4 7.5L8.5 2.5",stroke:z,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n&&e.jsx("svg",{width:h-4,height:h-4,viewBox:"0 0 10 10",fill:"none",style:{animation:"lucent-cb-mark 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards"},children:e.jsx("path",{d:"M2 5H8",stroke:z,strokeWidth:1.5,strokeLinecap:"round"})})]},I),(t||a)&&e.jsxs("span",{style:{display:"flex",flexDirection:"column"},children:[t&&e.jsx("span",{style:{fontWeight:a?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",lineHeight:a?1.4:1},children:t}),a&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:s?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Ht}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{}:{minHeight:Vt[r]},padding:a?"var(--lucent-space-3)":"0 var(--lucent-space-3)",display:"flex",alignItems:a?"flex-start":"center",background:y&&!s?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"transparent",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:s?"not-allowed":"pointer",...m},onClick:j=>{var P;s||j.target===j.currentTarget&&((P=x.current)==null||P.click())},children:R}):R]})});be.displayName="Checkbox";const Gt={id:"checkbox",name:"Checkbox",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A binary selection control for boolean values or multi-select lists.",designIntent:'Checkboxes represent independent boolean choices — they do not affect each other. Use a Checkbox for settings that take effect immediately (e.g. "Remember me") or for selecting multiple items from a list. When only one option may be active at a time, use Radio instead. The indeterminate state communicates a "select all" parent whose children are partially checked — never use it for a third logical state. Use the contained variant when you want to add visual emphasis to individual options — for example, plan selection cards, feature toggles, or consent checkboxes. Contained is especially useful when checkboxes are standalone or unrelated to each other, since the border gives each option its own visual weight. Pair with helperText to provide additional context without cluttering the label.',props:[{name:"checked",type:"boolean",required:!1,description:"Controlled checked state. Pair with onChange for controlled usage."},{name:"defaultChecked",type:"boolean",required:!1,default:"false",description:"Initial checked state for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called when the checked state changes."},{name:"label",type:"string",required:!1,description:"Visible label rendered beside the checkbox."},{name:"indeterminate",type:"boolean",required:!1,default:"false",description:"Displays a dash to indicate a partially-checked parent state."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and dims the control."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the checkbox box and label text.",enumValues:["sm","md","lg"]},{name:"contained",type:"boolean",required:!1,default:"false",description:"Wraps the checkbox in a bordered container. Use for standalone choices that need visual emphasis — plan cards, feature toggles, consent items. The border highlights with the accent colour when checked."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the label for additional context. The label becomes medium-weight for visual hierarchy."}],usageExamples:[{title:"Controlled",code:'<Checkbox checked={agreed} onChange={e => setAgreed(e.target.checked)} label="I agree to the terms" />'},{title:"Uncontrolled",code:'<Checkbox defaultChecked label="Send me updates" />'},{title:"Indeterminate",code:'<Checkbox indeterminate label="Select all" />'},{title:"Disabled",code:'<Checkbox disabled label="Unavailable option" />'},{title:"Contained with helper",code:'<Checkbox contained label="Pro plan" helperText="Unlimited projects, 100 GB storage" />'},{title:"Contained standalone",code:'<Checkbox contained label="I accept the terms and conditions" />'}],compositionGraph:[],accessibility:{role:"checkbox",ariaAttributes:["aria-checked","aria-disabled"],keyboardInteractions:["Space — toggles checked state"]}},Ut=`
17
+ `,be=c.forwardRef(({label:t,size:r="md",indeterminate:n=!1,contained:o=!1,helperText:a,checked:i,defaultChecked:s,disabled:l,id:d,onChange:p,style:m,...f},w)=>{const y=c.useRef(null),g=d??`lucent-checkbox-${Math.random().toString(36).slice(2,7)}`,h=Ot[r],u=i!==void 0,[b,x]=c.useState(s??!1),k=u?!!i:b,S=c.useRef(k),[C,v]=c.useState(0);c.useEffect(()=>{!l&&S.current!==k&&(S.current=k,v(j=>j+1))},[k,l]);const z=c.useCallback(j=>{y.current=j,typeof w=="function"?w(j):w&&(w.current=j)},[w]);c.useEffect(()=>{y.current&&(y.current.indeterminate=n)},[n]);const T=j=>{u||x(j.target.checked),p==null||p(j)},E=l?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",F={width:h,height:h,borderRadius:"4px",border:`1.5px solid ${l?"transparent":k||n?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:l?"var(--lucent-surface-secondary)":k||n?"var(--lucent-accent-default)":"var(--lucent-surface)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",animation:C>0?"lucent-cb-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0},R=e.jsxs("label",{style:{display:"inline-flex",alignItems:a?"flex-start":"center",gap:"var(--lucent-space-2)",cursor:l?"not-allowed":"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:r==="sm"?"var(--lucent-font-size-sm)":"var(--lucent-font-size-md)",color:l?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",userSelect:"none",...o?{}:m},children:[e.jsx("input",{ref:z,type:"checkbox",id:g,checked:u?i:b,disabled:l,onChange:T,style:{position:"absolute",opacity:0,width:0,height:0,margin:0,pointerEvents:"none"},...f}),e.jsxs("span",{"aria-hidden":!0,style:F,children:[k&&!n&&e.jsx("svg",{width:h-4,height:h-4,viewBox:"0 0 10 10",fill:"none",style:{animation:"lucent-cb-mark 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards"},children:e.jsx("path",{d:"M1.5 5L4 7.5L8.5 2.5",stroke:E,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n&&e.jsx("svg",{width:h-4,height:h-4,viewBox:"0 0 10 10",fill:"none",style:{animation:"lucent-cb-mark 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards"},children:e.jsx("path",{d:"M2 5H8",stroke:E,strokeWidth:1.5,strokeLinecap:"round"})})]},C),(t||a)&&e.jsxs("span",{style:{display:"flex",flexDirection:"column"},children:[t&&e.jsx("span",{style:{fontWeight:a?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",lineHeight:a?1.4:1},children:t}),a&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:l?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Ht}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{}:{minHeight:Vt[r]},padding:a?"var(--lucent-space-3)":"0 var(--lucent-space-3)",display:"flex",alignItems:a?"flex-start":"center",background:k&&!l?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"transparent",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:l?"not-allowed":"pointer",...m},onClick:j=>{var P;l||j.target===j.currentTarget&&((P=y.current)==null||P.click())},children:R}):R]})});be.displayName="Checkbox";const Gt={id:"checkbox",name:"Checkbox",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A binary selection control for boolean values or multi-select lists.",designIntent:'Checkboxes represent independent boolean choices — they do not affect each other. Use a Checkbox for settings that take effect immediately (e.g. "Remember me") or for selecting multiple items from a list. When only one option may be active at a time, use Radio instead. The indeterminate state communicates a "select all" parent whose children are partially checked — never use it for a third logical state. Use the contained variant when you want to add visual emphasis to individual options — for example, plan selection cards, feature toggles, or consent checkboxes. Contained is especially useful when checkboxes are standalone or unrelated to each other, since the border gives each option its own visual weight. Pair with helperText to provide additional context without cluttering the label.',props:[{name:"checked",type:"boolean",required:!1,description:"Controlled checked state. Pair with onChange for controlled usage."},{name:"defaultChecked",type:"boolean",required:!1,default:"false",description:"Initial checked state for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called when the checked state changes."},{name:"label",type:"string",required:!1,description:"Visible label rendered beside the checkbox."},{name:"indeterminate",type:"boolean",required:!1,default:"false",description:"Displays a dash to indicate a partially-checked parent state."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and dims the control."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the checkbox box and label text.",enumValues:["sm","md","lg"]},{name:"contained",type:"boolean",required:!1,default:"false",description:"Wraps the checkbox in a bordered container. Use for standalone choices that need visual emphasis — plan cards, feature toggles, consent items. The border highlights with the accent colour when checked."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the label for additional context. The label becomes medium-weight for visual hierarchy."}],usageExamples:[{title:"Controlled",code:'<Checkbox checked={agreed} onChange={e => setAgreed(e.target.checked)} label="I agree to the terms" />'},{title:"Uncontrolled",code:'<Checkbox defaultChecked label="Send me updates" />'},{title:"Indeterminate",code:'<Checkbox indeterminate label="Select all" />'},{title:"Disabled",code:'<Checkbox disabled label="Unavailable option" />'},{title:"Contained with helper",code:'<Checkbox contained label="Pro plan" helperText="Unlimited projects, 100 GB storage" />'},{title:"Contained standalone",code:'<Checkbox contained label="I accept the terms and conditions" />'}],compositionGraph:[],accessibility:{role:"checkbox",ariaAttributes:["aria-checked","aria-disabled"],keyboardInteractions:["Space — toggles checked state"]}},Ut=`
18
18
  @keyframes lucent-radio-pop {
19
19
  0% { transform: scale(1); }
20
20
  35% { transform: scale(0.82); }
@@ -26,7 +26,7 @@
26
26
  60% { transform: scale(1.2); }
27
27
  100% { opacity: 1; transform: scale(1); }
28
28
  }
29
- `,at=c.createContext(null);function ot({name:t,value:r,onChange:n,disabled:o,orientation:a="vertical",label:i,children:l}){return e.jsx(at.Provider,{value:{name:t,value:r,onChange:n,disabled:o??!1},children:e.jsx("div",{role:"radiogroup","aria-label":i,style:{display:"flex",flexDirection:a==="vertical"?"column":"row",gap:a==="vertical"?"var(--lucent-space-3)":"var(--lucent-space-4)",flexWrap:"wrap"},children:l})})}const _t={sm:14,md:16,lg:20},Yt={sm:"calc(var(--lucent-space-8) * 0.5 + 16px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px)"},Kt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"};function Xt({value:t,label:r,size:n="md",contained:o=!1,helperText:a,disabled:i,id:l,onChange:s,checked:d,style:f,...m}){const p=c.useContext(at),k=l??`lucent-radio-${Math.random().toString(36).slice(2,7)}`,x=_t[n],g=i??(p==null?void 0:p.disabled)??!1,h=p?p.value===t:!!d,u=c.useRef(h),[b,w]=c.useState(0);c.useEffect(()=>{!g&&u.current!==h&&(u.current=h,w(A=>A+1))},[h,g]);const y=A=>{p==null||p.onChange(t),s==null||s(A)},S={width:x/2,height:x/2,borderRadius:"50%",background:g?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",animation:h?"lucent-radio-dot 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0,opacity:h?1:0},I={width:x,height:x,borderRadius:"50%",border:`1.5px solid ${g?"transparent":h?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:g?"var(--lucent-surface-secondary)":h?"var(--lucent-accent-default)":"var(--lucent-surface)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",animation:b>0?"lucent-radio-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0},v=e.jsxs("label",{style:{display:"inline-flex",alignItems:a?"flex-start":"center",gap:"var(--lucent-space-2)",cursor:g?"not-allowed":"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:Kt[n],color:g?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",userSelect:"none",...o?{}:f},children:[e.jsx("input",{type:"radio",id:k,value:t,name:(p==null?void 0:p.name)??m.name,checked:h,disabled:g,onChange:y,style:{position:"absolute",opacity:0,width:0,height:0,margin:0,pointerEvents:"none"},...m}),e.jsx("span",{"aria-hidden":!0,style:I,children:e.jsx("span",{style:S})},b),r||a?e.jsxs("span",{style:{display:"flex",flexDirection:"column"},children:[r&&e.jsx("span",{style:{fontWeight:a?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",lineHeight:a?1.3:1},children:r}),a&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:g?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]}):null]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Ut}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{padding:"var(--lucent-space-3)"}:{minHeight:Yt[n],padding:"0 var(--lucent-space-3)",display:"flex",alignItems:"center"},background:h&&!g?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"transparent",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:g?"not-allowed":"pointer",...f},onClick:A=>{if(!g&&A.target===A.currentTarget){const T=A.currentTarget.querySelector("input");T==null||T.click()}},children:v}):v]})}function Jt({defaultValue:t="",onChange:r,...n}){const[o,a]=c.useState(t);return e.jsx(ot,{...n,value:o,onChange:i=>{a(i),r==null||r(i)}})}const Zt={id:"radio",name:"Radio",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A mutually exclusive selection control. Use RadioGroup to manage a set of options.",designIntent:"Radio buttons enforce a single selection from a small set of options (typically 2–6). Always wrap Radio in a RadioGroup so name and selection state are shared automatically. For larger option sets (7+) prefer a Select. For independent true/false choices, use a Checkbox. RadioGroup orientation should match how the options relate — vertical for distinct choices, horizontal for brief inline options (e.g. Yes / No).",props:[{name:"value",type:"string",required:!0,description:"The value submitted when this radio is selected."},{name:"label",type:"string",required:!1,description:"Visible label rendered beside the radio button."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction. Inherits group-level disabled when inside RadioGroup."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the radio button circle and label text.",enumValues:["sm","md","lg"]},{name:"contained",type:"boolean",required:!1,default:"false",description:"Wraps the radio in a bordered container. Highlights with accent border and subtle background when selected. Use for plan/option cards where each choice needs visual emphasis."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the label for additional context. Label becomes medium-weight for visual hierarchy."}],usageExamples:[{title:"Controlled RadioGroup",code:`
29
+ `,at=c.createContext(null);function ot({name:t,value:r,onChange:n,disabled:o,orientation:a="vertical",label:i,children:s}){return e.jsx(at.Provider,{value:{name:t,value:r,onChange:n,disabled:o??!1},children:e.jsx("div",{role:"radiogroup","aria-label":i,style:{display:"flex",flexDirection:a==="vertical"?"column":"row",gap:a==="vertical"?"var(--lucent-space-3)":"var(--lucent-space-4)",flexWrap:"wrap"},children:s})})}const _t={sm:14,md:16,lg:20},Yt={sm:"calc(var(--lucent-space-8) * 0.5 + 16px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px)"},Kt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"};function Xt({value:t,label:r,size:n="md",contained:o=!1,helperText:a,disabled:i,id:s,onChange:l,checked:d,style:p,...m}){const f=c.useContext(at),w=s??`lucent-radio-${Math.random().toString(36).slice(2,7)}`,y=_t[n],g=i??(f==null?void 0:f.disabled)??!1,h=f?f.value===t:!!d,u=c.useRef(h),[b,x]=c.useState(0);c.useEffect(()=>{!g&&u.current!==h&&(u.current=h,x(z=>z+1))},[h,g]);const k=z=>{f==null||f.onChange(t),l==null||l(z)},S={width:y/2,height:y/2,borderRadius:"50%",background:g?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",animation:h?"lucent-radio-dot 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0,opacity:h?1:0},C={width:y,height:y,borderRadius:"50%",border:`1.5px solid ${g?"transparent":h?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:g?"var(--lucent-surface-secondary)":h?"var(--lucent-accent-default)":"var(--lucent-surface)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",animation:b>0?"lucent-radio-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards":void 0},v=e.jsxs("label",{style:{display:"inline-flex",alignItems:a?"flex-start":"center",gap:"var(--lucent-space-2)",cursor:g?"not-allowed":"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:Kt[n],color:g?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",userSelect:"none",...o?{}:p},children:[e.jsx("input",{type:"radio",id:w,value:t,name:(f==null?void 0:f.name)??m.name,checked:h,disabled:g,onChange:k,style:{position:"absolute",opacity:0,width:0,height:0,margin:0,pointerEvents:"none"},...m}),e.jsx("span",{"aria-hidden":!0,style:C,children:e.jsx("span",{style:S})},b),r||a?e.jsxs("span",{style:{display:"flex",flexDirection:"column"},children:[r&&e.jsx("span",{style:{fontWeight:a?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",lineHeight:a?1.3:1},children:r}),a&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",color:g?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]}):null]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Ut}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{padding:"var(--lucent-space-3)"}:{minHeight:Yt[n],padding:"0 var(--lucent-space-3)",display:"flex",alignItems:"center"},background:h&&!g?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"transparent",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:g?"not-allowed":"pointer",...p},onClick:z=>{if(!g&&z.target===z.currentTarget){const T=z.currentTarget.querySelector("input");T==null||T.click()}},children:v}):v]})}function Jt({defaultValue:t="",onChange:r,...n}){const[o,a]=c.useState(t);return e.jsx(ot,{...n,value:o,onChange:i=>{a(i),r==null||r(i)}})}const Zt={id:"radio",name:"Radio",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A mutually exclusive selection control. Use RadioGroup to manage a set of options.",designIntent:"Radio buttons enforce a single selection from a small set of options (typically 2–6). Always wrap Radio in a RadioGroup so name and selection state are shared automatically. For larger option sets (7+) prefer a Select. For independent true/false choices, use a Checkbox. RadioGroup orientation should match how the options relate — vertical for distinct choices, horizontal for brief inline options (e.g. Yes / No).",props:[{name:"value",type:"string",required:!0,description:"The value submitted when this radio is selected."},{name:"label",type:"string",required:!1,description:"Visible label rendered beside the radio button."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction. Inherits group-level disabled when inside RadioGroup."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the radio button circle and label text.",enumValues:["sm","md","lg"]},{name:"contained",type:"boolean",required:!1,default:"false",description:"Wraps the radio in a bordered container. Highlights with accent border and subtle background when selected. Use for plan/option cards where each choice needs visual emphasis."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the label for additional context. Label becomes medium-weight for visual hierarchy."}],usageExamples:[{title:"Controlled RadioGroup",code:`
30
30
  <RadioGroup name="plan" value={plan} onChange={setPlan}>
31
31
  <Radio value="free" label="Free" />
32
32
  <Radio value="pro" label="Pro" />
@@ -53,9 +53,9 @@
53
53
  options={countries}
54
54
  value={country}
55
55
  onChange={e => setCountry(e.target.value)}
56
- />`.trim()},{title:"With validation error",code:'<Select label="Role" options={roles} errorText="Please select a role" />'},{title:"With helper text",code:'<Select label="Timezone" options={timezones} helperText="Used for scheduling notifications" />'}],compositionGraph:[],accessibility:{role:"combobox",ariaAttributes:["aria-invalid","aria-describedby"],keyboardInteractions:["Enter / Space — opens the option list","Arrow keys — navigate options","Escape — closes the list"]}},tn={neutral:{bg:"var(--lucent-surface-secondary)",color:"var(--lucent-text-secondary)",border:"var(--lucent-border-default)",dismissHover:"var(--lucent-border-strong)"},accent:{bg:"var(--lucent-accent-subtle)",color:"var(--lucent-accent-default)",border:"var(--lucent-accent-subtle)",dismissHover:"var(--lucent-accent-default)"},success:{bg:"var(--lucent-success-subtle)",color:"var(--lucent-success-text)",border:"var(--lucent-success-subtle)",dismissHover:"var(--lucent-success-default)"},warning:{bg:"var(--lucent-warning-subtle)",color:"var(--lucent-warning-text)",border:"var(--lucent-warning-subtle)",dismissHover:"var(--lucent-warning-default)"},danger:{bg:"var(--lucent-danger-subtle)",color:"var(--lucent-danger-text)",border:"var(--lucent-danger-subtle)",dismissHover:"var(--lucent-danger-default)"},info:{bg:"var(--lucent-info-subtle)",color:"var(--lucent-info-text)",border:"var(--lucent-info-subtle)",dismissHover:"var(--lucent-info-default)"}},nn={sm:{fontSize:"var(--lucent-font-size-xs)",height:"20px",padding:"0 var(--lucent-space-3)",iconSize:10,gap:"var(--lucent-space-1)"},md:{fontSize:"var(--lucent-font-size-sm)",height:"24px",padding:"0 var(--lucent-space-3)",iconSize:12,gap:"var(--lucent-space-1)"},lg:{fontSize:"var(--lucent-font-size-md)",height:"28px",padding:"0 var(--lucent-space-4)",iconSize:14,gap:"var(--lucent-space-2)"}};function rn({children:t,variant:r="neutral",size:n="md",onDismiss:o,disabled:a}){const i=tn[r],l=nn[n],[s,d]=c.useState(!1),f=!a&&o;return e.jsxs("span",{onMouseEnter:()=>{a||d(!0)},onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:l.gap,height:l.height,padding:o?`0 var(--lucent-space-2) 0 ${l.padding.split(" ")[1]}`:l.padding,fontSize:l.fontSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,borderRadius:"var(--lucent-radius-lg)",background:i.bg,color:i.color,border:`1px solid ${s&&!a?i.dismissHover:i.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:a?.5:1,transform:s&&f?"translateY(-1px)":"none",boxShadow:s&&f?`0 2px 4px ${i.dismissHover}22`:"none",transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:f?"pointer":"default"},children:[t,o&&e.jsx("button",{type:"button",onClick:a?void 0:m=>{m.stopPropagation(),o==null||o()},disabled:a,"aria-label":"Dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:l.iconSize+4,height:l.iconSize+4,padding:0,border:"none",borderRadius:"var(--lucent-radius-lg)",background:"transparent",color:"inherit",cursor:a?"not-allowed":"pointer",flexShrink:0,lineHeight:1},onMouseEnter:m=>{a||(m.currentTarget.style.background=i.dismissHover+"33")},onMouseLeave:m=>{m.currentTarget.style.background="transparent"},children:e.jsx("svg",{width:l.iconSize,height:l.iconSize,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",children:e.jsx("path",{d:"M2 2L8 8M8 2L2 8"})})})]})}const an={id:"tag",name:"Tag",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A dismissible label for applied filters, selected values, or categorisation.",designIntent:"Tags represent user-applied selections that can be removed — filters, multi-select values, categories. They differ from Badge in that they are interactive: provide onDismiss when the user should be able to remove the tag. Without onDismiss they render as a static pill (identical to Badge in purpose). Use semantic variants to match meaning; default to neutral for user-generated content where no semantic applies.",props:[{name:"children",type:"ReactNode",required:!0,description:"Tag label content."},{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","accent","success","warning","danger","info"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size.",enumValues:["sm","md","lg"]},{name:"onDismiss",type:"function",required:!1,description:"When provided, renders an × button that calls this handler on click."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Dims the tag and prevents the dismiss action."}],usageExamples:[{title:"Dismissible filter",code:"<Tag onDismiss={() => removeFilter('react')}>React</Tag>"},{title:"Multi-select value",code:'<Tag variant="accent" onDismiss={() => deselect(id)}>Jane Doe</Tag>'},{title:"Static category",code:'<Tag variant="info">Beta</Tag>'},{title:"Danger (removable)",code:'<Tag variant="danger" onDismiss={handleRemove}>Blocked</Tag>'}],compositionGraph:[],accessibility:{role:"group",notes:'The dismiss button has aria-label="Dismiss" and is keyboard-focusable.',keyboardInteractions:["Enter / Space — activates the dismiss button when focused"]}},_=5,on={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:_+3},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:_+3},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:_+3},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:_+3}},sn={top:{bottom:-_,left:"50%",transform:"translateX(-50%)",borderWidth:`${_}px ${_}px 0 ${_}px`,borderColor:"var(--lucent-text-primary) transparent transparent transparent"},bottom:{top:-_,left:"50%",transform:"translateX(-50%)",borderWidth:`0 ${_}px ${_}px ${_}px`,borderColor:"transparent transparent var(--lucent-text-primary) transparent"},left:{right:-_,top:"50%",transform:"translateY(-50%)",borderWidth:`${_}px 0 ${_}px ${_}px`,borderColor:"transparent transparent transparent var(--lucent-text-primary)"},right:{left:-_,top:"50%",transform:"translateY(-50%)",borderWidth:`${_}px ${_}px ${_}px 0`,borderColor:"transparent var(--lucent-text-primary) transparent transparent"}};function ln({content:t,children:r,placement:n="top",delay:o=300}){const[a,i]=c.useState(!1),l=c.useRef(null),s=()=>{l.current=setTimeout(()=>i(!0),o)},d=()=>{l.current&&clearTimeout(l.current),i(!1)};return t?e.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:s,onMouseLeave:d,onFocus:s,onBlur:d,children:[r,a&&e.jsxs("span",{role:"tooltip",style:{position:"absolute",...on[n],background:"var(--lucent-text-primary)",color:"var(--lucent-bg-base)",padding:"5px 10px",borderRadius:"var(--lucent-radius-md)",fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:"var(--lucent-line-height-base)",whiteSpace:"nowrap",zIndex:9999,pointerEvents:"none",boxShadow:"var(--lucent-shadow-md)"},children:[t,e.jsx("span",{"aria-hidden":!0,style:{position:"absolute",width:0,height:0,borderStyle:"solid",...sn[n]}})]})]}):e.jsx(e.Fragment,{children:r})}const cn={id:"tooltip",name:"Tooltip",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A transient label that appears on hover or focus to explain an element.",designIntent:'Tooltips surface supplementary context that would clutter the UI if shown permanently — keyboard shortcut hints, icon button labels, truncated text expansions. They must never contain critical information (errors, required actions) because they are invisible until hovered. Keep content to one short phrase; avoid wrapping. Use placement to avoid viewport edges — "top" is the default and works in most cases.',props:[{name:"content",type:"ReactNode",required:!0,description:"Text or element shown inside the tooltip. Keep it short (under 80 chars)."},{name:"children",type:"ReactNode",required:!0,description:"The element that triggers the tooltip on hover/focus."},{name:"placement",type:"enum",required:!1,default:"top",description:"Position of the tooltip relative to the trigger.",enumValues:["top","bottom","left","right"]},{name:"delay",type:"number",required:!1,default:"300",description:"Milliseconds before the tooltip appears. Prevents flicker on fast cursor movement."}],usageExamples:[{title:"Icon button label",code:'<Tooltip content="Copy to clipboard"><IconButton icon={<CopyIcon />} /></Tooltip>'},{title:"Keyboard shortcut hint",code:'<Tooltip content="⌘K"><Button variant="ghost">Search</Button></Tooltip>'},{title:"Bottom placement",code:'<Tooltip content="Opens in a new tab" placement="bottom"><a href="…">Link</a></Tooltip>'},{title:"No delay (instant)",code:'<Tooltip content="Delete" delay={0}><Button variant="ghost">🗑</Button></Tooltip>'}],compositionGraph:[],accessibility:{role:"tooltip",ariaAttributes:['role="tooltip"'],notes:'The tooltip is shown on both hover and focus, making it accessible to keyboard users. Content is exposed via role="tooltip".'}},dn={xs:12,sm:14,md:16,lg:20,xl:24};function un({children:t,size:r="md",label:n,color:o,style:a}){const i=dn[r];return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:i,height:i,flexShrink:0,color:o??"currentColor",...a},children:t})}const pn={id:"icon",name:"Icon",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A sized, accessible wrapper for any SVG or icon-set component.",designIntent:"Icon is intentionally icon-set agnostic — pass any SVG or third-party icon as children and it handles sizing and accessibility automatically. Use label for standalone icons that convey meaning without adjacent text (e.g. a close button). Omit label for decorative icons next to text, where the text already provides context. colour inherits from the parent by default via currentColor — override only when the icon must differ from its surrounding text.",props:[{name:"children",type:"ReactNode",required:!0,description:"The icon to render — any SVG element or icon-set component."},{name:"size",type:"enum",required:!1,default:"md",description:"Constrains the icon to a fixed square (xs=12, sm=14, md=16, lg=20, xl=24).",enumValues:["xs","sm","md","lg","xl"]},{name:"label",type:"string",required:!1,description:"Accessible label (aria-label). Provide for meaningful standalone icons; omit for decorative ones."},{name:"color",type:"string",required:!1,description:"CSS colour value. Defaults to currentColor (inherits from parent)."}],usageExamples:[{title:"Decorative (next to text)",code:'<Icon size="md"><SearchIcon /></Icon>'},{title:"Meaningful (standalone)",code:'<Icon size="lg" label="Close dialog"><XIcon /></Icon>'},{title:"Coloured",code:'<Icon color="var(--lucent-danger-default)"><AlertIcon /></Icon>'},{title:"Inside a button",code:'<Button leftIcon={<Icon size="sm"><PlusIcon /></Icon>}>Add item</Button>'}],compositionGraph:[],accessibility:{role:"img",ariaAttributes:["aria-label","aria-hidden"],notes:'aria-hidden="true" is applied automatically when no label is given, hiding the icon from screen readers.'}},fn={id:"text",name:"Text",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Polymorphic typography primitive that maps semantic HTML elements to design-system type scales.",designIntent:"Text is the single source of truth for typography in Lucent UI. Rather than hard-coding font sizes and colors directly in components, every piece of rendered text should pass through this atom. The `as` prop controls the HTML element (and therefore semantic meaning), while `size`, `weight`, `color`, and `lineHeight` control appearance independently — decoupling semantics from style. Use `truncate` only in constrained-width containers where overflow must be prevented; it applies overflow: hidden + text-overflow: ellipsis. The `family` prop enables inline code or monospaced content without switching components.",props:[{name:"as",type:"enum",required:!1,default:"p",description:"HTML element to render. Controls semantic meaning independently of visual style.",enumValues:["p","h1","h2","h3","h4","h5","h6","span","div","label","strong","em","code"]},{name:"size",type:"enum",required:!1,default:"md",description:"Font size from the type scale. Maps to the corresponding --lucent-font-size-* token.",enumValues:["xs","sm","md","lg","xl","2xl","3xl"]},{name:"weight",type:"enum",required:!1,default:"regular",description:"Font weight. Maps to --lucent-font-weight-* tokens.",enumValues:["regular","medium","semibold","bold"]},{name:"color",type:"enum",required:!1,default:"primary",description:"Semantic text color. All values adapt automatically in light and dark themes.",enumValues:["primary","secondary","disabled","inverse","onAccent","success","warning","danger","info"]},{name:"align",type:"enum",required:!1,default:"left",description:"Text alignment.",enumValues:["left","center","right"]},{name:"lineHeight",type:"enum",required:!1,default:"base",description:"Line height. tight=1.25, base=1.5, relaxed=1.75.",enumValues:["tight","base","relaxed"]},{name:"family",type:"enum",required:!1,default:"base",description:"Font family. Use mono for code or tabular data. Use display (Unbounded) for headings and marketing copy.",enumValues:["base","mono","display"]},{name:"truncate",type:"boolean",required:!1,default:"false",description:"Clips overflow text with an ellipsis. Requires the container to have a constrained width."},{name:"children",type:"ReactNode",required:!0,description:"The text content to render."},{name:"style",type:"object",required:!1,description:'Inline style overrides. Applied after computed token styles, so any property you set here wins. This is the official escape hatch for one-off styling outside the token system — e.g. a custom color via style={{ color: "var(--my-green)" }}. See docs/style-escape-hatch.md.'}],usageExamples:[{title:"Heading",code:'<Text as="h1" size="3xl" weight="bold">Page title</Text>'},{title:"Body paragraph",code:'<Text size="md" color="secondary">Supporting copy goes here.</Text>'},{title:"Label",code:'<Text as="label" size="sm" weight="medium" htmlFor="email">Email</Text>'},{title:"Inline code",code:'<Text as="code" family="mono" size="sm">const x = 1;</Text>'},{title:"Truncated",code:"<Text truncate style={{ maxWidth: 200 }}>Very long text that will be clipped</Text>"},{title:"Status color",code:'<Text color="danger" size="xs">This field is required</Text>'},{title:"Custom color via style escape hatch",code:"<Text style={{ color: 'var(--chart-series-a)' }}>Revenue</Text>"}],compositionGraph:[],accessibility:{notes:'The rendered element determines the implicit ARIA role. Use heading elements (h1–h6) for document headings so screen readers can navigate the page structure. Use `as="label"` with `htmlFor` to associate labels with form controls. Decorative text needs no additional ARIA.'}};function hn({children:t,href:r,isActive:n=!1,icon:o,disabled:a=!1,inverse:i=!1,onClick:l,as:s,style:d}){const f=s??"a";return e.jsxs(f,{href:a?void 0:r,onClick:a?void 0:l,"aria-current":n?"page":void 0,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",padding:"var(--lucent-space-2) var(--lucent-space-3) var(--lucent-space-2) var(--lucent-space-4)",borderRadius:"var(--lucent-radius-md)",background:a?"transparent":n?i?"var(--lucent-surface)":"var(--lucent-accent-default)":"transparent",color:a?"var(--lucent-text-disabled)":n?i?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",border:n&&i?"1px solid var(--lucent-border-default)":"1px solid transparent",borderRight:n&&i?"3px solid var(--lucent-accent-default)":"3px solid transparent",boxShadow:n&&i?"var(--lucent-shadow-md)":"none",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",fontWeight:n?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textDecoration:"none",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",...d},onMouseEnter:m=>{!a&&!n&&(m.currentTarget.style.background="var(--lucent-surface-secondary)")},onMouseLeave:m=>{!a&&!n&&(m.currentTarget.style.background="transparent")},children:[o!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,color:"inherit"},children:o}),t]})}const mn={id:"slider",name:"Slider",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A range input styled with Lucent tokens for selecting a numeric value within a bounded range.",designIntent:'Use Slider for continuous or stepped numeric inputs where the relative position matters — volume, brightness, border radius, spacing scale. Pair with showValue when the exact number is meaningful to the user. For precise numeric entry, use Input with type="number" instead. Disabled state uses muted colours without opacity hacks.',props:[{name:"min",type:"number",required:!1,default:"0",description:"Minimum value."},{name:"max",type:"number",required:!1,default:"100",description:"Maximum value."},{name:"step",type:"number",required:!1,default:"1",description:"Increment step between values."},{name:"value",type:"number",required:!1,description:"Controlled current value. Pair with onChange."},{name:"defaultValue",type:"number",required:!1,description:"Initial value for uncontrolled usage. Defaults to the midpoint of min/max."},{name:"onChange",type:"function",required:!1,description:"Called on every value change."},{name:"label",type:"string",required:!1,description:"Visible label rendered above the track."},{name:"showValue",type:"boolean",required:!1,default:"false",description:"Displays the current numeric value to the right of the label."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls track thickness and thumb diameter.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and dims the control."}],usageExamples:[{title:"Basic",code:'<Slider label="Volume" showValue />'},{title:"Controlled",code:'<Slider label="Opacity" min={0} max={1} step={0.01} value={opacity} onChange={e => setOpacity(Number(e.target.value))} showValue />'},{title:"Sizes",code:`<Slider size="sm" label="Small" />
56
+ />`.trim()},{title:"With validation error",code:'<Select label="Role" options={roles} errorText="Please select a role" />'},{title:"With helper text",code:'<Select label="Timezone" options={timezones} helperText="Used for scheduling notifications" />'}],compositionGraph:[],accessibility:{role:"combobox",ariaAttributes:["aria-invalid","aria-describedby"],keyboardInteractions:["Enter / Space — opens the option list","Arrow keys — navigate options","Escape — closes the list"]}},tn={neutral:{bg:"var(--lucent-surface-secondary)",color:"var(--lucent-text-secondary)",border:"var(--lucent-border-default)",dismissHover:"var(--lucent-border-strong)"},accent:{bg:"var(--lucent-accent-subtle)",color:"var(--lucent-accent-default)",border:"var(--lucent-accent-subtle)",dismissHover:"var(--lucent-accent-default)"},success:{bg:"var(--lucent-success-subtle)",color:"var(--lucent-success-text)",border:"var(--lucent-success-subtle)",dismissHover:"var(--lucent-success-default)"},warning:{bg:"var(--lucent-warning-subtle)",color:"var(--lucent-warning-text)",border:"var(--lucent-warning-subtle)",dismissHover:"var(--lucent-warning-default)"},danger:{bg:"var(--lucent-danger-subtle)",color:"var(--lucent-danger-text)",border:"var(--lucent-danger-subtle)",dismissHover:"var(--lucent-danger-default)"},info:{bg:"var(--lucent-info-subtle)",color:"var(--lucent-info-text)",border:"var(--lucent-info-subtle)",dismissHover:"var(--lucent-info-default)"}},nn={sm:{fontSize:"var(--lucent-font-size-xs)",height:"20px",padding:"0 var(--lucent-space-3)",iconSize:10,gap:"var(--lucent-space-1)"},md:{fontSize:"var(--lucent-font-size-sm)",height:"24px",padding:"0 var(--lucent-space-3)",iconSize:12,gap:"var(--lucent-space-1)"},lg:{fontSize:"var(--lucent-font-size-md)",height:"28px",padding:"0 var(--lucent-space-4)",iconSize:14,gap:"var(--lucent-space-2)"}};function rn({children:t,variant:r="neutral",size:n="md",onDismiss:o,disabled:a}){const i=tn[r],s=nn[n],[l,d]=c.useState(!1),p=!a&&o;return e.jsxs("span",{onMouseEnter:()=>{a||d(!0)},onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:s.gap,height:s.height,padding:o?`0 var(--lucent-space-2) 0 ${s.padding.split(" ")[1]}`:s.padding,fontSize:s.fontSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,borderRadius:"var(--lucent-radius-lg)",background:i.bg,color:i.color,border:`1px solid ${l&&!a?i.dismissHover:i.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:a?.5:1,transform:l&&p?"translateY(-1px)":"none",boxShadow:l&&p?`0 2px 4px ${i.dismissHover}22`:"none",transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default)",cursor:p?"pointer":"default"},children:[t,o&&e.jsx("button",{type:"button",onClick:a?void 0:m=>{m.stopPropagation(),o==null||o()},disabled:a,"aria-label":"Dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:s.iconSize+4,height:s.iconSize+4,padding:0,border:"none",borderRadius:"var(--lucent-radius-lg)",background:"transparent",color:"inherit",cursor:a?"not-allowed":"pointer",flexShrink:0,lineHeight:1},onMouseEnter:m=>{a||(m.currentTarget.style.background=i.dismissHover+"33")},onMouseLeave:m=>{m.currentTarget.style.background="transparent"},children:e.jsx("svg",{width:s.iconSize,height:s.iconSize,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",children:e.jsx("path",{d:"M2 2L8 8M8 2L2 8"})})})]})}const an={id:"tag",name:"Tag",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A dismissible label for applied filters, selected values, or categorisation.",designIntent:"Tags represent user-applied selections that can be removed — filters, multi-select values, categories. They differ from Badge in that they are interactive: provide onDismiss when the user should be able to remove the tag. Without onDismiss they render as a static pill (identical to Badge in purpose). Use semantic variants to match meaning; default to neutral for user-generated content where no semantic applies.",props:[{name:"children",type:"ReactNode",required:!0,description:"Tag label content."},{name:"variant",type:"enum",required:!1,default:"neutral",description:"Colour scheme conveying semantic meaning.",enumValues:["neutral","accent","success","warning","danger","info"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size.",enumValues:["sm","md","lg"]},{name:"onDismiss",type:"function",required:!1,description:"When provided, renders an × button that calls this handler on click."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Dims the tag and prevents the dismiss action."}],usageExamples:[{title:"Dismissible filter",code:"<Tag onDismiss={() => removeFilter('react')}>React</Tag>"},{title:"Multi-select value",code:'<Tag variant="accent" onDismiss={() => deselect(id)}>Jane Doe</Tag>'},{title:"Static category",code:'<Tag variant="info">Beta</Tag>'},{title:"Danger (removable)",code:'<Tag variant="danger" onDismiss={handleRemove}>Blocked</Tag>'}],compositionGraph:[],accessibility:{role:"group",notes:'The dismiss button has aria-label="Dismiss" and is keyboard-focusable.',keyboardInteractions:["Enter / Space — activates the dismiss button when focused"]}},_=5,on={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:_+3},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:_+3},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:_+3},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:_+3}},sn={top:{bottom:-_,left:"50%",transform:"translateX(-50%)",borderWidth:`${_}px ${_}px 0 ${_}px`,borderColor:"var(--lucent-text-primary) transparent transparent transparent"},bottom:{top:-_,left:"50%",transform:"translateX(-50%)",borderWidth:`0 ${_}px ${_}px ${_}px`,borderColor:"transparent transparent var(--lucent-text-primary) transparent"},left:{right:-_,top:"50%",transform:"translateY(-50%)",borderWidth:`${_}px 0 ${_}px ${_}px`,borderColor:"transparent transparent transparent var(--lucent-text-primary)"},right:{left:-_,top:"50%",transform:"translateY(-50%)",borderWidth:`${_}px ${_}px ${_}px 0`,borderColor:"transparent var(--lucent-text-primary) transparent transparent"}};function ln({content:t,children:r,placement:n="top",delay:o=300}){const[a,i]=c.useState(!1),s=c.useRef(null),l=()=>{s.current=setTimeout(()=>i(!0),o)},d=()=>{s.current&&clearTimeout(s.current),i(!1)};return t?e.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:l,onMouseLeave:d,onFocus:l,onBlur:d,children:[r,a&&e.jsxs("span",{role:"tooltip",style:{position:"absolute",...on[n],background:"var(--lucent-text-primary)",color:"var(--lucent-bg-base)",padding:"5px 10px",borderRadius:"var(--lucent-radius-md)",fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:"var(--lucent-line-height-base)",whiteSpace:"nowrap",zIndex:9999,pointerEvents:"none",boxShadow:"var(--lucent-shadow-md)"},children:[t,e.jsx("span",{"aria-hidden":!0,style:{position:"absolute",width:0,height:0,borderStyle:"solid",...sn[n]}})]})]}):e.jsx(e.Fragment,{children:r})}const cn={id:"tooltip",name:"Tooltip",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A transient label that appears on hover or focus to explain an element.",designIntent:'Tooltips surface supplementary context that would clutter the UI if shown permanently — keyboard shortcut hints, icon button labels, truncated text expansions. They must never contain critical information (errors, required actions) because they are invisible until hovered. Keep content to one short phrase; avoid wrapping. Use placement to avoid viewport edges — "top" is the default and works in most cases.',props:[{name:"content",type:"ReactNode",required:!0,description:"Text or element shown inside the tooltip. Keep it short (under 80 chars)."},{name:"children",type:"ReactNode",required:!0,description:"The element that triggers the tooltip on hover/focus."},{name:"placement",type:"enum",required:!1,default:"top",description:"Position of the tooltip relative to the trigger.",enumValues:["top","bottom","left","right"]},{name:"delay",type:"number",required:!1,default:"300",description:"Milliseconds before the tooltip appears. Prevents flicker on fast cursor movement."}],usageExamples:[{title:"Icon button label",code:'<Tooltip content="Copy to clipboard"><IconButton icon={<CopyIcon />} /></Tooltip>'},{title:"Keyboard shortcut hint",code:'<Tooltip content="⌘K"><Button variant="ghost">Search</Button></Tooltip>'},{title:"Bottom placement",code:'<Tooltip content="Opens in a new tab" placement="bottom"><a href="…">Link</a></Tooltip>'},{title:"No delay (instant)",code:'<Tooltip content="Delete" delay={0}><Button variant="ghost">🗑</Button></Tooltip>'}],compositionGraph:[],accessibility:{role:"tooltip",ariaAttributes:['role="tooltip"'],notes:'The tooltip is shown on both hover and focus, making it accessible to keyboard users. Content is exposed via role="tooltip".'}},dn={xs:12,sm:14,md:16,lg:20,xl:24};function un({children:t,size:r="md",label:n,color:o,style:a}){const i=dn[r];return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:i,height:i,flexShrink:0,color:o??"currentColor",...a},children:t})}const pn={id:"icon",name:"Icon",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A sized, accessible wrapper for any SVG or icon-set component.",designIntent:"Icon is intentionally icon-set agnostic — pass any SVG or third-party icon as children and it handles sizing and accessibility automatically. Use label for standalone icons that convey meaning without adjacent text (e.g. a close button). Omit label for decorative icons next to text, where the text already provides context. colour inherits from the parent by default via currentColor — override only when the icon must differ from its surrounding text.",props:[{name:"children",type:"ReactNode",required:!0,description:"The icon to render — any SVG element or icon-set component."},{name:"size",type:"enum",required:!1,default:"md",description:"Constrains the icon to a fixed square (xs=12, sm=14, md=16, lg=20, xl=24).",enumValues:["xs","sm","md","lg","xl"]},{name:"label",type:"string",required:!1,description:"Accessible label (aria-label). Provide for meaningful standalone icons; omit for decorative ones."},{name:"color",type:"string",required:!1,description:"CSS colour value. Defaults to currentColor (inherits from parent)."}],usageExamples:[{title:"Decorative (next to text)",code:'<Icon size="md"><SearchIcon /></Icon>'},{title:"Meaningful (standalone)",code:'<Icon size="lg" label="Close dialog"><XIcon /></Icon>'},{title:"Coloured",code:'<Icon color="var(--lucent-danger-default)"><AlertIcon /></Icon>'},{title:"Inside a button",code:'<Button leftIcon={<Icon size="sm"><PlusIcon /></Icon>}>Add item</Button>'}],compositionGraph:[],accessibility:{role:"img",ariaAttributes:["aria-label","aria-hidden"],notes:'aria-hidden="true" is applied automatically when no label is given, hiding the icon from screen readers.'}},fn={id:"text",name:"Text",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Polymorphic typography primitive that maps semantic HTML elements to design-system type scales.",designIntent:"Text is the single source of truth for typography in Lucent UI. Rather than hard-coding font sizes and colors directly in components, every piece of rendered text should pass through this atom. The `as` prop controls the HTML element (and therefore semantic meaning), while `size`, `weight`, `color`, and `lineHeight` control appearance independently — decoupling semantics from style. Use `truncate` only in constrained-width containers where overflow must be prevented; it applies overflow: hidden + text-overflow: ellipsis. The `family` prop enables inline code or monospaced content without switching components.",props:[{name:"as",type:"enum",required:!1,default:"p",description:"HTML element to render. Controls semantic meaning independently of visual style.",enumValues:["p","h1","h2","h3","h4","h5","h6","span","div","label","strong","em","code"]},{name:"size",type:"enum",required:!1,default:"md",description:"Font size from the type scale. Maps to the corresponding --lucent-font-size-* token.",enumValues:["xs","sm","md","lg","xl","2xl","3xl"]},{name:"weight",type:"enum",required:!1,default:"regular",description:"Font weight. Maps to --lucent-font-weight-* tokens.",enumValues:["regular","medium","semibold","bold"]},{name:"color",type:"enum",required:!1,default:"primary",description:"Semantic text color. All values adapt automatically in light and dark themes.",enumValues:["primary","secondary","disabled","inverse","onAccent","success","warning","danger","info"]},{name:"align",type:"enum",required:!1,default:"left",description:"Text alignment.",enumValues:["left","center","right"]},{name:"lineHeight",type:"enum",required:!1,default:"base",description:"Line height. tight=1.25, base=1.5, relaxed=1.75.",enumValues:["tight","base","relaxed"]},{name:"family",type:"enum",required:!1,default:"base",description:"Font family. Use mono for code or tabular data. Use display (Unbounded) for headings and marketing copy.",enumValues:["base","mono","display"]},{name:"truncate",type:"boolean",required:!1,default:"false",description:"Clips overflow text with an ellipsis. Requires the container to have a constrained width."},{name:"children",type:"ReactNode",required:!0,description:"The text content to render."},{name:"style",type:"object",required:!1,description:'Inline style overrides. Applied after computed token styles, so any property you set here wins. This is the official escape hatch for one-off styling outside the token system — e.g. a custom color via style={{ color: "var(--my-green)" }}. See docs/style-escape-hatch.md.'}],usageExamples:[{title:"Heading",code:'<Text as="h1" size="3xl" weight="bold">Page title</Text>'},{title:"Body paragraph",code:'<Text size="md" color="secondary">Supporting copy goes here.</Text>'},{title:"Label",code:'<Text as="label" size="sm" weight="medium" htmlFor="email">Email</Text>'},{title:"Inline code",code:'<Text as="code" family="mono" size="sm">const x = 1;</Text>'},{title:"Truncated",code:"<Text truncate style={{ maxWidth: 200 }}>Very long text that will be clipped</Text>"},{title:"Status color",code:'<Text color="danger" size="xs">This field is required</Text>'},{title:"Custom color via style escape hatch",code:"<Text style={{ color: 'var(--chart-series-a)' }}>Revenue</Text>"}],compositionGraph:[],accessibility:{notes:'The rendered element determines the implicit ARIA role. Use heading elements (h1–h6) for document headings so screen readers can navigate the page structure. Use `as="label"` with `htmlFor` to associate labels with form controls. Decorative text needs no additional ARIA.'}};function hn({children:t,href:r,isActive:n=!1,icon:o,disabled:a=!1,inverse:i=!1,onClick:s,as:l,style:d}){const p=l??"a";return e.jsxs(p,{href:a?void 0:r,onClick:a?void 0:s,"aria-current":n?"page":void 0,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",padding:"var(--lucent-space-2) var(--lucent-space-3) var(--lucent-space-2) var(--lucent-space-4)",borderRadius:"var(--lucent-radius-md)",background:a?"transparent":n?i?"var(--lucent-surface)":"var(--lucent-accent-default)":"transparent",color:a?"var(--lucent-text-disabled)":n?i?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",border:n&&i?"1px solid var(--lucent-border-default)":"1px solid transparent",borderRight:n&&i?"3px solid var(--lucent-accent-default)":"3px solid transparent",boxShadow:n&&i?"var(--lucent-shadow-md)":"none",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",fontWeight:n?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textDecoration:"none",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",...d},onMouseEnter:m=>{!a&&!n&&(m.currentTarget.style.background="var(--lucent-surface-secondary)")},onMouseLeave:m=>{!a&&!n&&(m.currentTarget.style.background="transparent")},children:[o!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,color:"inherit"},children:o}),t]})}const mn={id:"slider",name:"Slider",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A range input styled with Lucent tokens for selecting a numeric value within a bounded range.",designIntent:'Use Slider for continuous or stepped numeric inputs where the relative position matters — volume, brightness, border radius, spacing scale. Pair with showValue when the exact number is meaningful to the user. For precise numeric entry, use Input with type="number" instead. Disabled state uses muted colours without opacity hacks.',props:[{name:"min",type:"number",required:!1,default:"0",description:"Minimum value."},{name:"max",type:"number",required:!1,default:"100",description:"Maximum value."},{name:"step",type:"number",required:!1,default:"1",description:"Increment step between values."},{name:"value",type:"number",required:!1,description:"Controlled current value. Pair with onChange."},{name:"defaultValue",type:"number",required:!1,description:"Initial value for uncontrolled usage. Defaults to the midpoint of min/max."},{name:"onChange",type:"function",required:!1,description:"Called on every value change."},{name:"label",type:"string",required:!1,description:"Visible label rendered above the track."},{name:"showValue",type:"boolean",required:!1,default:"false",description:"Displays the current numeric value to the right of the label."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls track thickness and thumb diameter.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Prevents interaction and dims the control."}],usageExamples:[{title:"Basic",code:'<Slider label="Volume" showValue />'},{title:"Controlled",code:'<Slider label="Opacity" min={0} max={1} step={0.01} value={opacity} onChange={e => setOpacity(Number(e.target.value))} showValue />'},{title:"Sizes",code:`<Slider size="sm" label="Small" />
57
57
  <Slider size="md" label="Medium" />
58
- <Slider size="lg" label="Large" />`},{title:"Disabled",code:'<Slider label="Locked" disabled defaultValue={40} />'}],compositionGraph:[],accessibility:{role:"slider",ariaAttributes:["aria-valuemin","aria-valuemax","aria-valuenow","aria-disabled"],keyboardInteractions:["ArrowRight / ArrowUp — increase value by step","ArrowLeft / ArrowDown — decrease value by step","Home — jump to min","End — jump to max"]}},gn=2e3;function vn(){return e.jsxs("svg",{width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}function bn(){return e.jsx("svg",{width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}function yn({code:t,language:r,tabs:n,variant:o="code",helperText:a,showCopyButton:i=!0,style:l}){var b,w;const s=!!(n!=null&&n.length),[d,f]=c.useState(0),[m,p]=c.useState(!1),k=s?((b=n[d])==null?void 0:b.code)??"":t??"",x=s?(w=n[d])==null?void 0:w.language:r,g=async()=>{try{await navigator.clipboard.writeText(k),p(!0),setTimeout(()=>p(!1),gn)}catch{}},h={display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",padding:"3px var(--lucent-space-2)",border:"1px solid transparent",borderRadius:"var(--lucent-radius-md)",background:"transparent",color:m?"var(--lucent-success-default)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer",flexShrink:0,transition:"color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)"},u=()=>e.jsxs("button",{onClick:g,"aria-label":m?"Copied!":"Copy code",style:h,onMouseEnter:y=>{m||(y.currentTarget.style.background="var(--lucent-surface-secondary)",y.currentTarget.style.color="var(--lucent-text-primary)")},onMouseLeave:y=>{m||(y.currentTarget.style.background="transparent",y.currentTarget.style.color="var(--lucent-text-secondary)")},children:[m?e.jsx(bn,{}):e.jsx(vn,{}),m?"Copied!":"Copy"]});return e.jsxs("div",{style:{borderRadius:"var(--lucent-radius-lg)",border:"1px solid var(--lucent-border-default)",overflow:"hidden",...l},children:[s&&e.jsx("div",{style:{display:"flex",alignItems:"flex-end",background:"var(--lucent-surface)",borderBottom:"1px solid var(--lucent-border-default)",padding:"0 var(--lucent-space-2)"},children:n.map((y,S)=>{const I=S===d;return e.jsxs("button",{onClick:()=>{f(S),p(!1)},style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",padding:"var(--lucent-space-2) var(--lucent-space-3)",border:"none",borderBottom:I?"2px solid var(--lucent-accent-default)":"2px solid transparent",marginBottom:-1,background:"transparent",color:I?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)",fontWeight:I?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",cursor:"pointer",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)",whiteSpace:"nowrap"},onMouseEnter:v=>{I||(v.currentTarget.style.color="var(--lucent-text-primary)")},onMouseLeave:v=>{I||(v.currentTarget.style.color="var(--lucent-text-secondary)")},children:[y.icon!==void 0&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center"},children:y.icon}),y.label]},y.label)})}),!s&&(!!x||i)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:x?"space-between":"flex-end",padding:"0 var(--lucent-space-3)",height:36,background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",borderBottom:"1px solid var(--lucent-border-default)"},children:[x&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-mono)",color:"var(--lucent-text-secondary)",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:x}),i&&e.jsx(u,{})]}),a&&e.jsx("div",{style:{padding:"var(--lucent-space-2) var(--lucent-space-4)",fontSize:"var(--lucent-font-size-xs)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",borderBottom:"1px solid var(--lucent-border-default)"},children:a}),o==="code"?e.jsxs("div",{style:{position:"relative"},children:[e.jsx("pre",{style:{margin:0,padding:"var(--lucent-space-4)",paddingRight:s&&i?"var(--lucent-space-16)":"var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",overflowX:"auto",lineHeight:1.65},children:e.jsx("code",{style:{fontFamily:"var(--lucent-font-family-mono)",fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-primary)"},children:k})}),s&&i&&e.jsx("div",{style:{position:"absolute",top:"var(--lucent-space-2)",right:"var(--lucent-space-3)"},children:e.jsx(u,{})})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:"var(--lucent-font-family-mono)",fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-primary)"},children:k}),i&&e.jsx(u,{})]})]})}const xn={id:"code-block",name:"CodeBlock",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A styled code display with optional tabs, a language label, copy-to-clipboard, and an AI prompt variant.",designIntent:"Use CodeBlock for static code snippets, install commands, API examples, and AI prompt sharing. The tabs prop switches between related snippets (e.g. pnpm / npm / yarn). The prompt variant renders a single-line truncated display suited to AI tool prompts — the full text is always copied even when visually clipped. Zero-dependency — no syntax highlighting library is bundled.",props:[{name:"code",type:"string",required:!1,description:"Code string — used in single (non-tabbed) mode."},{name:"language",type:"string",required:!1,description:"Language label shown in the header (non-tabbed mode only). Purely cosmetic."},{name:"tabs",type:"array",required:!1,description:"Tabbed mode. Each entry has { label, code, language?, icon? }. Switching tabs resets the copied state."},{name:"variant",type:"enum",required:!1,default:"code",enumValues:["code","prompt"],description:'"code" renders a <pre><code> block with horizontal scroll. "prompt" renders a single-line truncated span suited to AI prompts.'},{name:"helperText",type:"string",required:!1,description:"Descriptive text rendered between the tab bar and the code area."},{name:"showCopyButton",type:"boolean",required:!1,default:"true",description:'Renders a copy-to-clipboard button. Shows a "Copied!" confirmation for 2 s on success.'}],usageExamples:[{title:"Single snippet",code:'<CodeBlock language="tsx" code={`<Button variant="primary">Save</Button>`} />'},{title:"Tabbed install commands",code:`<CodeBlock tabs={[
58
+ <Slider size="lg" label="Large" />`},{title:"Disabled",code:'<Slider label="Locked" disabled defaultValue={40} />'}],compositionGraph:[],accessibility:{role:"slider",ariaAttributes:["aria-valuemin","aria-valuemax","aria-valuenow","aria-disabled"],keyboardInteractions:["ArrowRight / ArrowUp — increase value by step","ArrowLeft / ArrowDown — decrease value by step","Home — jump to min","End — jump to max"]}},gn=2e3;function vn(){return e.jsxs("svg",{width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}function bn(){return e.jsx("svg",{width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}function yn({code:t,language:r,tabs:n,variant:o="code",wrap:a,minimal:i,helperText:s,showCopyButton:l=!0,style:d}){var k,S;const p=!!(n!=null&&n.length),[m,f]=c.useState(0),[w,y]=c.useState(!1),g=p?((k=n[m])==null?void 0:k.code)??"":t??"",h=p?(S=n[m])==null?void 0:S.language:r,u=async()=>{try{await navigator.clipboard.writeText(g),y(!0),setTimeout(()=>y(!1),gn)}catch{}},b={display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",padding:"3px var(--lucent-space-2)",border:"1px solid transparent",borderRadius:"var(--lucent-radius-md)",background:"transparent",color:w?"var(--lucent-success-default)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer",flexShrink:0,transition:"color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)"},x=()=>e.jsxs("button",{onClick:u,"aria-label":w?"Copied!":"Copy code",style:b,onMouseEnter:C=>{w||(C.currentTarget.style.background="var(--lucent-surface-secondary)",C.currentTarget.style.color="var(--lucent-text-primary)")},onMouseLeave:C=>{w||(C.currentTarget.style.background="transparent",C.currentTarget.style.color="var(--lucent-text-secondary)")},children:[w?e.jsx(bn,{}):e.jsx(vn,{}),w?"Copied!":"Copy"]});return e.jsxs("div",{style:{borderRadius:"var(--lucent-radius-lg)",border:"1px solid var(--lucent-border-default)",overflow:"hidden",...d},children:[p&&e.jsx("div",{style:{display:"flex",alignItems:"flex-end",background:"var(--lucent-surface)",borderBottom:"1px solid var(--lucent-border-default)",padding:"0 var(--lucent-space-2)"},children:n.map((C,v)=>{const z=v===m;return e.jsxs("button",{onClick:()=>{f(v),y(!1)},style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",padding:"var(--lucent-space-2) var(--lucent-space-3)",border:"none",borderBottom:z?"2px solid var(--lucent-accent-default)":"2px solid transparent",marginBottom:-1,background:"transparent",color:z?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)",fontWeight:z?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",cursor:"pointer",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)",whiteSpace:"nowrap"},onMouseEnter:T=>{z||(T.currentTarget.style.color="var(--lucent-text-primary)")},onMouseLeave:T=>{z||(T.currentTarget.style.color="var(--lucent-text-secondary)")},children:[C.icon!==void 0&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center"},children:C.icon}),C.label]},C.label)})}),!i&&!p&&(!!h||l)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:h?"space-between":"flex-end",padding:"0 var(--lucent-space-3)",height:36,background:"var(--lucent-surface)",borderBottom:"1px solid var(--lucent-border-default)"},children:[h&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-xs)",fontFamily:"var(--lucent-font-family-mono)",color:"var(--lucent-text-secondary)",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:h}),l&&e.jsx(x,{})]}),s&&e.jsx("div",{style:{padding:"var(--lucent-space-2) var(--lucent-space-4)",fontSize:"var(--lucent-font-size-xs)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",borderBottom:"1px solid var(--lucent-border-default)"},children:s}),o==="code"?e.jsxs("div",{style:{position:"relative"},children:[e.jsx("pre",{style:{margin:0,padding:"var(--lucent-space-4)",paddingRight:(p||i)&&l?"var(--lucent-space-16)":"var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",overflowX:a?"hidden":"auto",lineHeight:1.65,...a&&{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:e.jsx("code",{style:{fontFamily:"var(--lucent-font-family-mono)",fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-primary)"},children:g})}),(p||i)&&l&&e.jsx("div",{style:{position:"absolute",top:i?0:"var(--lucent-space-2)",bottom:i?0:void 0,right:"var(--lucent-space-3)",display:"flex",alignItems:"center"},children:e.jsx(x,{})})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",...a?{whiteSpace:"pre-wrap",wordBreak:"break-word"}:{whiteSpace:"nowrap",textOverflow:"ellipsis"},fontFamily:"var(--lucent-font-family-mono)",fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-primary)"},children:g}),l&&e.jsx(x,{})]})]})}const xn={id:"code-block",name:"CodeBlock",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A styled code display with optional tabs, a language label, copy-to-clipboard, and an AI prompt variant.",designIntent:"Use CodeBlock for static code snippets, install commands, API examples, and AI prompt sharing. The tabs prop switches between related snippets (e.g. pnpm / npm / yarn). The prompt variant renders a single-line truncated display suited to AI tool prompts — the full text is always copied even when visually clipped. Zero-dependency — no syntax highlighting library is bundled.",props:[{name:"code",type:"string",required:!1,description:"Code string — used in single (non-tabbed) mode."},{name:"language",type:"string",required:!1,description:"Language label shown in the header (non-tabbed mode only). Purely cosmetic."},{name:"tabs",type:"array",required:!1,description:"Tabbed mode. Each entry has { label, code, language?, icon? }. Switching tabs resets the copied state."},{name:"variant",type:"enum",required:!1,default:"code",enumValues:["code","prompt"],description:'"code" renders a <pre><code> block with horizontal scroll. "prompt" renders a single-line truncated span suited to AI prompts.'},{name:"minimal",type:"boolean",required:!1,default:"false",description:"Hides the header bar and shows only a corner copy button overlay."},{name:"wrap",type:"boolean",required:!1,default:"false",description:"When true, wraps long lines instead of scrolling horizontally."},{name:"helperText",type:"string",required:!1,description:"Descriptive text rendered between the tab bar and the code area."},{name:"showCopyButton",type:"boolean",required:!1,default:"true",description:'Renders a copy-to-clipboard button. Shows a "Copied!" confirmation for 2 s on success.'}],usageExamples:[{title:"Single snippet",code:'<CodeBlock language="tsx" code={`<Button variant="primary">Save</Button>`} />'},{title:"Tabbed install commands",code:`<CodeBlock tabs={[
59
59
  { label: 'pnpm', code: 'pnpm add lucent-ui', language: 'bash' },
60
60
  { label: 'npm', code: 'npm install lucent-ui', language: 'bash' },
61
61
  ]} />`},{title:"AI prompt",code:`<CodeBlock
@@ -118,7 +118,7 @@
118
118
  ]}
119
119
  />`},{title:"Full-width, sizes",code:`<SegmentedControl fullWidth size="sm" defaultValue="a" options={[{ value: 'a', label: 'Alpha' }, { value: 'b', label: 'Beta' }]} />
120
120
  <SegmentedControl fullWidth size="md" defaultValue="a" options={[{ value: 'a', label: 'Alpha' }, { value: 'b', label: 'Beta' }]} />
121
- <SegmentedControl fullWidth size="lg" defaultValue="a" options={[{ value: 'a', label: 'Alpha' }, { value: 'b', label: 'Beta' }]} />`}],compositionGraph:[],accessibility:{role:"group (radiogroup)",ariaAttributes:["aria-checked",'role="radio"',"disabled"],keyboardInteractions:["Tab — focuses the group","Click — selects an option"]}},An={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},qn={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around"};function Dn({gap:t="4",align:r="stretch",justify:n="start",as:o="div",wrap:a=!1,children:i,style:l,...s}){const d={display:"flex",flexDirection:"column",gap:`var(--lucent-space-${t})`,alignItems:An[r],justifyContent:qn[n],...a&&{flexWrap:"wrap"},...l},f=o;return e.jsx(f,{style:d,...s,children:i})}const Rn={id:"stack",name:"Stack",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Vertical flex layout primitive that spaces children using design-system gap tokens.",designIntent:"Stack is the primary vertical layout container. Use it any time you need to arrange elements in a column with consistent spacing — form fields, card content, page sections, sidebar navigation. The gap prop maps to spacing tokens (--lucent-space-*), enforcing consistent vertical rhythm without manual margin management. Prefer Stack over raw inline flex styles for maintainability and readability. Use Row (the horizontal counterpart) when items should flow left-to-right. Stack does not add padding — wrap it in a Card or apply padding on a parent container instead.",props:[{name:"gap",type:"enum",required:!1,default:"4",description:"Spacing between children. Maps to --lucent-space-{n} tokens.",enumValues:["0","1","2","3","4","5","6","8","10","12","16","20","24"]},{name:"align",type:"enum",required:!1,default:"stretch",description:'Cross-axis alignment (alignItems). "stretch" fills the container width.',enumValues:["start","center","end","stretch","baseline"]},{name:"justify",type:"enum",required:!1,default:"start",description:"Main-axis distribution (justifyContent).",enumValues:["start","center","end","between","around"]},{name:"as",type:"enum",required:!1,default:"div",description:"HTML element to render. Use semantic elements when appropriate (nav for navigation, form for forms).",enumValues:["div","section","nav","form","fieldset","ul","ol"]},{name:"wrap",type:"boolean",required:!1,default:"false",description:"Whether children should wrap to the next line when they exceed the container width."},{name:"children",type:"ReactNode",required:!0,description:"The elements to arrange vertically."},{name:"style",type:"object",required:!1,description:"Inline style overrides. Applied after computed layout styles."},{name:"className",type:"string",required:!1,description:"CSS class name passthrough."}],usageExamples:[{title:"Form layout",code:`<Stack gap="4">
121
+ <SegmentedControl fullWidth size="lg" defaultValue="a" options={[{ value: 'a', label: 'Alpha' }, { value: 'b', label: 'Beta' }]} />`}],compositionGraph:[],accessibility:{role:"group (radiogroup)",ariaAttributes:["aria-checked",'role="radio"',"disabled"],keyboardInteractions:["Tab — focuses the group","Click — selects an option"]}},An={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},qn={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around"};function Dn({gap:t="4",align:r="stretch",justify:n="start",as:o="div",wrap:a=!1,children:i,style:s,...l}){const d={display:"flex",flexDirection:"column",gap:`var(--lucent-space-${t})`,alignItems:An[r],justifyContent:qn[n],...a&&{flexWrap:"wrap"},...s},p=o;return e.jsx(p,{style:d,...l,children:i})}const Rn={id:"stack",name:"Stack",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Vertical flex layout primitive that spaces children using design-system gap tokens.",designIntent:"Stack is the primary vertical layout container. Use it any time you need to arrange elements in a column with consistent spacing — form fields, card content, page sections, sidebar navigation. The gap prop maps to spacing tokens (--lucent-space-*), enforcing consistent vertical rhythm without manual margin management. Prefer Stack over raw inline flex styles for maintainability and readability. Use Row (the horizontal counterpart) when items should flow left-to-right. Stack does not add padding — wrap it in a Card or apply padding on a parent container instead.",props:[{name:"gap",type:"enum",required:!1,default:"4",description:"Spacing between children. Maps to --lucent-space-{n} tokens.",enumValues:["0","1","2","3","4","5","6","8","10","12","16","20","24"]},{name:"align",type:"enum",required:!1,default:"stretch",description:'Cross-axis alignment (alignItems). "stretch" fills the container width.',enumValues:["start","center","end","stretch","baseline"]},{name:"justify",type:"enum",required:!1,default:"start",description:"Main-axis distribution (justifyContent).",enumValues:["start","center","end","between","around"]},{name:"as",type:"enum",required:!1,default:"div",description:"HTML element to render. Use semantic elements when appropriate (nav for navigation, form for forms).",enumValues:["div","section","nav","form","fieldset","ul","ol"]},{name:"wrap",type:"boolean",required:!1,default:"false",description:"Whether children should wrap to the next line when they exceed the container width."},{name:"children",type:"ReactNode",required:!0,description:"The elements to arrange vertically."},{name:"style",type:"object",required:!1,description:"Inline style overrides. Applied after computed layout styles."},{name:"className",type:"string",required:!1,description:"CSS class name passthrough."}],usageExamples:[{title:"Form layout",code:`<Stack gap="4">
122
122
  <FormField label="Name"><Input /></FormField>
123
123
  <FormField label="Email"><Input type="email" /></FormField>
124
124
  <Button variant="primary">Submit</Button>
@@ -137,7 +137,7 @@
137
137
  </Stack>`},{title:"Semantic nav",code:`<Stack as="nav" gap="1">
138
138
  <NavLink href="/home">Home</NavLink>
139
139
  <NavLink href="/settings">Settings</NavLink>
140
- </Stack>`}],compositionGraph:[],accessibility:{notes:"Stack renders a <div> by default, which has no implicit ARIA role. Use the `as` prop to render semantic elements (nav, section, form) when the content has a specific structural purpose. Add aria-label or aria-labelledby when using landmark elements."}},Bn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},Pn={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around"};function Ln({gap:t="3",align:r="center",justify:n="start",as:o="div",wrap:a=!1,children:i,style:l,...s}){const d={display:"flex",flexDirection:"row",gap:`var(--lucent-space-${t})`,alignItems:Bn[r],justifyContent:Pn[n],...a&&{flexWrap:"wrap"},...l},f=o;return e.jsx(f,{style:d,...s,children:i})}const Fn={id:"row",name:"Row",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Horizontal flex layout primitive that spaces children using design-system gap tokens.",designIntent:'Row is the primary horizontal layout container. Use it any time you need to arrange elements side by side — button groups, label-value pairs, icon + text combos, toolbar actions. Default align is "center" (vertical centering), which is the most common horizontal layout need. Use justify="between" for space-between patterns like a header with title on the left and actions on the right. Set wrap=true when items should flow to the next line on narrow screens. Row does not add padding — wrap it in a Card or apply padding on a parent container instead. For vertical arrangement, use Stack instead.',props:[{name:"gap",type:"enum",required:!1,default:"3",description:"Spacing between children. Maps to --lucent-space-{n} tokens.",enumValues:["0","1","2","3","4","5","6","8","10","12","16","20","24"]},{name:"align",type:"enum",required:!1,default:"center",description:'Cross-axis alignment (alignItems). "center" vertically centers items, which is the most common need.',enumValues:["start","center","end","stretch","baseline"]},{name:"justify",type:"enum",required:!1,default:"start",description:'Main-axis distribution (justifyContent). Use "between" for label/action pairs.',enumValues:["start","center","end","between","around"]},{name:"as",type:"enum",required:!1,default:"div",description:"HTML element to render. Use semantic elements when appropriate (nav for navigation, form for forms).",enumValues:["div","section","nav","form","fieldset","ul","ol"]},{name:"wrap",type:"boolean",required:!1,default:"false",description:"Whether children should wrap to the next line when they exceed the container width."},{name:"children",type:"ReactNode",required:!0,description:"The elements to arrange horizontally."},{name:"style",type:"object",required:!1,description:"Inline style overrides. Applied after computed layout styles."},{name:"className",type:"string",required:!1,description:"CSS class name passthrough."}],usageExamples:[{title:"Settings toggle",code:`<Row gap="3" justify="between">
140
+ </Stack>`}],compositionGraph:[],accessibility:{notes:"Stack renders a <div> by default, which has no implicit ARIA role. Use the `as` prop to render semantic elements (nav, section, form) when the content has a specific structural purpose. Add aria-label or aria-labelledby when using landmark elements."}},Bn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},Pn={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around"};function Ln({gap:t="3",align:r="center",justify:n="start",as:o="div",wrap:a=!1,children:i,style:s,...l}){const d={display:"flex",flexDirection:"row",gap:`var(--lucent-space-${t})`,alignItems:Bn[r],justifyContent:Pn[n],...a&&{flexWrap:"wrap"},...s},p=o;return e.jsx(p,{style:d,...l,children:i})}const Fn={id:"row",name:"Row",tier:"atom",domain:"neutral",specVersion:"0.1",description:"Horizontal flex layout primitive that spaces children using design-system gap tokens.",designIntent:'Row is the primary horizontal layout container. Use it any time you need to arrange elements side by side — button groups, label-value pairs, icon + text combos, toolbar actions. Default align is "center" (vertical centering), which is the most common horizontal layout need. Use justify="between" for space-between patterns like a header with title on the left and actions on the right. Set wrap=true when items should flow to the next line on narrow screens. Row does not add padding — wrap it in a Card or apply padding on a parent container instead. For vertical arrangement, use Stack instead.',props:[{name:"gap",type:"enum",required:!1,default:"3",description:"Spacing between children. Maps to --lucent-space-{n} tokens.",enumValues:["0","1","2","3","4","5","6","8","10","12","16","20","24"]},{name:"align",type:"enum",required:!1,default:"center",description:'Cross-axis alignment (alignItems). "center" vertically centers items, which is the most common need.',enumValues:["start","center","end","stretch","baseline"]},{name:"justify",type:"enum",required:!1,default:"start",description:'Main-axis distribution (justifyContent). Use "between" for label/action pairs.',enumValues:["start","center","end","between","around"]},{name:"as",type:"enum",required:!1,default:"div",description:"HTML element to render. Use semantic elements when appropriate (nav for navigation, form for forms).",enumValues:["div","section","nav","form","fieldset","ul","ol"]},{name:"wrap",type:"boolean",required:!1,default:"false",description:"Whether children should wrap to the next line when they exceed the container width."},{name:"children",type:"ReactNode",required:!0,description:"The elements to arrange horizontally."},{name:"style",type:"object",required:!1,description:"Inline style overrides. Applied after computed layout styles."},{name:"className",type:"string",required:!1,description:"CSS class name passthrough."}],usageExamples:[{title:"Settings toggle",code:`<Row gap="3" justify="between">
141
141
  <Text size="sm">Push notifications</Text>
142
142
  <Toggle />
143
143
  </Row>`},{title:"Button group",code:`<Row gap="2">
@@ -161,7 +161,7 @@
161
161
  <Button variant="outline" size="sm">Export</Button>
162
162
  <Button variant="primary" size="sm">New report</Button>
163
163
  </Row>
164
- </Row>`}],compositionGraph:[],accessibility:{notes:'Row renders a <div> by default, which has no implicit ARIA role. Use the `as` prop to render semantic elements (nav, section) when the content has a specific structural purpose. For toolbar patterns, consider adding role="toolbar" via the role prop.'}},Nn={sm:{height:4,radius:"var(--lucent-radius-sm)"},md:{height:8,radius:"var(--lucent-radius-md)"},lg:{height:12,radius:"var(--lucent-radius-md)"}},$n={accent:"var(--lucent-accent-default)",success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)"};function Wn(t,r,n,o,a){return o!==void 0&&a!==void 0?o<=a?t>=a?"danger":t>=o?"warning":"success":t<=a?"danger":t<=o?"warning":"success":o!==void 0?o<=r/2?t<=o?"warning":n??"accent":t>=o?"warning":n??"accent":a!==void 0?a<=r/2?t<=a?"danger":n??"accent":t>=a?"danger":n??"accent":n??"accent"}function On({value:t,max:r=100,variant:n,size:o="md",warnAt:a,dangerAt:i,label:l,style:s}){const d=Math.max(0,Math.min(t,r)),f=r>0?d/r*100:0,m=Wn(d,r,n,a,i),p=Nn[o],k=$n[m],x=l===!0?`${Math.round(f)}%`:l||null;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",fontFamily:"var(--lucent-font-family-base)",...s},children:[e.jsx("div",{role:"progressbar","aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":r,style:{flex:1,height:p.height,borderRadius:p.radius,background:"color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",overflow:"hidden"},children:e.jsx("div",{style:{width:`${f}%`,height:"100%",borderRadius:p.radius,background:k,transition:"width var(--lucent-duration-base) var(--lucent-easing-default), background var(--lucent-duration-base) var(--lucent-easing-default)"}})}),x!=null&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-sm)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",whiteSpace:"nowrap",flexShrink:0},children:x})]})}const Vn={id:"progress",name:"Progress",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A horizontal bar indicating completion, progress, or resource usage.",designIntent:'Use Progress to visualise a bounded numeric value — task completion, disk usage, health bars, etc. Set warnAt/dangerAt thresholds for automatic colour shifts instead of hardcoding variants. Ascending thresholds (warnAt < dangerAt) suit "high is bad" metrics like CPU; descending thresholds (warnAt > dangerAt) suit "low is bad" metrics like battery.',props:[{name:"value",type:"number",required:!0,description:"Current progress value."},{name:"max",type:"number",required:!1,default:"100",description:"Maximum value."},{name:"variant",type:"enum",required:!1,default:"accent",description:"Colour variant. Overridden when thresholds are set.",enumValues:["accent","success","warning","danger"]},{name:"size",type:"enum",required:!1,default:"md",description:"Bar height.",enumValues:["sm","md","lg"]},{name:"warnAt",type:"number",required:!1,description:"Value at which variant auto-switches to warning."},{name:"dangerAt",type:"number",required:!1,description:"Value at which variant auto-switches to danger."},{name:"label",type:"union",required:!1,description:"true shows percentage; ReactNode shows custom label."}],usageExamples:[{title:"Basic",code:"<Progress value={60} />"},{title:"With label",code:"<Progress value={42} label />"},{title:"Thresholds",code:"<Progress value={85} warnAt={70} dangerAt={90} label />"},{title:"Danger variant",code:'<Progress value={95} variant="danger" size="lg" label />'}],compositionGraph:[],accessibility:{role:"progressbar",ariaAttributes:["aria-valuenow","aria-valuemin","aria-valuemax"],notes:"Uses native progressbar role. Add aria-label on the wrapping element for screen-reader context."}},we=120,Hn=`
164
+ </Row>`}],compositionGraph:[],accessibility:{notes:'Row renders a <div> by default, which has no implicit ARIA role. Use the `as` prop to render semantic elements (nav, section) when the content has a specific structural purpose. For toolbar patterns, consider adding role="toolbar" via the role prop.'}},Nn={sm:{height:4,radius:"var(--lucent-radius-sm)"},md:{height:8,radius:"var(--lucent-radius-md)"},lg:{height:12,radius:"var(--lucent-radius-md)"}},$n={accent:"var(--lucent-accent-default)",success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)"};function Wn(t,r,n,o,a){return o!==void 0&&a!==void 0?o<=a?t>=a?"danger":t>=o?"warning":"success":t<=a?"danger":t<=o?"warning":"success":o!==void 0?o<=r/2?t<=o?"warning":n??"accent":t>=o?"warning":n??"accent":a!==void 0?a<=r/2?t<=a?"danger":n??"accent":t>=a?"danger":n??"accent":n??"accent"}function On({value:t,max:r=100,variant:n,size:o="md",warnAt:a,dangerAt:i,label:s,style:l}){const d=Math.max(0,Math.min(t,r)),p=r>0?d/r*100:0,m=Wn(d,r,n,a,i),f=Nn[o],w=$n[m],y=s===!0?`${Math.round(p)}%`:s||null;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",fontFamily:"var(--lucent-font-family-base)",...l},children:[e.jsx("div",{role:"progressbar","aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":r,style:{flex:1,height:f.height,borderRadius:f.radius,background:"color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",overflow:"hidden"},children:e.jsx("div",{style:{width:`${p}%`,height:"100%",borderRadius:f.radius,background:w,transition:"width var(--lucent-duration-base) var(--lucent-easing-default), background var(--lucent-duration-base) var(--lucent-easing-default)"}})}),y!=null&&e.jsx("span",{style:{fontSize:"var(--lucent-font-size-sm)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",whiteSpace:"nowrap",flexShrink:0},children:y})]})}const Vn={id:"progress",name:"Progress",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A horizontal bar indicating completion, progress, or resource usage.",designIntent:'Use Progress to visualise a bounded numeric value — task completion, disk usage, health bars, etc. Set warnAt/dangerAt thresholds for automatic colour shifts instead of hardcoding variants. Ascending thresholds (warnAt < dangerAt) suit "high is bad" metrics like CPU; descending thresholds (warnAt > dangerAt) suit "low is bad" metrics like battery.',props:[{name:"value",type:"number",required:!0,description:"Current progress value."},{name:"max",type:"number",required:!1,default:"100",description:"Maximum value."},{name:"variant",type:"enum",required:!1,default:"accent",description:"Colour variant. Overridden when thresholds are set.",enumValues:["accent","success","warning","danger"]},{name:"size",type:"enum",required:!1,default:"md",description:"Bar height.",enumValues:["sm","md","lg"]},{name:"warnAt",type:"number",required:!1,description:"Value at which variant auto-switches to warning."},{name:"dangerAt",type:"number",required:!1,description:"Value at which variant auto-switches to danger."},{name:"label",type:"union",required:!1,description:"true shows percentage; ReactNode shows custom label."}],usageExamples:[{title:"Basic",code:"<Progress value={60} />"},{title:"With label",code:"<Progress value={42} label />"},{title:"Thresholds",code:"<Progress value={85} warnAt={70} dangerAt={90} label />"},{title:"Danger variant",code:'<Progress value={95} variant="danger" size="lg" label />'}],compositionGraph:[],accessibility:{role:"progressbar",ariaAttributes:["aria-valuenow","aria-valuemin","aria-valuemax"],notes:"Uses native progressbar role. Add aria-label on the wrapping element for screen-reader context."}},we=120,Hn=`
165
165
  @keyframes lucent-menu-in {
166
166
  from { opacity: 0; transform: scale(0.97) translateY(-2px); }
167
167
  to { opacity: 1; transform: scale(1) translateY(0); }
@@ -170,7 +170,7 @@
170
170
  from { opacity: 1; transform: scale(1) translateY(0); }
171
171
  to { opacity: 0; transform: scale(0.97) translateY(-2px); }
172
172
  }
173
- `,Be={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},Gn={sm:"sm",md:"md",lg:"lg"},Un={sm:"xs",md:"sm",lg:"md"},_n={sm:12,md:14,lg:16},Pe=c.createContext(null),de=4;function Yn(t,r,n){const o=r.offsetWidth,a=r.offsetHeight,i=window.innerWidth,l=window.innerHeight;let s=0,d=0,f=n;const m={top:t.top-a-de,bottom:t.bottom+de,left:t.left-o-de,right:t.right+de};f.startsWith("bottom")?(s=m.bottom,s+a>l&&m.top>=0&&(s=m.top,f=f.replace("bottom","top"))):f.startsWith("top")?(s=m.top,s<0&&m.bottom+a<=l&&(s=m.bottom,f=f.replace("top","bottom"))):f==="left"?(s=t.top+t.height/2-a/2,d=m.left,d<0&&m.right+o<=i&&(d=m.right,f="right")):f==="right"&&(s=t.top+t.height/2-a/2,d=m.right,d+o>i&&m.left>=0&&(d=m.left,f="left")),(f.startsWith("top")||f.startsWith("bottom"))&&(f.endsWith("-start")?d=t.left:f.endsWith("-end")?d=t.right-o:d=t.left+t.width/2-o/2),d+o>i&&(d=i-o-8),d<0&&(d=8),s+a>l&&(s=l-a-8),s<0&&(s=8);let p="top left";return f.startsWith("top")?p=f.endsWith("-end")?"bottom right":f.endsWith("-start")?"bottom left":"bottom center":f.startsWith("bottom")?p=f.endsWith("-end")?"top right":f.endsWith("-start")?"top left":"top center":f==="left"?p="center right":f==="right"&&(p="center left"),{top:s,left:d,transformOrigin:p}}function me({onSelect:t,children:r,icon:n,shortcut:o,disabled:a=!1,danger:i=!1,selected:l=!1,style:s}){const d=c.useContext(Pe),f=c.useRef(-1);f.current===-1&&d&&(f.current=d.getItemIndex(),d.registerItem(f.current,a));const m=d?d.activeIndex===f.current:!1,p=(d==null?void 0:d.size)??"md",k=Be[p],x=Gn[p],g=_n[p],h=()=>{a||(t(),d==null||d.close())},u=()=>{!a&&d&&d.setActiveIndex(f.current)},b=a?"var(--lucent-text-disabled)":i?"var(--lucent-danger-text)":"var(--lucent-text-primary)";return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":l,"aria-disabled":a||void 0,"data-active":m||void 0,tabIndex:-1,onClick:h,onMouseEnter:u,style:{display:"flex",alignItems:"center",gap:k,padding:k,borderRadius:"var(--lucent-radius-md)",cursor:a?"not-allowed":"pointer",background:l?"color-mix(in srgb, var(--lucent-accent-default) 12%, var(--lucent-surface-overlay))":m?"var(--lucent-surface-secondary)":"transparent",boxShadow:l?"var(--lucent-shadow-sm)":"none",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)",opacity:a?.5:1,outline:"none",...s},children:[n&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a?"var(--lucent-text-disabled)":i?"var(--lucent-danger-text)":"var(--lucent-text-secondary)"},children:n}),e.jsx("span",{style:{flex:1,minWidth:0},children:e.jsx(C.Text,{size:x,style:{color:b},children:r})}),o&&e.jsx(C.Text,{size:p==="lg"?"sm":"xs",style:{color:"var(--lucent-text-secondary)",flexShrink:0},children:o}),l&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:"var(--lucent-accent-default)"},children:e.jsx("svg",{width:g,height:g,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})}function it({style:t}){return e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)",...t}})}function Kn({label:t,children:r,style:n}){const o=c.useContext(Pe),a=(o==null?void 0:o.size)??"md",i=Be[a];return e.jsxs("div",{role:"group","aria-label":t,style:n,children:[e.jsx("div",{style:{padding:`${i} ${i} var(--lucent-space-1)`},children:e.jsx(C.Text,{size:Un[a],color:"secondary",weight:"medium",children:t})}),r]})}function Le({trigger:t,children:r,placement:n="bottom-start",size:o="md",open:a,onOpenChange:i,portalContainer:l,style:s}){const d=a!==void 0,[f,m]=c.useState(!1),p=d?a:f,[k,x]=c.useState(!1),[g,h]=c.useState("idle"),u=c.useRef(null),b=c.useRef(null),w=c.useRef(null),y=c.useRef(!1),[S,I]=c.useState(null),v=c.useRef(0),A=c.useRef(new Map),[T,z]=c.useState(-1);if(!y.current&&typeof document<"u"){const E=document.createElement("style");E.textContent=Hn,document.head.appendChild(E),y.current=!0}c.useEffect(()=>{if(p)v.current=0,A.current.clear(),x(!0),h("entering");else if(k){h("exiting");const E=setTimeout(()=>{x(!1),h("idle")},we);return()=>clearTimeout(E)}},[p]);const F=c.useCallback(E=>{d||m(E),i==null||i(E)},[d,i]),R=c.useCallback(()=>{const E=w.current;E&&(E.querySelector("button, [tabindex]")??E).focus()},[]),j=c.useCallback(()=>{F(!1),R()},[F,R]);c.useLayoutEffect(()=>{if(!k||g!=="entering"||!u.current)return;const E=requestAnimationFrame(()=>{const B=b.current,M=u.current;if(!B||!M)return;const $=M.getBoundingClientRect();I(Yn($,B,n))});return()=>cancelAnimationFrame(E)},[k,g,n]),c.useEffect(()=>{if(!k||g!=="entering")return;const E=setTimeout(()=>{const M=Array.from(A.current.entries()).sort(($,V)=>$[0]-V[0]).find(([,$])=>!$.disabled);z(M?M[0]:-1)},0);return()=>clearTimeout(E)},[k,g]),c.useEffect(()=>{if(!p)return;const E=M=>{var V,L;const $=M.target;(V=u.current)!=null&&V.contains($)||(L=b.current)!=null&&L.contains($)||j()},B=requestAnimationFrame(()=>{document.addEventListener("mousedown",E)});return()=>{cancelAnimationFrame(B),document.removeEventListener("mousedown",E)}},[p,j]),c.useEffect(()=>{if(!p)return;let E=!1;const B=setTimeout(()=>{E=!0},50),M=()=>{E&&j()};return window.addEventListener("scroll",M,{passive:!0,capture:!0}),()=>{clearTimeout(B),window.removeEventListener("scroll",M,{capture:!0})}},[p,j]);const P=c.useCallback(()=>Array.from(A.current.entries()).filter(([,E])=>!E.disabled).map(([E])=>E).sort((E,B)=>E-B),[]),D=c.useCallback(E=>{if(!p)return;const B=P();if(B.length!==0)switch(E.key){case"Escape":E.preventDefault(),j();break;case"ArrowDown":{E.preventDefault(),z(M=>{const $=B.indexOf(M);return $<B.length-1?B[$+1]:B[0]});break}case"ArrowUp":{E.preventDefault(),z(M=>{const $=B.indexOf(M);return $>0?B[$-1]:B[B.length-1]});break}case"Home":{E.preventDefault(),z(B[0]);break}case"End":{E.preventDefault(),z(B[B.length-1]);break}case"Enter":case" ":{E.preventDefault();const M=b.current;if(M){const $=M.querySelector('[data-active="true"]');$==null||$.click()}break}case"Tab":{j();break}}},[p,j,P]);c.useEffect(()=>{if(p)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,D]),c.useEffect(()=>{if(!p)return;const E=b.current;if(!E)return;const B=E.querySelector('[data-active="true"]');B==null||B.scrollIntoView({block:"nearest"})},[T,p]);const W=()=>{F(!p)},q=E=>{(E.key==="Enter"||E.key===" "||E.key==="ArrowDown")&&(E.preventDefault(),p||F(!0)),E.key==="ArrowUp"&&(E.preventDefault(),p||(F(!0),setTimeout(()=>{const B=P();B.length>0&&z(B[B.length-1])},0)))},N={activeIndex:T,setActiveIndex:z,registerItem:(E,B)=>{A.current.set(E,{disabled:B})},close:j,getItemIndex:()=>v.current++,size:o},H=c.useId();return e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:u,style:{display:"inline-flex"},children:e.jsx("span",{ref:w,onClick:W,onKeyDown:q,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?H:void 0,style:{display:"inline-flex",cursor:"pointer"},children:t})}),k&&J.createPortal(e.jsx(Pe.Provider,{value:N,children:e.jsx("div",{ref:b,id:H,role:"menu",style:{position:"fixed",top:(S==null?void 0:S.top)??-9999,left:(S==null?void 0:S.left)??-9999,zIndex:1e3,minWidth:180,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:Be[o],maxHeight:"min(320px, calc(100vh - 32px))",overflowY:"auto",animation:g==="exiting"?`lucent-menu-out ${we}ms var(--lucent-easing-default) forwards`:`lucent-menu-in ${we}ms var(--lucent-easing-decelerate)`,transformOrigin:(S==null?void 0:S.transformOrigin)??"top left",outline:"none",pointerEvents:g==="exiting"?"none":"auto",...s},children:r})}),l??document.body)]})}const Xn={id:"menu",name:"Menu",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A dropdown menu triggered by clicking a host element. Renders in a portal to avoid overflow clipping, supports placement with auto-flip, keyboard navigation (arrow keys, Enter, Escape), and outside-click dismissal.",designIntent:'Menu provides a contextual action list that appears from a trigger element. It is a foundational overlay primitive — Select dropdowns, notification feeds, and context menus can all be composed from this building block.\n\n## Compound component API\nMenu uses a compound component pattern (`Menu`, `MenuItem`, `MenuSeparator`, `MenuGroup`) rather than a flat data array. Menu items have divergent structures — actions, separators, groups, icons, shortcut hints, danger state — that compose naturally as JSX children rather than discriminated union objects.\n\n## Sizing\nThe `size` prop (`sm` | `md` | `lg`) flows from the root `Menu` through context to all sub-components. Font sizes are aligned with Button: sm → `font-size-sm`, md → `font-size-md`, lg → `font-size-lg`. Item padding and gap use `space-2` for sm/md and `space-3` for lg, matching MultiSelect dropdown spacing. Group labels stay one step smaller than item text. Checkmark icons scale from 12px to 16px.\n\n## Placement & auto-flip\nThe `placement` prop sets the preferred position (default `bottom-start`). When the popover would overflow the viewport, it automatically flips to the opposite side. Horizontal alignment (`-start`, `-end`, or centered) is preserved during the flip. Position is computed with `getBoundingClientRect` on mount and rendered via `position: fixed` in a portal.\n\n## Portal rendering\nThe popover is portaled via `createPortal` (default: `document.body`). This prevents overflow clipping from parent containers with `overflow: hidden`. The trigger wrapper stays inline in the DOM tree so it participates in layout normally. The `portalContainer` prop lets consumers render the portal inside a wrapper element that sets `--lucent-*` CSS custom property overrides, preserving per-section theming.\n\n## Keyboard navigation\nFollows WAI-ARIA Menu Button pattern. Arrow keys cycle through enabled items (wrapping). Enter/Space selects the active item and closes the menu. Escape closes without selection. Tab closes and lets focus move naturally. Home/End jump to first/last enabled item.\n\n## Dismissal\nMenus close on outside click (mousedown, deferred via `requestAnimationFrame` to avoid catching the opening click), Escape, Tab, and scroll (armed after 50ms to skip mount-triggered scroll events). After close, focus returns to the trigger element.\n\n## Selected state\nMenuItem accepts a `selected` prop that renders a trailing accent-colored checkmark. The selected item gets a `color-mix(in srgb, accent-default 12%, surface-overlay)` background with `shadow-sm` elevation, making it visually stronger than the hover state (subtle `color-mix` tint). Uses `role="menuitemcheckbox"` with `aria-checked` for accessibility.\n\n## Animation\nBoth entrance and exit use a subtle scale + fade (`scale(0.97) ↔ 1`, `opacity 0 ↔ 1`) over 120ms. Entrance uses `easing-decelerate`, exit uses `easing-default`. `transform-origin` is set based on the actual placement (after auto-flip). The portal stays mounted during the exit animation via a `visible` state with `pointerEvents: none` to prevent interaction while fading out.',props:[{name:"trigger",type:"ReactNode",required:!0,description:"The element that toggles the menu on click. Typically a Button with a chevron. Wrapped in a <span> that receives click, keyboard, and ARIA attributes."},{name:"children",type:"ReactNode",required:!0,description:"MenuItem, MenuSeparator, and/or MenuGroup elements."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the menu panel. Controls item padding, gap, font size, and checkmark icon size. Font sizes match Button at each tier: sm → font-size-sm, md → font-size-md, lg → font-size-lg.",enumValues:["sm","md","lg"]},{name:"placement",type:"enum",required:!1,default:"bottom-start",description:"Preferred placement relative to the trigger. Auto-flips when near viewport edges.",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","right"]},{name:"open",type:"boolean",required:!1,description:"Controlled open state. When provided, the menu becomes controlled."},{name:"onOpenChange",type:"function",required:!1,description:"Callback fired when the menu opens or closes. Receives the new open state."},{name:"portalContainer",type:"HTMLElement | null",required:!1,description:"DOM element to portal the popover into. Defaults to document.body. Set this to a wrapper element to preserve CSS custom property inheritance for per-section theming."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the popover panel."},{name:"MenuItem.onSelect",type:"function",required:!0,description:"Fires when the item is selected via click or Enter/Space."},{name:"MenuItem.children",type:"ReactNode",required:!0,description:"Label content. Rendered via the Text atom at the size determined by the parent Menu."},{name:"MenuItem.icon",type:"ReactNode",required:!1,description:"Leading icon rendered before the label."},{name:"MenuItem.shortcut",type:"string",required:!1,description:'Trailing shortcut hint (e.g. "Cmd+D"). Displayed in secondary text.'},{name:"MenuItem.disabled",type:"boolean",required:!1,default:"false",description:"Disables selection, grays out the item, and skips it during keyboard navigation."},{name:"MenuItem.danger",type:"boolean",required:!1,default:"false",description:"Renders the item in danger color for destructive actions."},{name:"MenuItem.selected",type:"boolean",required:!1,default:"false",description:"Marks the item as currently selected. Shows a trailing checkmark in accent color, accent-tinted background via color-mix, and shadow-sm elevation. Visually stronger than hover."},{name:"MenuItem.style",type:"object",required:!1,description:"Inline style overrides for the item."},{name:"MenuSeparator.style",type:"object",required:!1,description:"Inline style overrides for the separator line."},{name:"MenuGroup.label",type:"string",required:!0,description:"Label shown above the group. Rendered one font step smaller than item text."},{name:"MenuGroup.children",type:"ReactNode",required:!0,description:"MenuItem elements within the group."},{name:"MenuGroup.style",type:"object",required:!1,description:"Inline style overrides for the group wrapper."}],usageExamples:[{title:"Basic menu",code:`<Menu trigger={<Button chevron>Actions</Button>}>
173
+ `,Be={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},Gn={sm:"sm",md:"md",lg:"lg"},Un={sm:"xs",md:"sm",lg:"md"},_n={sm:12,md:14,lg:16},Pe=c.createContext(null),de=4;function Yn(t,r,n){const o=r.offsetWidth,a=r.offsetHeight,i=window.innerWidth,s=window.innerHeight;let l=0,d=0,p=n;const m={top:t.top-a-de,bottom:t.bottom+de,left:t.left-o-de,right:t.right+de};p.startsWith("bottom")?(l=m.bottom,l+a>s&&m.top>=0&&(l=m.top,p=p.replace("bottom","top"))):p.startsWith("top")?(l=m.top,l<0&&m.bottom+a<=s&&(l=m.bottom,p=p.replace("top","bottom"))):p==="left"?(l=t.top+t.height/2-a/2,d=m.left,d<0&&m.right+o<=i&&(d=m.right,p="right")):p==="right"&&(l=t.top+t.height/2-a/2,d=m.right,d+o>i&&m.left>=0&&(d=m.left,p="left")),(p.startsWith("top")||p.startsWith("bottom"))&&(p.endsWith("-start")?d=t.left:p.endsWith("-end")?d=t.right-o:d=t.left+t.width/2-o/2),d+o>i&&(d=i-o-8),d<0&&(d=8),l+a>s&&(l=s-a-8),l<0&&(l=8);let f="top left";return p.startsWith("top")?f=p.endsWith("-end")?"bottom right":p.endsWith("-start")?"bottom left":"bottom center":p.startsWith("bottom")?f=p.endsWith("-end")?"top right":p.endsWith("-start")?"top left":"top center":p==="left"?f="center right":p==="right"&&(f="center left"),{top:l,left:d,transformOrigin:f}}function me({onSelect:t,children:r,icon:n,shortcut:o,disabled:a=!1,danger:i=!1,selected:s=!1,style:l}){const d=c.useContext(Pe),p=c.useRef(-1);p.current===-1&&d&&(p.current=d.getItemIndex(),d.registerItem(p.current,a));const m=d?d.activeIndex===p.current:!1,f=(d==null?void 0:d.size)??"md",w=Be[f],y=Gn[f],g=_n[f],h=()=>{a||(t(),d==null||d.close())},u=()=>{!a&&d&&d.setActiveIndex(p.current)},b=a?"var(--lucent-text-disabled)":i?"var(--lucent-danger-text)":"var(--lucent-text-primary)";return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":s,"aria-disabled":a||void 0,"data-active":m||void 0,tabIndex:-1,onClick:h,onMouseEnter:u,style:{display:"flex",alignItems:"center",gap:w,padding:w,borderRadius:"var(--lucent-radius-md)",cursor:a?"not-allowed":"pointer",background:s?"color-mix(in srgb, var(--lucent-accent-default) 12%, var(--lucent-surface-overlay))":m?"var(--lucent-surface-secondary)":"transparent",boxShadow:s?"var(--lucent-shadow-sm)":"none",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)",opacity:a?.5:1,outline:"none",...l},children:[n&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a?"var(--lucent-text-disabled)":i?"var(--lucent-danger-text)":"var(--lucent-text-secondary)"},children:n}),e.jsx("span",{style:{flex:1,minWidth:0},children:e.jsx(I.Text,{size:y,style:{color:b},children:r})}),o&&e.jsx(I.Text,{size:f==="lg"?"sm":"xs",style:{color:"var(--lucent-text-secondary)",flexShrink:0},children:o}),s&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:"var(--lucent-accent-default)"},children:e.jsx("svg",{width:g,height:g,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})}function it({style:t}){return e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)",...t}})}function Kn({label:t,children:r,style:n}){const o=c.useContext(Pe),a=(o==null?void 0:o.size)??"md",i=Be[a];return e.jsxs("div",{role:"group","aria-label":t,style:n,children:[e.jsx("div",{style:{padding:`${i} ${i} var(--lucent-space-1)`},children:e.jsx(I.Text,{size:Un[a],color:"secondary",weight:"medium",children:t})}),r]})}function Le({trigger:t,children:r,placement:n="bottom-start",size:o="md",open:a,onOpenChange:i,portalContainer:s,style:l}){const d=a!==void 0,[p,m]=c.useState(!1),f=d?a:p,[w,y]=c.useState(!1),[g,h]=c.useState("idle"),u=c.useRef(null),b=c.useRef(null),x=c.useRef(null),k=c.useRef(!1),[S,C]=c.useState(null),v=c.useRef(0),z=c.useRef(new Map),[T,E]=c.useState(-1);if(!k.current&&typeof document<"u"){const A=document.createElement("style");A.textContent=Hn,document.head.appendChild(A),k.current=!0}c.useEffect(()=>{if(f)v.current=0,z.current.clear(),y(!0),h("entering");else if(w){h("exiting");const A=setTimeout(()=>{y(!1),h("idle")},we);return()=>clearTimeout(A)}},[f]);const F=c.useCallback(A=>{d||m(A),i==null||i(A)},[d,i]),R=c.useCallback(()=>{const A=x.current;A&&(A.querySelector("button, [tabindex]")??A).focus()},[]),j=c.useCallback(()=>{F(!1),R()},[F,R]);c.useLayoutEffect(()=>{if(!w||g!=="entering"||!u.current)return;const A=requestAnimationFrame(()=>{const B=b.current,M=u.current;if(!B||!M)return;const $=M.getBoundingClientRect();C(Yn($,B,n))});return()=>cancelAnimationFrame(A)},[w,g,n]),c.useEffect(()=>{if(!w||g!=="entering")return;const A=setTimeout(()=>{const M=Array.from(z.current.entries()).sort(($,V)=>$[0]-V[0]).find(([,$])=>!$.disabled);E(M?M[0]:-1)},0);return()=>clearTimeout(A)},[w,g]),c.useEffect(()=>{if(!f)return;const A=M=>{var V,L;const $=M.target;(V=u.current)!=null&&V.contains($)||(L=b.current)!=null&&L.contains($)||j()},B=requestAnimationFrame(()=>{document.addEventListener("mousedown",A)});return()=>{cancelAnimationFrame(B),document.removeEventListener("mousedown",A)}},[f,j]),c.useEffect(()=>{if(!f)return;let A=!1;const B=setTimeout(()=>{A=!0},50),M=()=>{A&&j()};return window.addEventListener("scroll",M,{passive:!0,capture:!0}),()=>{clearTimeout(B),window.removeEventListener("scroll",M,{capture:!0})}},[f,j]);const P=c.useCallback(()=>Array.from(z.current.entries()).filter(([,A])=>!A.disabled).map(([A])=>A).sort((A,B)=>A-B),[]),D=c.useCallback(A=>{if(!f)return;const B=P();if(B.length!==0)switch(A.key){case"Escape":A.preventDefault(),j();break;case"ArrowDown":{A.preventDefault(),E(M=>{const $=B.indexOf(M);return $<B.length-1?B[$+1]:B[0]});break}case"ArrowUp":{A.preventDefault(),E(M=>{const $=B.indexOf(M);return $>0?B[$-1]:B[B.length-1]});break}case"Home":{A.preventDefault(),E(B[0]);break}case"End":{A.preventDefault(),E(B[B.length-1]);break}case"Enter":case" ":{A.preventDefault();const M=b.current;if(M){const $=M.querySelector('[data-active="true"]');$==null||$.click()}break}case"Tab":{j();break}}},[f,j,P]);c.useEffect(()=>{if(f)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[f,D]),c.useEffect(()=>{if(!f)return;const A=b.current;if(!A)return;const B=A.querySelector('[data-active="true"]');B==null||B.scrollIntoView({block:"nearest"})},[T,f]);const W=()=>{F(!f)},q=A=>{(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),f||F(!0)),A.key==="ArrowUp"&&(A.preventDefault(),f||(F(!0),setTimeout(()=>{const B=P();B.length>0&&E(B[B.length-1])},0)))},N={activeIndex:T,setActiveIndex:E,registerItem:(A,B)=>{z.current.set(A,{disabled:B})},close:j,getItemIndex:()=>v.current++,size:o},H=c.useId();return e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:u,style:{display:"inline-flex"},children:e.jsx("span",{ref:x,onClick:W,onKeyDown:q,"aria-haspopup":"menu","aria-expanded":f,"aria-controls":f?H:void 0,style:{display:"inline-flex",cursor:"pointer"},children:t})}),w&&J.createPortal(e.jsx(Pe.Provider,{value:N,children:e.jsx("div",{ref:b,id:H,role:"menu",style:{position:"fixed",top:(S==null?void 0:S.top)??-9999,left:(S==null?void 0:S.left)??-9999,zIndex:1e3,minWidth:180,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:Be[o],maxHeight:"min(320px, calc(100vh - 32px))",overflowY:"auto",animation:g==="exiting"?`lucent-menu-out ${we}ms var(--lucent-easing-default) forwards`:`lucent-menu-in ${we}ms var(--lucent-easing-decelerate)`,transformOrigin:(S==null?void 0:S.transformOrigin)??"top left",outline:"none",pointerEvents:g==="exiting"?"none":"auto",...l},children:r})}),s??document.body)]})}const Xn={id:"menu",name:"Menu",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A dropdown menu triggered by clicking a host element. Renders in a portal to avoid overflow clipping, supports placement with auto-flip, keyboard navigation (arrow keys, Enter, Escape), and outside-click dismissal.",designIntent:'Menu provides a contextual action list that appears from a trigger element. It is a foundational overlay primitive — Select dropdowns, notification feeds, and context menus can all be composed from this building block.\n\n## Compound component API\nMenu uses a compound component pattern (`Menu`, `MenuItem`, `MenuSeparator`, `MenuGroup`) rather than a flat data array. Menu items have divergent structures — actions, separators, groups, icons, shortcut hints, danger state — that compose naturally as JSX children rather than discriminated union objects.\n\n## Sizing\nThe `size` prop (`sm` | `md` | `lg`) flows from the root `Menu` through context to all sub-components. Font sizes are aligned with Button: sm → `font-size-sm`, md → `font-size-md`, lg → `font-size-lg`. Item padding and gap use `space-2` for sm/md and `space-3` for lg, matching MultiSelect dropdown spacing. Group labels stay one step smaller than item text. Checkmark icons scale from 12px to 16px.\n\n## Placement & auto-flip\nThe `placement` prop sets the preferred position (default `bottom-start`). When the popover would overflow the viewport, it automatically flips to the opposite side. Horizontal alignment (`-start`, `-end`, or centered) is preserved during the flip. Position is computed with `getBoundingClientRect` on mount and rendered via `position: fixed` in a portal.\n\n## Portal rendering\nThe popover is portaled via `createPortal` (default: `document.body`). This prevents overflow clipping from parent containers with `overflow: hidden`. The trigger wrapper stays inline in the DOM tree so it participates in layout normally. The `portalContainer` prop lets consumers render the portal inside a wrapper element that sets `--lucent-*` CSS custom property overrides, preserving per-section theming.\n\n## Keyboard navigation\nFollows WAI-ARIA Menu Button pattern. Arrow keys cycle through enabled items (wrapping). Enter/Space selects the active item and closes the menu. Escape closes without selection. Tab closes and lets focus move naturally. Home/End jump to first/last enabled item.\n\n## Dismissal\nMenus close on outside click (mousedown, deferred via `requestAnimationFrame` to avoid catching the opening click), Escape, Tab, and scroll (armed after 50ms to skip mount-triggered scroll events). After close, focus returns to the trigger element.\n\n## Selected state\nMenuItem accepts a `selected` prop that renders a trailing accent-colored checkmark. The selected item gets a `color-mix(in srgb, accent-default 12%, surface-overlay)` background with `shadow-sm` elevation, making it visually stronger than the hover state (subtle `color-mix` tint). Uses `role="menuitemcheckbox"` with `aria-checked` for accessibility.\n\n## Animation\nBoth entrance and exit use a subtle scale + fade (`scale(0.97) ↔ 1`, `opacity 0 ↔ 1`) over 120ms. Entrance uses `easing-decelerate`, exit uses `easing-default`. `transform-origin` is set based on the actual placement (after auto-flip). The portal stays mounted during the exit animation via a `visible` state with `pointerEvents: none` to prevent interaction while fading out.',props:[{name:"trigger",type:"ReactNode",required:!0,description:"The element that toggles the menu on click. Typically a Button with a chevron. Wrapped in a <span> that receives click, keyboard, and ARIA attributes."},{name:"children",type:"ReactNode",required:!0,description:"MenuItem, MenuSeparator, and/or MenuGroup elements."},{name:"size",type:"enum",required:!1,default:"md",description:"Size of the menu panel. Controls item padding, gap, font size, and checkmark icon size. Font sizes match Button at each tier: sm → font-size-sm, md → font-size-md, lg → font-size-lg.",enumValues:["sm","md","lg"]},{name:"placement",type:"enum",required:!1,default:"bottom-start",description:"Preferred placement relative to the trigger. Auto-flips when near viewport edges.",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","right"]},{name:"open",type:"boolean",required:!1,description:"Controlled open state. When provided, the menu becomes controlled."},{name:"onOpenChange",type:"function",required:!1,description:"Callback fired when the menu opens or closes. Receives the new open state."},{name:"portalContainer",type:"HTMLElement | null",required:!1,description:"DOM element to portal the popover into. Defaults to document.body. Set this to a wrapper element to preserve CSS custom property inheritance for per-section theming."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the popover panel."},{name:"MenuItem.onSelect",type:"function",required:!0,description:"Fires when the item is selected via click or Enter/Space."},{name:"MenuItem.children",type:"ReactNode",required:!0,description:"Label content. Rendered via the Text atom at the size determined by the parent Menu."},{name:"MenuItem.icon",type:"ReactNode",required:!1,description:"Leading icon rendered before the label."},{name:"MenuItem.shortcut",type:"string",required:!1,description:'Trailing shortcut hint (e.g. "Cmd+D"). Displayed in secondary text.'},{name:"MenuItem.disabled",type:"boolean",required:!1,default:"false",description:"Disables selection, grays out the item, and skips it during keyboard navigation."},{name:"MenuItem.danger",type:"boolean",required:!1,default:"false",description:"Renders the item in danger color for destructive actions."},{name:"MenuItem.selected",type:"boolean",required:!1,default:"false",description:"Marks the item as currently selected. Shows a trailing checkmark in accent color, accent-tinted background via color-mix, and shadow-sm elevation. Visually stronger than hover."},{name:"MenuItem.style",type:"object",required:!1,description:"Inline style overrides for the item."},{name:"MenuSeparator.style",type:"object",required:!1,description:"Inline style overrides for the separator line."},{name:"MenuGroup.label",type:"string",required:!0,description:"Label shown above the group. Rendered one font step smaller than item text."},{name:"MenuGroup.children",type:"ReactNode",required:!0,description:"MenuItem elements within the group."},{name:"MenuGroup.style",type:"object",required:!1,description:"Inline style overrides for the group wrapper."}],usageExamples:[{title:"Basic menu",code:`<Menu trigger={<Button chevron>Actions</Button>}>
174
174
  <MenuItem onSelect={() => console.log('edit')}>Edit</MenuItem>
175
175
  <MenuItem onSelect={() => console.log('duplicate')}>Duplicate</MenuItem>
176
176
  <MenuSeparator />
@@ -207,7 +207,7 @@
207
207
  <Menu trigger={<Button>Menu</Button>} open={open} onOpenChange={setOpen}>
208
208
  <MenuItem onSelect={() => {}}>Option A</MenuItem>
209
209
  <MenuItem onSelect={() => {}}>Option B</MenuItem>
210
- </Menu>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Item labels and group headers",required:!0}],accessibility:{role:"menu",ariaAttributes:['role="menu" on the popover panel','role="menuitemcheckbox" with aria-checked on each MenuItem','role="separator" on MenuSeparator','role="group" with aria-label on MenuGroup','aria-haspopup="menu" on the trigger wrapper',"aria-expanded on the trigger wrapper","aria-controls linking trigger to popover via id","aria-disabled on disabled MenuItems"],keyboardInteractions:["Enter/Space on trigger — toggle menu","ArrowDown on trigger — open menu, focus first item","ArrowUp on trigger — open menu, focus last item","ArrowDown — focus next enabled item (wraps)","ArrowUp — focus previous enabled item (wraps)","Enter/Space — select focused item, close menu","Escape — close menu, return focus to trigger","Tab — close menu, let focus move naturally","Home — focus first enabled item","End — focus last enabled item"],notes:'Focus returns to the trigger element after the menu is dismissed via Escape or selection. Disabled items are skipped during keyboard navigation and have aria-disabled. Selected items use role="menuitemcheckbox" with aria-checked for screen reader announcement. The popover is portaled to document.body (or portalContainer) but remains semantically linked to the trigger via aria-controls.'}},st={primary:{background:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",border:"1px solid transparent"},secondary:{background:"color-mix(in srgb, var(--lucent-accent-default) 16%, transparent)",color:"var(--lucent-text-primary)",border:"1px solid transparent"},outline:{background:"transparent",color:"var(--lucent-text-primary)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 35%, var(--lucent-border-default))"},ghost:{background:"transparent",color:"var(--lucent-text-primary)",border:"1px solid transparent"},danger:{background:"var(--lucent-danger-default)",color:"#ffffff",border:"1px solid var(--lucent-danger-default)"},"danger-outline":{background:"transparent",color:"var(--lucent-danger-text)",border:"1px solid var(--lucent-danger-default)"},"danger-ghost":{background:"transparent",color:"var(--lucent-danger-text)",border:"1px solid transparent"}},Jn={"2xs":{height:"22px",paddingOuter:"var(--lucent-space-2)",paddingInner:"var(--lucent-space-1)",fontSize:"var(--lucent-font-size-xs)",borderRadius:"var(--lucent-radius-md)"},xs:{height:"26px",paddingOuter:"var(--lucent-space-3)",paddingInner:"var(--lucent-space-1)",fontSize:"var(--lucent-font-size-xs)"},sm:{height:"calc(var(--lucent-space-8) * 0.5 + 18px)",paddingOuter:"var(--lucent-space-4)",paddingInner:"var(--lucent-space-2)",fontSize:"var(--lucent-font-size-sm)"},md:{height:"calc(var(--lucent-space-10) * 0.5 + 22px)",paddingOuter:"var(--lucent-space-5)",paddingInner:"var(--lucent-space-3)",fontSize:"var(--lucent-font-size-md)"},lg:{height:"calc(var(--lucent-space-12) * 0.5 + 26px)",paddingOuter:"var(--lucent-space-6)",paddingInner:"var(--lucent-space-3)",fontSize:"var(--lucent-font-size-lg)"}},Zn={"2xs":8,xs:10,sm:12,md:14,lg:16},Qn={"2xs":"24px",xs:"30px",sm:"34px",md:"36px",lg:"42px"},er={"2xs":"sm",xs:"sm",sm:"sm",md:"md",lg:"lg"},tr={primary:"var(--lucent-accent-hover)",secondary:"color-mix(in srgb, var(--lucent-accent-default) 22%, transparent)",outline:"color-mix(in srgb, var(--lucent-accent-default) 10%, transparent)",ghost:"color-mix(in srgb, var(--lucent-accent-default) 8%, transparent)",danger:"var(--lucent-danger-hover)","danger-outline":"color-mix(in srgb, var(--lucent-danger-default) 10%, transparent)","danger-ghost":"color-mix(in srgb, var(--lucent-danger-default) 8%, transparent)"},nr={primary:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 25%, transparent)",secondary:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 20%, transparent)",outline:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 20%, transparent)",ghost:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 15%, transparent)",danger:"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 25%, transparent)","danger-outline":"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 20%, transparent)","danger-ghost":"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 15%, transparent)"};function Ne(t,r,n){t.style.transform="translateY(-1px)",t.style.boxShadow=nr[r],t.style.background=tr[r],(r==="danger"&&n!==!1||r==="danger-outline"&&n!==!1)&&(t.style.borderColor="var(--lucent-danger-hover)")}function $e(t,r,n){t.style.transform="",t.style.boxShadow="",t.style.background=st[r].background,(r==="danger"&&n!==!1||r==="danger-outline"&&n!==!1)&&(t.style.borderColor="var(--lucent-danger-default)")}function We(t,r){const o=r==="danger"||r==="danger-outline"||r==="danger-ghost"?"color-mix(in srgb, var(--lucent-danger-default) 40%, transparent)":"color-mix(in srgb, var(--lucent-accent-default) 40%, transparent)";t.style.transform="translateY(1px)",t.style.boxShadow=`0 0 0 4px ${o}`,t.dataset.pressed="1"}function Oe(t){t.style.transform="",t.style.boxShadow="",delete t.dataset.pressed}function lt({children:t,onClick:r,menuItems:n,variant:o="primary",size:a="md",bordered:i=!0,menuPlacement:l="bottom-end",disabled:s,loading:d=!1,leftIcon:f,style:m}){const p=s??d,[k,x]=c.useState(!1),g=Jn[a],h=g.borderRadius??"var(--lucent-radius-lg)",u=Zn[a],b=p?{background:"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)",color:"var(--lucent-text-disabled)",borderColor:"transparent"}:{},w={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"var(--lucent-space-2)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,letterSpacing:"0.01em",cursor:p?"not-allowed":"pointer",outline:"none",margin:0,boxSizing:"border-box",whiteSpace:"nowrap",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default), transform 80ms var(--lucent-easing-default)",height:g.height,fontSize:g.fontSize,...st[o],...i===!1&&{border:"none"},...b},y="var(--lucent-radius-sm)",S=`${h} ${y} ${y} ${h}`,I=`${y} ${h} ${h} ${y}`;return e.jsxs("div",{role:"group","aria-label":typeof t=="string"?t:"Split button",style:{display:"inline-flex",alignItems:"center",gap:"calc(var(--lucent-space-1) / 2)",...m},children:[e.jsxs("button",{type:"button",disabled:p,"aria-busy":d,onClick:r,onMouseEnter:v=>{p||Ne(v.currentTarget,o,i)},onMouseLeave:v=>{p||$e(v.currentTarget,o,i)},onMouseDown:v=>{p||We(v.currentTarget,o)},onMouseUp:v=>{Oe(v.currentTarget)},onFocus:v=>{v.currentTarget.dataset.pressed||(v.currentTarget.style.boxShadow="0 0 0 3px var(--lucent-accent-subtle)")},onBlur:v=>{v.currentTarget.style.boxShadow=""},style:{...w,borderRadius:S,padding:o==="ghost"||o==="danger-ghost"?`0 ${g.paddingInner} 0 ${g.paddingOuter}`:`0 ${g.paddingOuter}`},children:[f,d?e.jsx(rr,{}):t]}),e.jsx(Le,{open:k,onOpenChange:x,placement:l,size:er[a],trigger:e.jsx("button",{type:"button",disabled:p,"aria-label":"More actions",onMouseEnter:v=>{p||Ne(v.currentTarget,o,i)},onMouseLeave:v=>{p||$e(v.currentTarget,o,i)},onMouseDown:v=>{p||We(v.currentTarget,o)},onMouseUp:v=>{Oe(v.currentTarget)},onFocus:v=>{v.currentTarget.dataset.pressed||(v.currentTarget.style.boxShadow="0 0 0 3px var(--lucent-accent-subtle)")},onBlur:v=>{v.currentTarget.style.boxShadow=""},style:{...w,borderRadius:I,padding:0,width:Qn[a]},children:e.jsx("svg",{width:u,height:u,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default)",...k&&{transform:"rotate(180deg)"}},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}),children:n.map((v,A)=>e.jsx(me,{onSelect:v.onSelect,...v.disabled!==void 0&&{disabled:v.disabled},...v.danger!==void 0&&{danger:v.danger},...v.icon!==void 0&&{icon:v.icon},children:v.label},A))})]})}lt.displayName="SplitButton";function rr(){return e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round","aria-hidden":!0,style:{animation:"lucent-spin 0.7s linear infinite",flexShrink:0},children:[e.jsx("style",{children:"@keyframes lucent-spin { to { transform: rotate(360deg); } }"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}const ar={id:"split-button",name:"SplitButton",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A compound button pairing a primary action with a chevron dropdown for secondary actions.",designIntent:'Use SplitButton when there is one dominant action alongside a small set of related alternatives (e.g. "Save" + "Save as draft", "Deploy" + "Deploy to staging"). Each half is a fully independent button separated by a small token-based gap, with a subtle inner corner radius (radius-sm) so the pair reads as a unit without sharing a border. Hover lift and press ring apply independently per half. Ghost variants use tighter inner padding to keep the halves visually close. The chevron half opens a Menu molecule; all dropdown keyboard navigation is inherited.',props:[{name:"children",type:"ReactNode",required:!0,description:"Label content for the primary action button."},{name:"onClick",type:"function",required:!0,description:"Handler fired when the primary (left) half is clicked."},{name:"menuItems",type:"array",required:!0,description:"Array of { label, onSelect, disabled?, danger?, icon? } for the dropdown."},{name:"variant",type:"enum",required:!1,default:"primary",description:"Visual variant applied to both halves.",enumValues:["primary","secondary","outline","ghost","danger","danger-outline","danger-ghost"]},{name:"size",type:"enum",required:!1,default:"md",description:"Size applied to both halves.",enumValues:["2xs","xs","sm","md","lg"]},{name:"bordered",type:"boolean",required:!1,default:"true",description:"If false, removes the border on both halves."},{name:"menuPlacement",type:"enum",required:!1,default:"bottom-end",description:"Dropdown placement relative to the chevron trigger.",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","right"]},{name:"disabled",type:"boolean",required:!1,description:"Disables both halves."},{name:"loading",type:"boolean",required:!1,default:"false",description:"Shows a spinner in the primary half and disables both."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon rendered before the label in the primary half."},{name:"style",type:"object",required:!1,description:"Style overrides for the wrapper div."}],usageExamples:[{title:"Basic",code:"<SplitButton onClick={handleSave} menuItems={[{ label: 'Save as draft', onSelect: handleDraft }]}>Save</SplitButton>"},{title:"Outline with leftIcon",code:`<SplitButton variant="outline" leftIcon={<Icon name="deploy" />} onClick={deploy} menuItems={[{ label: 'Deploy to staging', onSelect: deployStaging }, { label: 'Rollback', onSelect: rollback, danger: true }]}>Deploy</SplitButton>`},{title:"Menu items with icons",code:`<SplitButton onClick={handleSave} menuItems={[{ label: 'Save as draft', onSelect: handleDraft, icon: <Icon name="file" /> }, { label: 'Export', onSelect: handleExport, icon: <Icon name="download" /> }]}>Save</SplitButton>`},{title:"Small ghost bordered (issue #90 use case)",code:`<SplitButton variant="ghost" size="2xs" bordered onClick={toggle} menuItems={[{ label: 'Reset layout', onSelect: reset }]}>Collapse all</SplitButton>`},{title:"Danger outline with disabled item",code:`<SplitButton variant="danger-outline" onClick={handleDelete} menuItems={[{ label: 'Move to trash', onSelect: trash }, { label: 'Delete forever', onSelect: nuke, danger: true }, { label: 'Archive (unavailable)', onSelect: archive, disabled: true }]}>Delete</SplitButton>`},{title:"Disabled",code:"<SplitButton disabled onClick={handleSave} menuItems={[{ label: 'Option', onSelect: fn }]}>Save</SplitButton>"},{title:"Loading",code:"<SplitButton loading onClick={handleSave} menuItems={[{ label: 'Option', onSelect: fn }]}>Saving...</SplitButton>"}],compositionGraph:[{componentId:"menu",componentName:"Menu",role:"Dropdown container for secondary actions",required:!0},{componentId:"menu-item",componentName:"MenuItem",role:"Individual dropdown action",required:!0}],accessibility:{role:"group",ariaAttributes:["aria-label","aria-haspopup","aria-expanded","aria-busy"],keyboardInteractions:["Enter/Space on primary button fires onClick","Enter/Space/ArrowDown on chevron opens dropdown","ArrowDown/ArrowUp cycles dropdown items","Home/End jumps to first/last item","Escape closes dropdown and returns focus to chevron","Tab closes dropdown"],notes:'The wrapper uses role="group" with aria-label derived from children. The chevron button carries aria-haspopup="menu" and aria-expanded via Menu. Primary button has aria-busy when loading.'}},ae="var(--lucent-radius-sm)";function ct({children:t,style:r}){const n=c.Children.toArray(t).filter(c.isValidElement),o=n.length;return e.jsx("div",{role:"group",style:{display:"inline-flex",alignItems:"center",gap:"calc(var(--lucent-space-1) / 2)",...r},children:n.map((a,i)=>{const l=i===0,s=i===o-1;if(o===1)return a;const f=a.props.style??{},m=f.borderRadius??"var(--lucent-radius-lg)";let p;return l?p=`${m} ${ae} ${ae} ${m}`:s?p=`${ae} ${m} ${m} ${ae}`:p=ae,c.cloneElement(a,{key:i,style:{...f,borderRadius:p}})})})}ct.displayName="ButtonGroup";const or={id:"button-group",name:"ButtonGroup",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A layout wrapper that visually groups multiple Button or SplitButton children into a related strip.",designIntent:"Use ButtonGroup for peer actions that belong together visually — toolbars, action bars, toggle groups. Unlike SegmentedControl (single-select with indicator), ButtonGroup has no built-in selection state; each child handles its own behaviour. Items are separated by a small token-based gap with subtle inner corner radius so the group reads as a unit while each button retains its own border and hover states.",props:[{name:"children",type:"ReactNode",required:!0,description:"Button or SplitButton elements to group."},{name:"style",type:"object",required:!1,description:"Style overrides for the wrapper div."}],usageExamples:[{title:"Toolbar",code:`<ButtonGroup>
210
+ </Menu>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Item labels and group headers",required:!0}],accessibility:{role:"menu",ariaAttributes:['role="menu" on the popover panel','role="menuitemcheckbox" with aria-checked on each MenuItem','role="separator" on MenuSeparator','role="group" with aria-label on MenuGroup','aria-haspopup="menu" on the trigger wrapper',"aria-expanded on the trigger wrapper","aria-controls linking trigger to popover via id","aria-disabled on disabled MenuItems"],keyboardInteractions:["Enter/Space on trigger — toggle menu","ArrowDown on trigger — open menu, focus first item","ArrowUp on trigger — open menu, focus last item","ArrowDown — focus next enabled item (wraps)","ArrowUp — focus previous enabled item (wraps)","Enter/Space — select focused item, close menu","Escape — close menu, return focus to trigger","Tab — close menu, let focus move naturally","Home — focus first enabled item","End — focus last enabled item"],notes:'Focus returns to the trigger element after the menu is dismissed via Escape or selection. Disabled items are skipped during keyboard navigation and have aria-disabled. Selected items use role="menuitemcheckbox" with aria-checked for screen reader announcement. The popover is portaled to document.body (or portalContainer) but remains semantically linked to the trigger via aria-controls.'}},st={primary:{background:"var(--lucent-accent-default)",color:"var(--lucent-accent-fg)",border:"1px solid transparent"},secondary:{background:"color-mix(in srgb, var(--lucent-accent-default) 16%, transparent)",color:"var(--lucent-text-primary)",border:"1px solid transparent"},outline:{background:"transparent",color:"var(--lucent-text-primary)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 35%, var(--lucent-border-default))"},ghost:{background:"transparent",color:"var(--lucent-text-primary)",border:"1px solid transparent"},danger:{background:"var(--lucent-danger-default)",color:"#ffffff",border:"1px solid var(--lucent-danger-default)"},"danger-outline":{background:"transparent",color:"var(--lucent-danger-text)",border:"1px solid var(--lucent-danger-default)"},"danger-ghost":{background:"transparent",color:"var(--lucent-danger-text)",border:"1px solid transparent"}},Jn={"2xs":{height:"22px",paddingOuter:"var(--lucent-space-2)",paddingInner:"var(--lucent-space-1)",fontSize:"var(--lucent-font-size-xs)",borderRadius:"var(--lucent-radius-md)"},xs:{height:"26px",paddingOuter:"var(--lucent-space-3)",paddingInner:"var(--lucent-space-1)",fontSize:"var(--lucent-font-size-xs)"},sm:{height:"calc(var(--lucent-space-8) * 0.5 + 18px)",paddingOuter:"var(--lucent-space-4)",paddingInner:"var(--lucent-space-2)",fontSize:"var(--lucent-font-size-sm)"},md:{height:"calc(var(--lucent-space-10) * 0.5 + 22px)",paddingOuter:"var(--lucent-space-5)",paddingInner:"var(--lucent-space-3)",fontSize:"var(--lucent-font-size-md)"},lg:{height:"calc(var(--lucent-space-12) * 0.5 + 26px)",paddingOuter:"var(--lucent-space-6)",paddingInner:"var(--lucent-space-3)",fontSize:"var(--lucent-font-size-lg)"}},Zn={"2xs":8,xs:10,sm:12,md:14,lg:16},Qn={"2xs":"24px",xs:"30px",sm:"34px",md:"36px",lg:"42px"},er={"2xs":"sm",xs:"sm",sm:"sm",md:"md",lg:"lg"},tr={primary:"var(--lucent-accent-hover)",secondary:"color-mix(in srgb, var(--lucent-accent-default) 22%, transparent)",outline:"color-mix(in srgb, var(--lucent-accent-default) 10%, transparent)",ghost:"color-mix(in srgb, var(--lucent-accent-default) 8%, transparent)",danger:"var(--lucent-danger-hover)","danger-outline":"color-mix(in srgb, var(--lucent-danger-default) 10%, transparent)","danger-ghost":"color-mix(in srgb, var(--lucent-danger-default) 8%, transparent)"},nr={primary:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 25%, transparent)",secondary:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 20%, transparent)",outline:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 20%, transparent)",ghost:"0 4px 14px -2px color-mix(in srgb, var(--lucent-accent-default) 15%, transparent)",danger:"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 25%, transparent)","danger-outline":"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 20%, transparent)","danger-ghost":"0 4px 14px -2px color-mix(in srgb, var(--lucent-danger-default) 15%, transparent)"};function Ne(t,r,n){t.style.transform="translateY(-1px)",t.style.boxShadow=nr[r],t.style.background=tr[r],(r==="danger"&&n!==!1||r==="danger-outline"&&n!==!1)&&(t.style.borderColor="var(--lucent-danger-hover)")}function $e(t,r,n){t.style.transform="",t.style.boxShadow="",t.style.background=st[r].background,(r==="danger"&&n!==!1||r==="danger-outline"&&n!==!1)&&(t.style.borderColor="var(--lucent-danger-default)")}function We(t,r){const o=r==="danger"||r==="danger-outline"||r==="danger-ghost"?"color-mix(in srgb, var(--lucent-danger-default) 40%, transparent)":"color-mix(in srgb, var(--lucent-accent-default) 40%, transparent)";t.style.transform="translateY(1px)",t.style.boxShadow=`0 0 0 4px ${o}`,t.dataset.pressed="1"}function Oe(t){t.style.transform="",t.style.boxShadow="",delete t.dataset.pressed}function lt({children:t,onClick:r,menuItems:n,variant:o="primary",size:a="md",bordered:i=!0,menuPlacement:s="bottom-end",disabled:l,loading:d=!1,leftIcon:p,style:m}){const f=l??d,[w,y]=c.useState(!1),g=Jn[a],h=g.borderRadius??"var(--lucent-radius-lg)",u=Zn[a],b=f?{background:"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)",color:"var(--lucent-text-disabled)",borderColor:"transparent"}:{},x={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"var(--lucent-space-2)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",lineHeight:1,letterSpacing:"0.01em",cursor:f?"not-allowed":"pointer",outline:"none",margin:0,boxSizing:"border-box",whiteSpace:"nowrap",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), border-color var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default), transform 80ms var(--lucent-easing-default)",height:g.height,fontSize:g.fontSize,...st[o],...i===!1&&{border:"none"},...b},k="var(--lucent-radius-sm)",S=`${h} ${k} ${k} ${h}`,C=`${k} ${h} ${h} ${k}`;return e.jsxs("div",{role:"group","aria-label":typeof t=="string"?t:"Split button",style:{display:"inline-flex",alignItems:"center",gap:"calc(var(--lucent-space-1) / 2)",...m},children:[e.jsxs("button",{type:"button",disabled:f,"aria-busy":d,onClick:r,onMouseEnter:v=>{f||Ne(v.currentTarget,o,i)},onMouseLeave:v=>{f||$e(v.currentTarget,o,i)},onMouseDown:v=>{f||We(v.currentTarget,o)},onMouseUp:v=>{Oe(v.currentTarget)},onFocus:v=>{v.currentTarget.dataset.pressed||(v.currentTarget.style.boxShadow="0 0 0 3px var(--lucent-accent-subtle)")},onBlur:v=>{v.currentTarget.style.boxShadow=""},style:{...x,borderRadius:S,padding:o==="ghost"||o==="danger-ghost"?`0 ${g.paddingInner} 0 ${g.paddingOuter}`:`0 ${g.paddingOuter}`},children:[p,d?e.jsx(rr,{}):t]}),e.jsx(Le,{open:w,onOpenChange:y,placement:s,size:er[a],trigger:e.jsx("button",{type:"button",disabled:f,"aria-label":"More actions",onMouseEnter:v=>{f||Ne(v.currentTarget,o,i)},onMouseLeave:v=>{f||$e(v.currentTarget,o,i)},onMouseDown:v=>{f||We(v.currentTarget,o)},onMouseUp:v=>{Oe(v.currentTarget)},onFocus:v=>{v.currentTarget.dataset.pressed||(v.currentTarget.style.boxShadow="0 0 0 3px var(--lucent-accent-subtle)")},onBlur:v=>{v.currentTarget.style.boxShadow=""},style:{...x,borderRadius:C,padding:0,width:Qn[a]},children:e.jsx("svg",{width:u,height:u,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default)",...w&&{transform:"rotate(180deg)"}},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}),children:n.map((v,z)=>e.jsx(me,{onSelect:v.onSelect,...v.disabled!==void 0&&{disabled:v.disabled},...v.danger!==void 0&&{danger:v.danger},...v.icon!==void 0&&{icon:v.icon},children:v.label},z))})]})}lt.displayName="SplitButton";function rr(){return e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round","aria-hidden":!0,style:{animation:"lucent-spin 0.7s linear infinite",flexShrink:0},children:[e.jsx("style",{children:"@keyframes lucent-spin { to { transform: rotate(360deg); } }"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}const ar={id:"split-button",name:"SplitButton",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A compound button pairing a primary action with a chevron dropdown for secondary actions.",designIntent:'Use SplitButton when there is one dominant action alongside a small set of related alternatives (e.g. "Save" + "Save as draft", "Deploy" + "Deploy to staging"). Each half is a fully independent button separated by a small token-based gap, with a subtle inner corner radius (radius-sm) so the pair reads as a unit without sharing a border. Hover lift and press ring apply independently per half. Ghost variants use tighter inner padding to keep the halves visually close. The chevron half opens a Menu molecule; all dropdown keyboard navigation is inherited.',props:[{name:"children",type:"ReactNode",required:!0,description:"Label content for the primary action button."},{name:"onClick",type:"function",required:!0,description:"Handler fired when the primary (left) half is clicked."},{name:"menuItems",type:"array",required:!0,description:"Array of { label, onSelect, disabled?, danger?, icon? } for the dropdown."},{name:"variant",type:"enum",required:!1,default:"primary",description:"Visual variant applied to both halves.",enumValues:["primary","secondary","outline","ghost","danger","danger-outline","danger-ghost"]},{name:"size",type:"enum",required:!1,default:"md",description:"Size applied to both halves.",enumValues:["2xs","xs","sm","md","lg"]},{name:"bordered",type:"boolean",required:!1,default:"true",description:"If false, removes the border on both halves."},{name:"menuPlacement",type:"enum",required:!1,default:"bottom-end",description:"Dropdown placement relative to the chevron trigger.",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","right"]},{name:"disabled",type:"boolean",required:!1,description:"Disables both halves."},{name:"loading",type:"boolean",required:!1,default:"false",description:"Shows a spinner in the primary half and disables both."},{name:"leftIcon",type:"ReactNode",required:!1,description:"Icon rendered before the label in the primary half."},{name:"style",type:"object",required:!1,description:"Style overrides for the wrapper div."}],usageExamples:[{title:"Basic",code:"<SplitButton onClick={handleSave} menuItems={[{ label: 'Save as draft', onSelect: handleDraft }]}>Save</SplitButton>"},{title:"Outline with leftIcon",code:`<SplitButton variant="outline" leftIcon={<Icon name="deploy" />} onClick={deploy} menuItems={[{ label: 'Deploy to staging', onSelect: deployStaging }, { label: 'Rollback', onSelect: rollback, danger: true }]}>Deploy</SplitButton>`},{title:"Menu items with icons",code:`<SplitButton onClick={handleSave} menuItems={[{ label: 'Save as draft', onSelect: handleDraft, icon: <Icon name="file" /> }, { label: 'Export', onSelect: handleExport, icon: <Icon name="download" /> }]}>Save</SplitButton>`},{title:"Small ghost bordered (issue #90 use case)",code:`<SplitButton variant="ghost" size="2xs" bordered onClick={toggle} menuItems={[{ label: 'Reset layout', onSelect: reset }]}>Collapse all</SplitButton>`},{title:"Danger outline with disabled item",code:`<SplitButton variant="danger-outline" onClick={handleDelete} menuItems={[{ label: 'Move to trash', onSelect: trash }, { label: 'Delete forever', onSelect: nuke, danger: true }, { label: 'Archive (unavailable)', onSelect: archive, disabled: true }]}>Delete</SplitButton>`},{title:"Disabled",code:"<SplitButton disabled onClick={handleSave} menuItems={[{ label: 'Option', onSelect: fn }]}>Save</SplitButton>"},{title:"Loading",code:"<SplitButton loading onClick={handleSave} menuItems={[{ label: 'Option', onSelect: fn }]}>Saving...</SplitButton>"}],compositionGraph:[{componentId:"menu",componentName:"Menu",role:"Dropdown container for secondary actions",required:!0},{componentId:"menu-item",componentName:"MenuItem",role:"Individual dropdown action",required:!0}],accessibility:{role:"group",ariaAttributes:["aria-label","aria-haspopup","aria-expanded","aria-busy"],keyboardInteractions:["Enter/Space on primary button fires onClick","Enter/Space/ArrowDown on chevron opens dropdown","ArrowDown/ArrowUp cycles dropdown items","Home/End jumps to first/last item","Escape closes dropdown and returns focus to chevron","Tab closes dropdown"],notes:'The wrapper uses role="group" with aria-label derived from children. The chevron button carries aria-haspopup="menu" and aria-expanded via Menu. Primary button has aria-busy when loading.'}},ae="var(--lucent-radius-sm)";function ct({children:t,style:r}){const n=c.Children.toArray(t).filter(c.isValidElement),o=n.length;return e.jsx("div",{role:"group",style:{display:"inline-flex",alignItems:"center",gap:"calc(var(--lucent-space-1) / 2)",...r},children:n.map((a,i)=>{const s=i===0,l=i===o-1;if(o===1)return a;const p=a.props.style??{},m=p.borderRadius??"var(--lucent-radius-lg)";let f;return s?f=`${m} ${ae} ${ae} ${m}`:l?f=`${ae} ${m} ${m} ${ae}`:f=ae,c.cloneElement(a,{key:i,style:{...p,borderRadius:f}})})})}ct.displayName="ButtonGroup";const or={id:"button-group",name:"ButtonGroup",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A layout wrapper that visually groups multiple Button or SplitButton children into a related strip.",designIntent:"Use ButtonGroup for peer actions that belong together visually — toolbars, action bars, toggle groups. Unlike SegmentedControl (single-select with indicator), ButtonGroup has no built-in selection state; each child handles its own behaviour. Items are separated by a small token-based gap with subtle inner corner radius so the group reads as a unit while each button retains its own border and hover states.",props:[{name:"children",type:"ReactNode",required:!0,description:"Button or SplitButton elements to group."},{name:"style",type:"object",required:!1,description:"Style overrides for the wrapper div."}],usageExamples:[{title:"Toolbar",code:`<ButtonGroup>
211
211
  <Button variant="outline" leftIcon={<Icon name="bold" />} />
212
212
  <Button variant="outline" leftIcon={<Icon name="italic" />} />
213
213
  <Button variant="outline" leftIcon={<Icon name="underline" />} />
@@ -217,7 +217,7 @@
217
217
  </ButtonGroup>`},{title:"With SplitButton",code:`<ButtonGroup>
218
218
  <SplitButton onClick={deploy} menuItems={[{ label: 'Staging', onSelect: staging }]}>Deploy</SplitButton>
219
219
  <Button variant="outline">Logs</Button>
220
- </ButtonGroup>`}],compositionGraph:[{componentId:"button",componentName:"Button",role:"Grouped action item",required:!1},{componentId:"split-button",componentName:"SplitButton",role:"Grouped split action item",required:!1}],accessibility:{role:"group",ariaAttributes:[],keyboardInteractions:["Tab moves focus between buttons in the group"],notes:'Uses role="group" on the wrapper. Individual button accessibility is inherited from the children.'}};function ir({label:t,htmlFor:r,required:n=!1,helperText:o,errorMessage:a,children:i,style:l}){const s=a??o,d=a?"danger":"secondary";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)",...l},children:[t&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--lucent-space-1)"},children:[e.jsx(C.Text,{as:"label",size:"sm",weight:"medium",lineHeight:"tight",...r!==void 0&&{htmlFor:r},children:t}),n&&e.jsx(C.Text,{as:"span",size:"sm",color:"danger",lineHeight:"tight","aria-hidden":"true",children:"*"})]}),i,s&&e.jsx(C.Text,{size:"xs",color:d,lineHeight:"tight",children:s})]})}const sr={id:"form-field",name:"FormField",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Wraps any form control (Input, Select, Textarea) with a label, helper text, and validation message.",designIntent:"FormField standardises the vertical rhythm around form controls. A label is linked to the control via htmlFor so screen readers announce it correctly. The required asterisk is decorative (aria-hidden) because the actual required state should be communicated on the input via aria-required. Helper text provides proactive guidance; errorMessage replaces it when validation fails, using danger color to draw attention. The gap between elements uses space-2 to create a tight but breathable stack.",props:[{name:"label",type:"string",required:!1,description:"Label text rendered above the control as a <label> element."},{name:"htmlFor",type:"string",required:!1,description:"ID of the form control this label describes. Forwarded to the label htmlFor attribute."},{name:"required",type:"boolean",required:!1,default:"false",description:"Appends a danger-colored asterisk after the label text."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the control providing guidance. Hidden when errorMessage is set."},{name:"errorMessage",type:"string",required:!1,description:"Validation error shown in danger color below the control. Replaces helperText when set."},{name:"children",type:"ReactNode",required:!0,description:"The form control to wrap — typically Input, Select, or Textarea."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic field",code:`<FormField label="Email" htmlFor="email">
220
+ </ButtonGroup>`}],compositionGraph:[{componentId:"button",componentName:"Button",role:"Grouped action item",required:!1},{componentId:"split-button",componentName:"SplitButton",role:"Grouped split action item",required:!1}],accessibility:{role:"group",ariaAttributes:[],keyboardInteractions:["Tab moves focus between buttons in the group"],notes:'Uses role="group" on the wrapper. Individual button accessibility is inherited from the children.'}};function ir({label:t,htmlFor:r,required:n=!1,helperText:o,errorMessage:a,children:i,style:s}){const l=a??o,d=a?"danger":"secondary";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)",...s},children:[t&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--lucent-space-1)"},children:[e.jsx(I.Text,{as:"label",size:"sm",weight:"medium",lineHeight:"tight",...r!==void 0&&{htmlFor:r},children:t}),n&&e.jsx(I.Text,{as:"span",size:"sm",color:"danger",lineHeight:"tight","aria-hidden":"true",children:"*"})]}),i,l&&e.jsx(I.Text,{size:"xs",color:d,lineHeight:"tight",children:l})]})}const sr={id:"form-field",name:"FormField",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Wraps any form control (Input, Select, Textarea) with a label, helper text, and validation message.",designIntent:"FormField standardises the vertical rhythm around form controls. A label is linked to the control via htmlFor so screen readers announce it correctly. The required asterisk is decorative (aria-hidden) because the actual required state should be communicated on the input via aria-required. Helper text provides proactive guidance; errorMessage replaces it when validation fails, using danger color to draw attention. The gap between elements uses space-2 to create a tight but breathable stack.",props:[{name:"label",type:"string",required:!1,description:"Label text rendered above the control as a <label> element."},{name:"htmlFor",type:"string",required:!1,description:"ID of the form control this label describes. Forwarded to the label htmlFor attribute."},{name:"required",type:"boolean",required:!1,default:"false",description:"Appends a danger-colored asterisk after the label text."},{name:"helperText",type:"string",required:!1,description:"Secondary text below the control providing guidance. Hidden when errorMessage is set."},{name:"errorMessage",type:"string",required:!1,description:"Validation error shown in danger color below the control. Replaces helperText when set."},{name:"children",type:"ReactNode",required:!0,description:"The form control to wrap — typically Input, Select, or Textarea."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic field",code:`<FormField label="Email" htmlFor="email">
221
221
  <Input id="email" placeholder="you@example.com" />
222
222
  </FormField>`},{title:"Required with helper",code:`<FormField label="Username" htmlFor="username" required helperText="Letters and numbers only">
223
223
  <Input id="username" />
@@ -225,7 +225,7 @@
225
225
  <Input id="pw" type="password" />
226
226
  </FormField>`},{title:"Wrapping a Select",code:`<FormField label="Country" htmlFor="country">
227
227
  <Select id="country" options={countryOptions} />
228
- </FormField>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Label, helper text, and error message",required:!1}],accessibility:{ariaAttributes:["aria-required","aria-describedby"],notes:'Link the wrapped control to an error message using aria-describedby on the control and a matching id on the error element for full screen reader support. The required asterisk is aria-hidden; set aria-required="true" on the control itself.'}},Ve={sm:14,md:18,lg:20},lr={sm:"sm",md:"md",lg:"md"},cr={sm:"var(--lucent-space-1)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-2)"},dr=({size:t=16})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6.5",cy:"6.5",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),ur=({size:t=16})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 3h12M4 8h8M6 13h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),pr=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function fr({value:t,onChange:r,mode:n="search",placeholder:o,size:a="md",label:i,helperText:l,errorText:s,results:d=[],onResultSelect:f,isLoading:m=!1,disabled:p=!1,id:k,style:x}){const g=o??(n==="filter"?"Filter…":"Search…"),[h,u]=c.useState(!1),[b,w]=c.useState(null),y=c.useRef(null),S=c.useRef(null),I=c.useRef(null),[v,A]=c.useState({top:0,left:0,width:0}),T=n==="search"&&h&&d.length>0;c.useLayoutEffect(()=>{if(!T||!S.current)return;const D=S.current.getBoundingClientRect();A({top:D.bottom+4,left:D.left,width:D.width})},[T]);const z=()=>{r("")},F=D=>{f==null||f(D),u(!1)},R=()=>{y.current=setTimeout(()=>u(!1),150)},j=()=>{y.current&&clearTimeout(y.current),u(!0)},P=m?e.jsx(rt,{size:"sm"}):t?e.jsx("button",{type:"button","aria-label":n==="filter"?"Clear filter":"Clear search",onClick:z,style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:"var(--lucent-text-secondary)"},onMouseEnter:D=>{D.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:D=>{D.currentTarget.style.color="var(--lucent-text-secondary)"},children:e.jsx(pr,{})}):null;return e.jsxs("div",{ref:S,style:{...x},children:[e.jsx(C.Input,{id:k,type:"text",size:a,value:t,onChange:D=>r(D.target.value),placeholder:g,disabled:p,leftElement:n==="filter"?e.jsx(ur,{size:Ve[a]}):e.jsx(dr,{size:Ve[a]}),rightElement:P??void 0,onFocus:j,onBlur:R,...i!==void 0&&{label:i},...l!==void 0&&{helperText:l},...s!==void 0&&{errorText:s}}),T&&J.createPortal(e.jsx("div",{ref:I,role:"listbox",style:{position:"fixed",top:v.top,left:v.left,width:v.width,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:cr[a]},children:d.map((D,W)=>e.jsx("div",{role:"option","aria-selected":!1,onMouseDown:()=>F(D),onMouseEnter:()=>w(W),onMouseLeave:()=>w(null),style:{padding:"var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",cursor:"pointer",background:b===W?"color-mix(in srgb, var(--lucent-accent-default) 14%, transparent)":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:e.jsx(C.Text,{as:"span",size:lr[a],children:D.label})},D.id))}),document.body)]})}const hr={id:"search-input",name:"SearchInput",tier:"molecule",domain:"neutral",specVersion:"0.1",description:'A search field with a built-in magnifier icon, clear button, and an optional results dropdown. Use mode="filter" for a simple filter input with a funnel icon and no dropdown.',designIntent:'SearchInput is intentionally dumb about filtering — the consumer passes already-filtered results so the component stays stateless and flexible. The clear button appears only when the input has a value, keeping the right side clean at rest. The results dropdown is rendered absolutely below the input and closes after a 150ms delay on blur to allow result clicks to register before focus is lost. Spinner replaces the clear button during loading to communicate async state without layout shift. Use mode="filter" when you only need a text input with a funnel icon and clear button — no dropdown, no results array, just a clean filter field.',props:[{name:"value",type:"string",required:!0,description:"Controlled input value."},{name:"onChange",type:"function",required:!0,description:"Called with the new string value whenever the input changes."},{name:"mode",type:"enum",required:!1,default:"search",description:'Controls variant. "filter" swaps the magnifier for a funnel icon and disables the results dropdown.',enumValues:["search","filter"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size. Passed to the underlying Input.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Visible label above the search field. Passed to the underlying Input."},{name:"helperText",type:"string",required:!1,description:"Hint text below the field. Passed to the underlying Input."},{name:"errorText",type:"string",required:!1,description:"Validation error text. Triggers error styling on the underlying Input."},{name:"placeholder",type:"string",required:!1,default:'"Search…" (or "Filter…" in filter mode)',description:'Placeholder text for the input. Defaults to "Search…" in search mode and "Filter…" in filter mode.'},{name:"results",type:"array",required:!1,default:"[]",description:"Pre-filtered list of SearchResult objects ({ id, label }) to display in the dropdown."},{name:"onResultSelect",type:"function",required:!1,description:"Called with the selected SearchResult when a dropdown item is clicked."},{name:"isLoading",type:"boolean",required:!1,default:"false",description:"Shows a spinner in the right slot to indicate async search in progress."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the input."},{name:"id",type:"string",required:!1,description:"HTML id forwarded to the underlying input element."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic controlled search",code:`const [query, setQuery] = useState('');
228
+ </FormField>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Label, helper text, and error message",required:!1}],accessibility:{ariaAttributes:["aria-required","aria-describedby"],notes:'Link the wrapped control to an error message using aria-describedby on the control and a matching id on the error element for full screen reader support. The required asterisk is aria-hidden; set aria-required="true" on the control itself.'}},Ve={sm:14,md:18,lg:20},lr={sm:"sm",md:"md",lg:"md"},cr={sm:"var(--lucent-space-1)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-2)"},dr=({size:t=16})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6.5",cy:"6.5",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),ur=({size:t=16})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 3h12M4 8h8M6 13h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),pr=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function fr({value:t,onChange:r,mode:n="search",placeholder:o,size:a="md",label:i,helperText:s,errorText:l,results:d=[],onResultSelect:p,isLoading:m=!1,disabled:f=!1,id:w,style:y}){const g=o??(n==="filter"?"Filter…":"Search…"),[h,u]=c.useState(!1),[b,x]=c.useState(null),k=c.useRef(null),S=c.useRef(null),C=c.useRef(null),[v,z]=c.useState({top:0,left:0,width:0}),T=n==="search"&&h&&d.length>0;c.useLayoutEffect(()=>{if(!T||!S.current)return;const D=S.current.getBoundingClientRect();z({top:D.bottom+4,left:D.left,width:D.width})},[T]);const E=()=>{r("")},F=D=>{p==null||p(D),u(!1)},R=()=>{k.current=setTimeout(()=>u(!1),150)},j=()=>{k.current&&clearTimeout(k.current),u(!0)},P=m?e.jsx(rt,{size:"sm"}):t?e.jsx("button",{type:"button","aria-label":n==="filter"?"Clear filter":"Clear search",onClick:E,style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:"var(--lucent-text-secondary)"},onMouseEnter:D=>{D.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:D=>{D.currentTarget.style.color="var(--lucent-text-secondary)"},children:e.jsx(pr,{})}):null;return e.jsxs("div",{ref:S,style:{...y},children:[e.jsx(I.Input,{id:w,type:"text",size:a,value:t,onChange:D=>r(D.target.value),placeholder:g,disabled:f,leftElement:n==="filter"?e.jsx(ur,{size:Ve[a]}):e.jsx(dr,{size:Ve[a]}),rightElement:P??void 0,onFocus:j,onBlur:R,...i!==void 0&&{label:i},...s!==void 0&&{helperText:s},...l!==void 0&&{errorText:l}}),T&&J.createPortal(e.jsx("div",{ref:C,role:"listbox",style:{position:"fixed",top:v.top,left:v.left,width:v.width,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:cr[a]},children:d.map((D,W)=>e.jsx("div",{role:"option","aria-selected":!1,onMouseDown:()=>F(D),onMouseEnter:()=>x(W),onMouseLeave:()=>x(null),style:{padding:"var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",cursor:"pointer",background:b===W?"color-mix(in srgb, var(--lucent-accent-default) 14%, transparent)":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:e.jsx(I.Text,{as:"span",size:lr[a],children:D.label})},D.id))}),document.body)]})}const hr={id:"search-input",name:"SearchInput",tier:"molecule",domain:"neutral",specVersion:"0.1",description:'A search field with a built-in magnifier icon, clear button, and an optional results dropdown. Use mode="filter" for a simple filter input with a funnel icon and no dropdown.',designIntent:'SearchInput is intentionally dumb about filtering — the consumer passes already-filtered results so the component stays stateless and flexible. The clear button appears only when the input has a value, keeping the right side clean at rest. The results dropdown is rendered absolutely below the input and closes after a 150ms delay on blur to allow result clicks to register before focus is lost. Spinner replaces the clear button during loading to communicate async state without layout shift. Use mode="filter" when you only need a text input with a funnel icon and clear button — no dropdown, no results array, just a clean filter field.',props:[{name:"value",type:"string",required:!0,description:"Controlled input value."},{name:"onChange",type:"function",required:!0,description:"Called with the new string value whenever the input changes."},{name:"mode",type:"enum",required:!1,default:"search",description:'Controls variant. "filter" swaps the magnifier for a funnel icon and disables the results dropdown.',enumValues:["search","filter"]},{name:"size",type:"enum",required:!1,default:"md",description:"Controls height and font size. Passed to the underlying Input.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Visible label above the search field. Passed to the underlying Input."},{name:"helperText",type:"string",required:!1,description:"Hint text below the field. Passed to the underlying Input."},{name:"errorText",type:"string",required:!1,description:"Validation error text. Triggers error styling on the underlying Input."},{name:"placeholder",type:"string",required:!1,default:'"Search…" (or "Filter…" in filter mode)',description:'Placeholder text for the input. Defaults to "Search…" in search mode and "Filter…" in filter mode.'},{name:"results",type:"array",required:!1,default:"[]",description:"Pre-filtered list of SearchResult objects ({ id, label }) to display in the dropdown."},{name:"onResultSelect",type:"function",required:!1,description:"Called with the selected SearchResult when a dropdown item is clicked."},{name:"isLoading",type:"boolean",required:!1,default:"false",description:"Shows a spinner in the right slot to indicate async search in progress."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the input."},{name:"id",type:"string",required:!1,description:"HTML id forwarded to the underlying input element."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic controlled search",code:`const [query, setQuery] = useState('');
229
229
  const [results, setResults] = useState([]);
230
230
 
231
231
  <SearchInput
@@ -233,7 +233,7 @@ const [results, setResults] = useState([]);
233
233
  onChange={(v) => { setQuery(v); setResults(filter(v)); }}
234
234
  results={results}
235
235
  onResultSelect={(r) => console.log(r)}
236
- />`},{title:"Filter mode (no dropdown)",code:'<SearchInput mode="filter" value={filter} onChange={setFilter} placeholder="Filter items…" />'},{title:"Loading state",code:"<SearchInput value={query} onChange={setQuery} isLoading={isFetching} results={[]} />"}],compositionGraph:[{componentId:"input",componentName:"Input",role:"Search text field with icon slots",required:!0},{componentId:"spinner",componentName:"Spinner",role:"Loading indicator in the right slot",required:!1}],accessibility:{role:"combobox",ariaAttributes:["aria-expanded","aria-haspopup","aria-label"],keyboardInteractions:["Enter to select focused result","Escape to close dropdown"],notes:'The results list uses role="listbox" with role="option" items. For full keyboard navigation (arrow keys to move between results), wire up onKeyDown on the Input and manage an activeIndex state.'}},ye=c.createContext({px:"0",py:"0"}),mr={none:{py:"0",px:"0"},sm:{py:"var(--lucent-space-2)",px:"var(--lucent-space-3)"},md:{py:"var(--lucent-space-4)",px:"var(--lucent-space-5)"},lg:{py:"var(--lucent-space-6)",px:"var(--lucent-space-8)"}},ue={none:"var(--lucent-shadow-none)",sm:"var(--lucent-shadow-sm)",md:"var(--lucent-shadow-md)",lg:"var(--lucent-shadow-lg)"},gr={none:"var(--lucent-radius-none)",sm:"var(--lucent-radius-sm)",md:"var(--lucent-radius-md)",lg:"var(--lucent-radius-lg)"},vr={success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"},br={ghost:{background:"transparent",border:"none",shadowDefault:"none",dividers:!0},outline:{background:"transparent",border:"1px solid var(--lucent-border-default)",shadowDefault:"none",dividers:!0},filled:{background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",border:"none",shadowDefault:"none",dividers:!0},elevated:{background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",shadowDefault:"md",dividers:!0},combo:{background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",border:"none",shadowDefault:"none",dividers:!1}},yr=["transform 80ms var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)","border-color var(--lucent-duration-fast) var(--lucent-easing-default)","background var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),xr="0 4px 14px -2px var(--lucent-accent-subtle)",wr="0 4px 14px -2px color-mix(in srgb, var(--lucent-text-primary) 12%, transparent)",kr="0 0 0 3px var(--lucent-accent-subtle)",Sr="0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default)",Tr="0 0 0 3px var(--lucent-accent-subtle)";function ee(...t){const r=t.filter(n=>n!=null&&n!=="none"&&n!=="var(--lucent-shadow-none)");return r.length>0?r.join(", "):void 0}function Cr(t,r,n){return!r||n?t.background:"var(--lucent-accent-subtle)"}function Ir({variant:t="outline",header:r,footer:n,children:o,padding:a="md",shadow:i,radius:l="lg",style:s,onClick:d,href:f,target:m,rel:p,disabled:k,status:x,selected:g,hoverable:h,media:u}){const b=br[t],w=t==="combo",y=i??(w?"md":b.shadowDefault),{py:S,px:I}=mr[a],v=`${S} ${I}`,A=gr[l],T=f!=null,z=d!=null||T,F=z||(h??!1),R=(k??!1)&&z,j=T?"a":z?"button":"div",[P,D]=c.useState(!1),[W,q]=c.useState(!1),[N,H]=c.useState(!1),E=(g??!1)&&!R,B=E?Tr:void 0,M=Cr(b,g??!1,R),$=x!=null?`inset 3px 0 0 ${vr[x]}`:void 0;let V;w?V=ee(B,$):F&&!R?N?V=ee(Sr,B,$):W?V=ee(kr,B,$):P?V=ee(z?xr:wr,ue[y],B,$):V=ee(ue[y],B,$):V=ee(ue[y],B,$);const L={display:"flex",flexDirection:"column",background:M,border:b.border,borderRadius:A,overflow:u!=null&&!(E||F&&W)?"hidden":"visible",boxSizing:"border-box",position:"relative",...V!==void 0&&{boxShadow:V},...F&&!R&&N&&{transform:"translateY(1px)"},...F&&!R&&P&&!N&&{transform:"translateY(-1px)"},...F&&{cursor:R?"not-allowed":"pointer",transition:yr},...z&&!T&&{padding:0,font:"inherit",textAlign:"inherit",width:"100%",background:M},...T&&{textDecoration:"none",color:"inherit"},...R&&{opacity:.6,pointerEvents:"none"},...s},G=F&&!R?{onMouseEnter:()=>D(!0),onMouseLeave:()=>{D(!1),H(!1)},onMouseDown:()=>H(!0),onMouseUp:()=>H(!1),onFocus:()=>q(!0),onBlur:()=>{q(!1),H(!1)}}:{};return e.jsxs(j,{style:L,...G,...T&&{href:R?void 0:f,...m!==void 0&&{target:m},...p!==void 0&&{rel:p}},...!T&&z&&{type:"button",...R&&{disabled:!0}},...d!==void 0&&!R&&{onClick:d},...z&&g!==void 0&&{"aria-pressed":g},...T&&R&&{"aria-disabled":!0},children:[u!=null&&e.jsx("div",{style:{lineHeight:0,overflow:"hidden",borderRadius:`${A} ${A} 0 0`},children:u}),r!=null&&e.jsx("div",{style:{padding:v,...b.dividers?{borderBottom:"1px solid var(--lucent-border-default)"}:{}},children:r}),e.jsx(ye.Provider,{value:{px:I,py:S},children:e.jsx("div",{style:{padding:v,flex:1,...w?{background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:A,boxShadow:ue[y],marginLeft:`calc(${I} / 3)`,marginRight:`calc(${I} / 3)`}:{}},children:o})}),n!=null&&e.jsx("div",{style:{padding:v,...b.dividers?{borderTop:"1px solid var(--lucent-border-default)"}:{}},children:n})]})}function jr({children:t,style:r}){const{px:n}=c.useContext(ye);return e.jsx("div",{style:{marginLeft:`calc(-1 * ${n})`,marginRight:`calc(-1 * ${n})`,paddingLeft:n,paddingRight:n,...r},children:t})}const Mr={id:"card",name:"Card",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A surface container with five elevation variants that form a visual importance hierarchy. Supports optional header, body, and footer slots with configurable padding, shadow, and radius. Includes a CardBleed sub-component for edge-to-edge content.",designIntent:'Card provides a configurable surface with an explicit elevation hierarchy. Each variant maps to a distinct level of visual prominence, giving consumers a single prop to express how much attention a surface should command relative to its surroundings.\n\n## Elevation hierarchy (lowest → highest)\n\n1. **ghost** — transparent background, no border, no shadow.\n The card is invisible as a container — content floats directly against the page or parent surface. Use for logical groupings that shouldn\'t compete visually: sidebar sections, form regions, or layout slots where structure exists conceptually but not visually. Header/footer dividers still render if those slots are used, providing minimal internal structure.\n\n2. **outline** (default) — transparent background with `border-default` border, no shadow.\n Like ghost, the card inherits its container\'s background — the border alone defines the boundary. This is the workhorse variant for lists of items, form sections, data panels, and any content that needs a visible container without drawing excessive attention. Header and footer slots are separated from the body by matching `border-default` dividers.\n\n3. **filled** — semi-transparent tinted background, no border, no shadow.\n Differentiates the card from its surroundings by darkening (light mode) or lightening (dark mode) whatever surface it sits on. Uses `color-mix(in srgb, textPrimary 6%, transparent)` so the tint is always relative to the container — never a fixed color. Use for secondary content areas, inset panels, summary blocks, or anywhere a border would feel heavy but the card needs to be visually distinct. Effective for nesting (e.g., a filled card inside an elevated card creates a recessed region).\n\n4. **elevated** — `surface` background with medium shadow, no border.\n The card lifts off the page through depth. The shadow creates a physical metaphor: this content sits above the surface it rests on. Use for primary content areas, feature highlights, pricing cards, or any surface that should feel physically elevated. The lack of border keeps the silhouette soft — the shadow alone defines the boundary.\n\n5. **combo** — transparent wrapper with an elevated body inset.\n The header and footer are flat — they blend into the page background as if they were part of it. Only the body section is elevated: it gets `surface` background, border-radius, and shadow, appearing as a raised card sitting between the flat header/footer regions. This draws the eye to the primary content while keeping supporting info (header) and actions (footer) visually subordinate — they frame the elevated body without competing with it. No dividers are rendered — the elevation change IS the visual separator. Use for detail panels, profile cards, or settings forms where the body content is the focal point.\n\n## Shadow override\nThe `shadow` prop overrides whatever shadow the variant implies. This allows fine-tuning without changing the variant. For example, `variant="elevated" shadow="lg"` gives an elevated card with extra depth, while `variant="outline" shadow="none"` gives a flat bordered card.\n\n## Token rules\n- `elevated` and `combo` body use `surface` (the primary component surface — white in light mode).\n- `filled` uses a semi-transparent tint of `textPrimary` — contextually darker/lighter than its container.\n- `combo` wrapper is transparent (header/footer blend with page); only the body is elevated with `surface`.\n- `ghost` and `outline` use `transparent` — they inherit from whatever they\'re placed on. The border is the only visual differentiator for `outline`.\n- Never use `bgBase` or `bgSubtle` on a Card — those tokens are reserved for the page canvas.\n- Content nested inside a Card that needs a tinted fill should use `color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)` for accent-neutral insets.',props:[{name:"variant",type:"enum",required:!1,default:"outline",description:"The elevation variant. Controls background color, border, and default shadow. Ordered from lowest to highest visual prominence: ghost → outline → filled → elevated → combo.",enumValues:["ghost","outline","filled","elevated","combo"]},{name:"children",type:"ReactNode",required:!0,description:"The card body content."},{name:"header",type:"ReactNode",required:!1,description:"Content rendered in the header slot. Separated from the body by a divider in all variants except combo, where the background-color change provides the separation."},{name:"footer",type:"ReactNode",required:!1,description:"Content rendered in the footer slot. Separated from the body by a divider in all variants except combo, where the background-color change provides the separation."},{name:"padding",type:"enum",required:!1,default:"md",description:"Inner padding applied equally to header, body, and footer.",enumValues:["none","sm","md","lg"]},{name:"shadow",type:"enum",required:!1,description:"Box shadow elevation. When omitted, uses the variant's default: ghost=none, outline=none, filled=none, elevated=md, combo=md. When set explicitly, overrides the variant's default.",enumValues:["none","sm","md","lg"]},{name:"radius",type:"enum",required:!1,default:"lg",description:"Border radius of the card.",enumValues:["none","sm","md","lg"]},{name:"style",type:"object",required:!1,description:"Inline style overrides for the card wrapper."},{name:"onClick",type:"function",required:!1,description:"Click handler. When provided, the card renders as a <button> with hover lift, focus ring, and active press states matching the Button component."},{name:"href",type:"string",required:!1,description:"Link URL. When provided, the card renders as an <a>. Takes precedence over onClick for the element type, but onClick is still attached as a handler."},{name:"target",type:"string",required:!1,description:'Passed to <a> when href is set (e.g. "_blank").'},{name:"rel",type:"string",required:!1,description:'Passed to <a> when href is set (e.g. "noopener noreferrer").'},{name:"disabled",type:"boolean",required:!1,description:"Disables interactive behavior. Reduces opacity, removes hover/focus/active states, and sets cursor to not-allowed. Only applies when onClick or href is set."},{name:"status",type:"enum",required:!1,description:"Adds a 3px colored inset box-shadow on the left edge of the card. Rendered as an inset shadow (same technique as NavMenu inverse highlight) so it naturally follows the card's border-radius. Uses the corresponding status token (successDefault, warningDefault, dangerDefault, infoDefault). Works with all variants.",enumValues:["success","warning","danger","info"]},{name:"selected",type:"boolean",required:!1,description:"Adds an inset accent ring and subtle background tint to indicate selection. Used for card grids where cards act as radio/checkbox options. Pairs with onClick for toggle behavior. Sets aria-pressed on interactive cards. Disabled takes precedence — ring is hidden when disabled."},{name:"hoverable",type:"boolean",required:!1,description:"Enables hover lift (translateY -1px) and neutral glow shadow without making the card a button or link. Use when the card contains its own interactive content (e.g. a Collapsible trigger) and the whole card surface should hint at interactivity. Interactive cards (onClick/href) get accent-colored hover glow; hoverable-only cards get a neutral glow (12% text-primary)."},{name:"media",type:"ReactNode",required:!1,description:"Full-bleed content rendered at the top of the card (before header). No padding is applied. Use for hero images, illustrations, or any edge-to-edge top content. The media slot self-clips to the card's top border-radius. Cards without media default to overflow:visible so nested child shadows (e.g. an elevated Card inside a Collapsible) are never cut off."}],usageExamples:[{title:"Ghost — invisible container",code:`<Card variant="ghost">
236
+ />`},{title:"Filter mode (no dropdown)",code:'<SearchInput mode="filter" value={filter} onChange={setFilter} placeholder="Filter items…" />'},{title:"Loading state",code:"<SearchInput value={query} onChange={setQuery} isLoading={isFetching} results={[]} />"}],compositionGraph:[{componentId:"input",componentName:"Input",role:"Search text field with icon slots",required:!0},{componentId:"spinner",componentName:"Spinner",role:"Loading indicator in the right slot",required:!1}],accessibility:{role:"combobox",ariaAttributes:["aria-expanded","aria-haspopup","aria-label"],keyboardInteractions:["Enter to select focused result","Escape to close dropdown"],notes:'The results list uses role="listbox" with role="option" items. For full keyboard navigation (arrow keys to move between results), wire up onKeyDown on the Input and manage an activeIndex state.'}},ye=c.createContext({px:"0",py:"0"}),mr={none:{py:"0",px:"0"},sm:{py:"var(--lucent-space-2)",px:"var(--lucent-space-3)"},md:{py:"var(--lucent-space-4)",px:"var(--lucent-space-5)"},lg:{py:"var(--lucent-space-6)",px:"var(--lucent-space-8)"}},ue={none:"var(--lucent-shadow-none)",sm:"var(--lucent-shadow-sm)",md:"var(--lucent-shadow-md)",lg:"var(--lucent-shadow-lg)"},gr={none:"var(--lucent-radius-none)",sm:"var(--lucent-radius-sm)",md:"var(--lucent-radius-md)",lg:"var(--lucent-radius-lg)"},vr={success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"},br={ghost:{background:"transparent",border:"none",shadowDefault:"none",dividers:!0},outline:{background:"transparent",border:"1px solid var(--lucent-border-default)",shadowDefault:"none",dividers:!0},filled:{background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",border:"none",shadowDefault:"none",dividers:!0},elevated:{background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",shadowDefault:"md",dividers:!0},combo:{background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",border:"none",shadowDefault:"none",dividers:!1}},yr=["transform 80ms var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)","border-color var(--lucent-duration-fast) var(--lucent-easing-default)","background var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", "),xr="0 4px 14px -2px var(--lucent-accent-subtle)",wr="0 4px 14px -2px color-mix(in srgb, var(--lucent-text-primary) 12%, transparent)",kr="0 0 0 3px var(--lucent-accent-subtle)",Sr="0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default)",Tr="0 0 0 3px var(--lucent-accent-subtle)";function ee(...t){const r=t.filter(n=>n!=null&&n!=="none"&&n!=="var(--lucent-shadow-none)");return r.length>0?r.join(", "):void 0}function Cr(t,r,n){return!r||n?t.background:"var(--lucent-accent-subtle)"}function Ir({variant:t="outline",header:r,footer:n,children:o,padding:a="md",shadow:i,radius:s="lg",style:l,onClick:d,href:p,target:m,rel:f,disabled:w,status:y,selected:g,hoverable:h,media:u}){const b=br[t],x=t==="combo",k=i??(x?"md":b.shadowDefault),{py:S,px:C}=mr[a],v=`${S} ${C}`,z=gr[s],T=p!=null,E=d!=null||T,F=E||(h??!1),R=(w??!1)&&E,j=T?"a":E?"button":"div",[P,D]=c.useState(!1),[W,q]=c.useState(!1),[N,H]=c.useState(!1),A=(g??!1)&&!R,B=A?Tr:void 0,M=Cr(b,g??!1,R),$=y!=null?`inset 3px 0 0 ${vr[y]}`:void 0;let V;x?V=ee(B,$):F&&!R?N?V=ee(Sr,B,$):W?V=ee(kr,B,$):P?V=ee(E?xr:wr,ue[k],B,$):V=ee(ue[k],B,$):V=ee(ue[k],B,$);const L={display:"flex",flexDirection:"column",background:M,border:b.border,borderRadius:z,overflow:u!=null&&!(A||F&&W)?"hidden":"visible",boxSizing:"border-box",position:"relative",...V!==void 0&&{boxShadow:V},...F&&!R&&N&&{transform:"translateY(1px)"},...F&&!R&&P&&!N&&{transform:"translateY(-1px)"},...F&&{cursor:R?"not-allowed":"pointer",transition:yr},...E&&!T&&{padding:0,font:"inherit",textAlign:"inherit",width:"100%",background:M},...T&&{textDecoration:"none",color:"inherit"},...R&&{opacity:.6,pointerEvents:"none"},...l},G=F&&!R?{onMouseEnter:()=>D(!0),onMouseLeave:()=>{D(!1),H(!1)},onMouseDown:()=>H(!0),onMouseUp:()=>H(!1),onFocus:()=>q(!0),onBlur:()=>{q(!1),H(!1)}}:{};return e.jsxs(j,{style:L,...G,...T&&{href:R?void 0:p,...m!==void 0&&{target:m},...f!==void 0&&{rel:f}},...!T&&E&&{type:"button",...R&&{disabled:!0}},...d!==void 0&&!R&&{onClick:d},...E&&g!==void 0&&{"aria-pressed":g},...T&&R&&{"aria-disabled":!0},children:[u!=null&&e.jsx("div",{style:{lineHeight:0,overflow:"hidden",borderRadius:`${z} ${z} 0 0`},children:u}),r!=null&&e.jsx("div",{style:{padding:v,...b.dividers?{borderBottom:"1px solid var(--lucent-border-default)"}:{}},children:r}),e.jsx(ye.Provider,{value:{px:C,py:S},children:e.jsx("div",{style:{padding:v,flex:1,...x?{background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:z,boxShadow:ue[k],marginLeft:`calc(${C} / 3)`,marginRight:`calc(${C} / 3)`}:{}},children:o})}),n!=null&&e.jsx("div",{style:{padding:v,...b.dividers?{borderTop:"1px solid var(--lucent-border-default)"}:{}},children:n})]})}function jr({children:t,style:r}){const{px:n}=c.useContext(ye);return e.jsx("div",{style:{marginLeft:`calc(-1 * ${n})`,marginRight:`calc(-1 * ${n})`,paddingLeft:n,paddingRight:n,...r},children:t})}const Mr={id:"card",name:"Card",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A surface container with five elevation variants that form a visual importance hierarchy. Supports optional header, body, and footer slots with configurable padding, shadow, and radius. Includes a CardBleed sub-component for edge-to-edge content.",designIntent:'Card provides a configurable surface with an explicit elevation hierarchy. Each variant maps to a distinct level of visual prominence, giving consumers a single prop to express how much attention a surface should command relative to its surroundings.\n\n## Elevation hierarchy (lowest → highest)\n\n1. **ghost** — transparent background, no border, no shadow.\n The card is invisible as a container — content floats directly against the page or parent surface. Use for logical groupings that shouldn\'t compete visually: sidebar sections, form regions, or layout slots where structure exists conceptually but not visually. Header/footer dividers still render if those slots are used, providing minimal internal structure.\n\n2. **outline** (default) — transparent background with `border-default` border, no shadow.\n Like ghost, the card inherits its container\'s background — the border alone defines the boundary. This is the workhorse variant for lists of items, form sections, data panels, and any content that needs a visible container without drawing excessive attention. Header and footer slots are separated from the body by matching `border-default` dividers.\n\n3. **filled** — semi-transparent tinted background, no border, no shadow.\n Differentiates the card from its surroundings by darkening (light mode) or lightening (dark mode) whatever surface it sits on. Uses `color-mix(in srgb, textPrimary 6%, transparent)` so the tint is always relative to the container — never a fixed color. Use for secondary content areas, inset panels, summary blocks, or anywhere a border would feel heavy but the card needs to be visually distinct. Effective for nesting (e.g., a filled card inside an elevated card creates a recessed region).\n\n4. **elevated** — `surface` background with medium shadow, no border.\n The card lifts off the page through depth. The shadow creates a physical metaphor: this content sits above the surface it rests on. Use for primary content areas, feature highlights, pricing cards, or any surface that should feel physically elevated. The lack of border keeps the silhouette soft — the shadow alone defines the boundary.\n\n5. **combo** — transparent wrapper with an elevated body inset.\n The header and footer are flat — they blend into the page background as if they were part of it. Only the body section is elevated: it gets `surface` background, border-radius, and shadow, appearing as a raised card sitting between the flat header/footer regions. This draws the eye to the primary content while keeping supporting info (header) and actions (footer) visually subordinate — they frame the elevated body without competing with it. No dividers are rendered — the elevation change IS the visual separator. Use for detail panels, profile cards, or settings forms where the body content is the focal point.\n\n## Shadow override\nThe `shadow` prop overrides whatever shadow the variant implies. This allows fine-tuning without changing the variant. For example, `variant="elevated" shadow="lg"` gives an elevated card with extra depth, while `variant="outline" shadow="none"` gives a flat bordered card.\n\n## Token rules\n- `elevated` and `combo` body use `surface` (the primary component surface — white in light mode).\n- `filled` uses a semi-transparent tint of `textPrimary` — contextually darker/lighter than its container.\n- `combo` wrapper is transparent (header/footer blend with page); only the body is elevated with `surface`.\n- `ghost` and `outline` use `transparent` — they inherit from whatever they\'re placed on. The border is the only visual differentiator for `outline`.\n- Never use `bgBase` or `bgSubtle` on a Card — those tokens are reserved for the page canvas.\n- Content nested inside a Card that needs a tinted fill should use `color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)` for accent-neutral insets.',props:[{name:"variant",type:"enum",required:!1,default:"outline",description:"The elevation variant. Controls background color, border, and default shadow. Ordered from lowest to highest visual prominence: ghost → outline → filled → elevated → combo.",enumValues:["ghost","outline","filled","elevated","combo"]},{name:"children",type:"ReactNode",required:!0,description:"The card body content."},{name:"header",type:"ReactNode",required:!1,description:"Content rendered in the header slot. Separated from the body by a divider in all variants except combo, where the background-color change provides the separation."},{name:"footer",type:"ReactNode",required:!1,description:"Content rendered in the footer slot. Separated from the body by a divider in all variants except combo, where the background-color change provides the separation."},{name:"padding",type:"enum",required:!1,default:"md",description:"Inner padding applied equally to header, body, and footer.",enumValues:["none","sm","md","lg"]},{name:"shadow",type:"enum",required:!1,description:"Box shadow elevation. When omitted, uses the variant's default: ghost=none, outline=none, filled=none, elevated=md, combo=md. When set explicitly, overrides the variant's default.",enumValues:["none","sm","md","lg"]},{name:"radius",type:"enum",required:!1,default:"lg",description:"Border radius of the card.",enumValues:["none","sm","md","lg"]},{name:"style",type:"object",required:!1,description:"Inline style overrides for the card wrapper."},{name:"onClick",type:"function",required:!1,description:"Click handler. When provided, the card renders as a <button> with hover lift, focus ring, and active press states matching the Button component."},{name:"href",type:"string",required:!1,description:"Link URL. When provided, the card renders as an <a>. Takes precedence over onClick for the element type, but onClick is still attached as a handler."},{name:"target",type:"string",required:!1,description:'Passed to <a> when href is set (e.g. "_blank").'},{name:"rel",type:"string",required:!1,description:'Passed to <a> when href is set (e.g. "noopener noreferrer").'},{name:"disabled",type:"boolean",required:!1,description:"Disables interactive behavior. Reduces opacity, removes hover/focus/active states, and sets cursor to not-allowed. Only applies when onClick or href is set."},{name:"status",type:"enum",required:!1,description:"Adds a 3px colored inset box-shadow on the left edge of the card. Rendered as an inset shadow (same technique as NavMenu inverse highlight) so it naturally follows the card's border-radius. Uses the corresponding status token (successDefault, warningDefault, dangerDefault, infoDefault). Works with all variants.",enumValues:["success","warning","danger","info"]},{name:"selected",type:"boolean",required:!1,description:"Adds an inset accent ring and subtle background tint to indicate selection. Used for card grids where cards act as radio/checkbox options. Pairs with onClick for toggle behavior. Sets aria-pressed on interactive cards. Disabled takes precedence — ring is hidden when disabled."},{name:"hoverable",type:"boolean",required:!1,description:"Enables hover lift (translateY -1px) and neutral glow shadow without making the card a button or link. Use when the card contains its own interactive content (e.g. a Collapsible trigger) and the whole card surface should hint at interactivity. Interactive cards (onClick/href) get accent-colored hover glow; hoverable-only cards get a neutral glow (12% text-primary)."},{name:"media",type:"ReactNode",required:!1,description:"Full-bleed content rendered at the top of the card (before header). No padding is applied. Use for hero images, illustrations, or any edge-to-edge top content. The media slot self-clips to the card's top border-radius. Cards without media default to overflow:visible so nested child shadows (e.g. an elevated Card inside a Collapsible) are never cut off."}],usageExamples:[{title:"Ghost — invisible container",code:`<Card variant="ghost">
237
237
  <Text>Content sits directly on the page background.</Text>
238
238
  </Card>`},{title:"Outline — bordered card (default)",code:`<Card
239
239
  header={<Text weight="semibold">Card title</Text>}
@@ -289,11 +289,11 @@ const [results, setResults] = useState([]);
289
289
  <Text size="sm" color="secondary">Two-tone: flat trigger on filled surface, content in elevated body.</Text>
290
290
  </Card>
291
291
  </Collapsible>
292
- </Card>`}],compositionGraph:[],accessibility:{notes:"Non-interactive cards have no implicit ARIA role — wrap in <section> or <article> if needed. Interactive cards with onClick render as <button> with focus ring. Interactive cards with href render as <a> with focus ring. Selected cards set aria-pressed on the interactive element. The status accent bar is aria-hidden (decorative). Media slot images should include alt text."}},zr={info:{bg:"var(--lucent-info-subtle)",border:"var(--lucent-info-default)",iconColor:"var(--lucent-info-text)",textColor:"info"},success:{bg:"var(--lucent-success-subtle)",border:"var(--lucent-success-default)",iconColor:"var(--lucent-success-text)",textColor:"success"},warning:{bg:"var(--lucent-warning-subtle)",border:"var(--lucent-warning-default)",iconColor:"var(--lucent-warning-text)",textColor:"warning"},danger:{bg:"var(--lucent-danger-subtle)",border:"var(--lucent-danger-default)",iconColor:"var(--lucent-danger-text)",textColor:"danger"}},Er=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 5.5V8.5M8 10.5V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ar=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qr=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M8 2L14.5 13H1.5L8 2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Dr=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5.5 5.5L10.5 10.5M10.5 5.5L5.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Rr={info:e.jsx(Er,{}),success:e.jsx(Ar,{}),warning:e.jsx(qr,{}),danger:e.jsx(Dr,{})},Br=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function Pr({variant:t="info",title:r,children:n,onDismiss:o,icon:a,style:i}){const l=zr[t],s=a??Rr[t];return e.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:l.bg,border:`1px solid ${l.border}`,borderRadius:"var(--lucent-radius-md)",boxSizing:"border-box",...i},children:[e.jsx("span",{style:{flexShrink:0,color:l.iconColor,display:"flex",alignItems:"center",paddingTop:2},children:s}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)"},children:[r&&e.jsx(C.Text,{as:"span",size:"sm",weight:"semibold",color:l.textColor,lineHeight:"tight",children:r}),n&&e.jsx(C.Text,{as:"span",size:"sm",color:l.textColor,lineHeight:"base",children:n})]}),o&&e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:o,style:{flexShrink:0,display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:l.iconColor,opacity:.7},onMouseEnter:d=>{d.currentTarget.style.opacity="1"},onMouseLeave:d=>{d.currentTarget.style.opacity="0.7"},children:e.jsx(Br,{})})]})}const Lr={id:"alert",name:"Alert",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"An inline feedback banner with info, success, warning, and danger variants, optional title, and dismiss button.",designIntent:'Alert uses role="alert" so screen readers announce the message immediately when it appears. Each variant has a built-in icon that communicates intent visually; the icon can be overridden for custom scenarios. Title and body are both optional — you can show either, both, or just an icon with a body. The dismiss button is only rendered when onDismiss is provided, keeping the layout clean for non-dismissible alerts. All colors use status semantic tokens so they adapt correctly between light and dark themes.',props:[{name:"variant",type:"enum",required:!1,default:"info",description:"Visual and semantic variant of the alert.",enumValues:["info","success","warning","danger"]},{name:"title",type:"string",required:!1,description:"Bold title line rendered above the body."},{name:"children",type:"ReactNode",required:!1,description:"Alert body content — typically a short sentence or ReactNode."},{name:"onDismiss",type:"function",required:!1,description:"When provided, renders a dismiss (×) button and calls this handler on click."},{name:"icon",type:"ReactNode",required:!1,description:"Custom icon to replace the built-in variant icon."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the alert wrapper."}],usageExamples:[{title:"Info with body",code:'<Alert variant="info">Your changes have been saved as a draft.</Alert>'},{title:"With title and dismiss",code:`<Alert variant="danger" title="Payment failed" onDismiss={() => setVisible(false)}>
292
+ </Card>`}],compositionGraph:[],accessibility:{notes:"Non-interactive cards have no implicit ARIA role — wrap in <section> or <article> if needed. Interactive cards with onClick render as <button> with focus ring. Interactive cards with href render as <a> with focus ring. Selected cards set aria-pressed on the interactive element. The status accent bar is aria-hidden (decorative). Media slot images should include alt text."}},zr={info:{bg:"var(--lucent-info-subtle)",border:"var(--lucent-info-default)",iconColor:"var(--lucent-info-text)",textColor:"info"},success:{bg:"var(--lucent-success-subtle)",border:"var(--lucent-success-default)",iconColor:"var(--lucent-success-text)",textColor:"success"},warning:{bg:"var(--lucent-warning-subtle)",border:"var(--lucent-warning-default)",iconColor:"var(--lucent-warning-text)",textColor:"warning"},danger:{bg:"var(--lucent-danger-subtle)",border:"var(--lucent-danger-default)",iconColor:"var(--lucent-danger-text)",textColor:"danger"}},Er=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 5.5V8.5M8 10.5V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ar=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qr=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M8 2L14.5 13H1.5L8 2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Dr=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5.5 5.5L10.5 10.5M10.5 5.5L5.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Rr={info:e.jsx(Er,{}),success:e.jsx(Ar,{}),warning:e.jsx(qr,{}),danger:e.jsx(Dr,{})},Br=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function Pr({variant:t="info",title:r,children:n,onDismiss:o,icon:a,style:i}){const s=zr[t],l=a??Rr[t];return e.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:s.bg,border:`1px solid ${s.border}`,borderRadius:"var(--lucent-radius-md)",boxSizing:"border-box",...i},children:[e.jsx("span",{style:{flexShrink:0,color:s.iconColor,display:"flex",alignItems:"center",paddingTop:2},children:l}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)"},children:[r&&e.jsx(I.Text,{as:"span",size:"sm",weight:"semibold",color:s.textColor,lineHeight:"tight",children:r}),n&&e.jsx(I.Text,{as:"span",size:"sm",color:s.textColor,lineHeight:"base",children:n})]}),o&&e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:o,style:{flexShrink:0,display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:s.iconColor,opacity:.7},onMouseEnter:d=>{d.currentTarget.style.opacity="1"},onMouseLeave:d=>{d.currentTarget.style.opacity="0.7"},children:e.jsx(Br,{})})]})}const Lr={id:"alert",name:"Alert",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"An inline feedback banner with info, success, warning, and danger variants, optional title, and dismiss button.",designIntent:'Alert uses role="alert" so screen readers announce the message immediately when it appears. Each variant has a built-in icon that communicates intent visually; the icon can be overridden for custom scenarios. Title and body are both optional — you can show either, both, or just an icon with a body. The dismiss button is only rendered when onDismiss is provided, keeping the layout clean for non-dismissible alerts. All colors use status semantic tokens so they adapt correctly between light and dark themes.',props:[{name:"variant",type:"enum",required:!1,default:"info",description:"Visual and semantic variant of the alert.",enumValues:["info","success","warning","danger"]},{name:"title",type:"string",required:!1,description:"Bold title line rendered above the body."},{name:"children",type:"ReactNode",required:!1,description:"Alert body content — typically a short sentence or ReactNode."},{name:"onDismiss",type:"function",required:!1,description:"When provided, renders a dismiss (×) button and calls this handler on click."},{name:"icon",type:"ReactNode",required:!1,description:"Custom icon to replace the built-in variant icon."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the alert wrapper."}],usageExamples:[{title:"Info with body",code:'<Alert variant="info">Your changes have been saved as a draft.</Alert>'},{title:"With title and dismiss",code:`<Alert variant="danger" title="Payment failed" onDismiss={() => setVisible(false)}>
293
293
  Check your card details and try again.
294
294
  </Alert>`},{title:"Success confirmation",code:`<Alert variant="success" title="Order placed!">
295
295
  You'll receive a confirmation email shortly.
296
- </Alert>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Title and body content",required:!1}],accessibility:{role:"alert",ariaAttributes:["aria-label"],notes:'role="alert" causes screen readers to announce the content immediately when rendered. For non-urgent status messages, consider using role="status" instead by overriding via style/wrapper.'}};function Fr({illustration:t,title:r,description:n,action:o,style:a}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--lucent-space-4)",padding:"var(--lucent-space-8)",textAlign:"center",...a},children:[t!=null&&e.jsx("div",{style:{width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--lucent-text-secondary)"},children:t}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)"},children:[e.jsx(C.Text,{as:"h3",size:"lg",weight:"semibold",align:"center",lineHeight:"tight",children:r}),n&&e.jsx(C.Text,{size:"sm",color:"secondary",align:"center",lineHeight:"relaxed",children:n})]}),o!=null&&e.jsx("div",{children:o})]})}const Nr={id:"empty-state",name:"EmptyState",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A centered placeholder shown when a list or page has no content, with an optional illustration, title, description, and CTA.",designIntent:"EmptyState communicates the absence of data in a constructive way. The illustration slot accepts any ReactNode — an Icon atom, a custom SVG, or an image — and constrains it to a 64px square to maintain visual consistency. Title is required to ensure the state is always named; description is optional for additional context. The action slot accepts any ReactNode (typically a Button) so the consumer controls variant and label without prescribing them. The entire layout is center-aligned and padded to sit naturally inside a Card or page section.",props:[{name:"title",type:"string",required:!0,description:'Short headline naming the empty state (e.g. "No results found").'},{name:"illustration",type:"ReactNode",required:!1,description:"Icon, SVG, or image rendered above the title. Constrained to a 64px container."},{name:"description",type:"string",required:!1,description:"Secondary text below the title providing context or next steps."},{name:"action",type:"ReactNode",required:!1,description:"Call-to-action rendered below the description — typically a Button."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"No search results",code:`<EmptyState
296
+ </Alert>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Title and body content",required:!1}],accessibility:{role:"alert",ariaAttributes:["aria-label"],notes:'role="alert" causes screen readers to announce the content immediately when rendered. For non-urgent status messages, consider using role="status" instead by overriding via style/wrapper.'}};function Fr({illustration:t,title:r,description:n,action:o,style:a}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--lucent-space-4)",padding:"var(--lucent-space-8)",textAlign:"center",...a},children:[t!=null&&e.jsx("div",{style:{width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--lucent-text-secondary)"},children:t}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)"},children:[e.jsx(I.Text,{as:"h3",size:"lg",weight:"semibold",align:"center",lineHeight:"tight",children:r}),n&&e.jsx(I.Text,{size:"sm",color:"secondary",align:"center",lineHeight:"relaxed",children:n})]}),o!=null&&e.jsx("div",{children:o})]})}const Nr={id:"empty-state",name:"EmptyState",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"A centered placeholder shown when a list or page has no content, with an optional illustration, title, description, and CTA.",designIntent:"EmptyState communicates the absence of data in a constructive way. The illustration slot accepts any ReactNode — an Icon atom, a custom SVG, or an image — and constrains it to a 64px square to maintain visual consistency. Title is required to ensure the state is always named; description is optional for additional context. The action slot accepts any ReactNode (typically a Button) so the consumer controls variant and label without prescribing them. The entire layout is center-aligned and padded to sit naturally inside a Card or page section.",props:[{name:"title",type:"string",required:!0,description:'Short headline naming the empty state (e.g. "No results found").'},{name:"illustration",type:"ReactNode",required:!1,description:"Icon, SVG, or image rendered above the title. Constrained to a 64px container."},{name:"description",type:"string",required:!1,description:"Secondary text below the title providing context or next steps."},{name:"action",type:"ReactNode",required:!1,description:"Call-to-action rendered below the description — typically a Button."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"No search results",code:`<EmptyState
297
297
  illustration={<Icon size="xl"><SearchIcon /></Icon>}
298
298
  title="No results found"
299
299
  description="Try adjusting your search or filter to find what you're looking for."
@@ -304,18 +304,18 @@ const [results, setResults] = useState([]);
304
304
  action={<Button variant="primary">New project</Button>}
305
305
  />`},{title:"Inside a Card",code:`<Card>
306
306
  <EmptyState title="Nothing here" description="Add items to see them listed." />
307
- </Card>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Title and description",required:!0}],accessibility:{notes:"The title renders as an h3 by default. If EmptyState appears inside a section with its own heading hierarchy, override by passing a Text component as part of a custom layout. Ensure the action element has a descriptive label for screen readers."}},$r={text:"1em",circle:40,rectangle:40},Wr={text:"var(--lucent-radius-sm)",circle:"var(--lucent-radius-full)",rectangle:"var(--lucent-radius-md)"};function He({width:t,height:r,radius:n,animate:o,style:a}){return e.jsx("span",{style:{display:"block",width:typeof t=="number"?`${t}px`:t,height:typeof r=="number"?`${r}px`:r,borderRadius:n,background:o?"linear-gradient(90deg, var(--lucent-surface-secondary) 25%, var(--lucent-surface) 50%, var(--lucent-surface-secondary) 75%)":"var(--lucent-surface-secondary)",backgroundSize:o?"200% 100%":void 0,animation:o?"lucent-skeleton-shimmer 1.6s ease-in-out infinite":void 0,flexShrink:0,...a}})}function Or({variant:t="rectangle",width:r="100%",height:n,lines:o=1,animate:a=!0,radius:i,style:l}){const s=n??$r[t],d=i??Wr[t],f=a?e.jsx("style",{children:`
307
+ </Card>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Title and description",required:!0}],accessibility:{notes:"The title renders as an h3 by default. If EmptyState appears inside a section with its own heading hierarchy, override by passing a Text component as part of a custom layout. Ensure the action element has a descriptive label for screen readers."}},$r={text:"1em",circle:40,rectangle:40},Wr={text:"var(--lucent-radius-sm)",circle:"var(--lucent-radius-full)",rectangle:"var(--lucent-radius-md)"};function He({width:t,height:r,radius:n,animate:o,style:a}){return e.jsx("span",{style:{display:"block",width:typeof t=="number"?`${t}px`:t,height:typeof r=="number"?`${r}px`:r,borderRadius:n,background:o?"linear-gradient(90deg, var(--lucent-surface-secondary) 25%, var(--lucent-surface) 50%, var(--lucent-surface-secondary) 75%)":"var(--lucent-surface-secondary)",backgroundSize:o?"200% 100%":void 0,animation:o?"lucent-skeleton-shimmer 1.6s ease-in-out infinite":void 0,flexShrink:0,...a}})}function Or({variant:t="rectangle",width:r="100%",height:n,lines:o=1,animate:a=!0,radius:i,style:s}){const l=n??$r[t],d=i??Wr[t],p=a?e.jsx("style",{children:`
308
308
  @keyframes lucent-skeleton-shimmer {
309
309
  0% { background-position: 200% 0; }
310
310
  100% { background-position: -200% 0; }
311
311
  }
312
- `}):null;return t==="text"&&o>1?e.jsxs(e.Fragment,{children:[f,e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)",...l},children:Array.from({length:o}).map((m,p)=>e.jsx(He,{width:p===o-1?"70%":r,height:s,radius:d,animate:a},p))})]}):e.jsxs(e.Fragment,{children:[f,e.jsx(He,{width:t==="circle"?n??40:r,height:s,radius:d,animate:a,...l!==void 0&&{style:l}})]})}const Vr={id:"skeleton",name:"Skeleton",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Animated placeholder that matches the shape of content while it loads.",designIntent:"Skeleton uses a shimmer animation to communicate that content is loading without showing a spinner. The three variants (text, circle, rectangle) cover the most common content shapes: inline text, avatars/thumbnails, and generic content blocks. The text variant with lines > 1 mimics a paragraph by stacking multiple text skeletons and shortening the last line to 70%, which is a widely recognised convention for body copy placeholders. The shimmer gradient uses bg-muted and bg-subtle so it adapts correctly in both light and dark themes without hard-coded colors.",props:[{name:"variant",type:"enum",required:!1,default:"rectangle",description:"Shape of the skeleton — text (1em tall), circle (equal width/height), or rectangle.",enumValues:["text","circle","rectangle"]},{name:"width",type:"string",required:!1,default:'"100%"',description:"Width of the skeleton. Accepts any CSS value or a number (interpreted as px)."},{name:"height",type:"string",required:!1,description:"Height of the skeleton. Defaults: text=1em, circle=40px, rectangle=40px."},{name:"lines",type:"number",required:!1,default:"1",description:"Number of stacked text lines to render. Only applies to the text variant."},{name:"animate",type:"boolean",required:!1,default:"true",description:"Enables the shimmer animation. Set to false to render a static placeholder."},{name:"radius",type:"string",required:!1,description:"Override the default border-radius for the variant."},{name:"style",type:"object",required:!1,description:"Inline style overrides."}],usageExamples:[{title:"Paragraph placeholder",code:'<Skeleton variant="text" lines={3} />'},{title:"Avatar placeholder",code:'<Skeleton variant="circle" width={40} height={40} />'},{title:"Card placeholder",code:`<Card>
312
+ `}):null;return t==="text"&&o>1?e.jsxs(e.Fragment,{children:[p,e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)",...s},children:Array.from({length:o}).map((m,f)=>e.jsx(He,{width:f===o-1?"70%":r,height:l,radius:d,animate:a},f))})]}):e.jsxs(e.Fragment,{children:[p,e.jsx(He,{width:t==="circle"?n??40:r,height:l,radius:d,animate:a,...s!==void 0&&{style:s}})]})}const Vr={id:"skeleton",name:"Skeleton",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Animated placeholder that matches the shape of content while it loads.",designIntent:"Skeleton uses a shimmer animation to communicate that content is loading without showing a spinner. The three variants (text, circle, rectangle) cover the most common content shapes: inline text, avatars/thumbnails, and generic content blocks. The text variant with lines > 1 mimics a paragraph by stacking multiple text skeletons and shortening the last line to 70%, which is a widely recognised convention for body copy placeholders. The shimmer gradient uses bg-muted and bg-subtle so it adapts correctly in both light and dark themes without hard-coded colors.",props:[{name:"variant",type:"enum",required:!1,default:"rectangle",description:"Shape of the skeleton — text (1em tall), circle (equal width/height), or rectangle.",enumValues:["text","circle","rectangle"]},{name:"width",type:"string",required:!1,default:'"100%"',description:"Width of the skeleton. Accepts any CSS value or a number (interpreted as px)."},{name:"height",type:"string",required:!1,description:"Height of the skeleton. Defaults: text=1em, circle=40px, rectangle=40px."},{name:"lines",type:"number",required:!1,default:"1",description:"Number of stacked text lines to render. Only applies to the text variant."},{name:"animate",type:"boolean",required:!1,default:"true",description:"Enables the shimmer animation. Set to false to render a static placeholder."},{name:"radius",type:"string",required:!1,description:"Override the default border-radius for the variant."},{name:"style",type:"object",required:!1,description:"Inline style overrides."}],usageExamples:[{title:"Paragraph placeholder",code:'<Skeleton variant="text" lines={3} />'},{title:"Avatar placeholder",code:'<Skeleton variant="circle" width={40} height={40} />'},{title:"Card placeholder",code:`<Card>
313
313
  <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
314
314
  <Skeleton variant="rectangle" height={160} />
315
315
  <Skeleton variant="text" lines={2} />
316
316
  <Skeleton variant="text" width="40%" />
317
317
  </div>
318
- </Card>`},{title:"Static (no animation)",code:'<Skeleton variant="rectangle" width={200} height={32} animate={false} />'}],compositionGraph:[],accessibility:{ariaAttributes:["aria-busy","aria-label"],notes:'Wrap loading regions with aria-busy="true" on the container so screen readers know content is loading. Individual Skeleton elements are presentational and do not need ARIA attributes themselves.'}};function Hr({items:t,separator:r="/",style:n}){return e.jsx("nav",{"aria-label":"Breadcrumb",style:n,children:e.jsx("ol",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--lucent-space-1)",listStyle:"none",margin:0,padding:0,fontFamily:"var(--lucent-font-family-base)"},children:t.map((o,a)=>{const i=a===t.length-1;return e.jsxs("li",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[i?e.jsx(C.Text,{size:"sm",color:"primary",as:"span","aria-current":"page",children:o.label}):o.href!=null?e.jsx("a",{href:o.href,onClick:o.onClick,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",textDecoration:"none",fontFamily:"var(--lucent-font-family-base)",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--lucent-text-secondary)"},children:o.label}):e.jsx("button",{onClick:o.onClick,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",background:"none",border:"none",padding:0,cursor:"pointer",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--lucent-text-secondary)"},children:o.label}),!i&&e.jsx("span",{"aria-hidden":!0,style:{color:"var(--lucent-text-disabled)",fontSize:"var(--lucent-font-size-sm)",userSelect:"none"},children:r})]},a)})})})}const Ge=80,dt=180,te="var(--lucent-easing-default)",ze="var(--lucent-duration-fast)",Ue=`height ${dt}ms ${te}`,Gr=`
318
+ </Card>`},{title:"Static (no animation)",code:'<Skeleton variant="rectangle" width={200} height={32} animate={false} />'}],compositionGraph:[],accessibility:{ariaAttributes:["aria-busy","aria-label"],notes:'Wrap loading regions with aria-busy="true" on the container so screen readers know content is loading. Individual Skeleton elements are presentational and do not need ARIA attributes themselves.'}};function Hr({items:t,separator:r="/",style:n}){return e.jsx("nav",{"aria-label":"Breadcrumb",style:n,children:e.jsx("ol",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--lucent-space-1)",listStyle:"none",margin:0,padding:0,fontFamily:"var(--lucent-font-family-base)"},children:t.map((o,a)=>{const i=a===t.length-1;return e.jsxs("li",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[i?e.jsx(I.Text,{size:"sm",color:"primary",as:"span","aria-current":"page",children:o.label}):o.href!=null?e.jsx("a",{href:o.href,onClick:o.onClick,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",textDecoration:"none",fontFamily:"var(--lucent-font-family-base)",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--lucent-text-secondary)"},children:o.label}):e.jsx("button",{onClick:o.onClick,style:{fontSize:"var(--lucent-font-size-sm)",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",background:"none",border:"none",padding:0,cursor:"pointer",transition:"color var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--lucent-text-primary)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--lucent-text-secondary)"},children:o.label}),!i&&e.jsx("span",{"aria-hidden":!0,style:{color:"var(--lucent-text-disabled)",fontSize:"var(--lucent-font-size-sm)",userSelect:"none"},children:r})]},a)})})})}const Ge=80,dt=180,te="var(--lucent-easing-default)",ze="var(--lucent-duration-fast)",Ue=`height ${dt}ms ${te}`,Gr=`
319
319
  [data-lucent-collapsible-trigger]:hover:not(:disabled) {
320
320
  background: color-mix(in srgb, var(--lucent-text-primary) 5%, transparent) !important;
321
321
  }
@@ -325,7 +325,7 @@ const [results, setResults] = useState([]);
325
325
  [data-lucent-collapsible-trigger]:focus-visible {
326
326
  box-shadow: 0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default) !important;
327
327
  }
328
- `;let _e=!1;function Ur(){if(_e||typeof document>"u")return;const t=document.createElement("style");t.setAttribute("data-lucent-collapsible",""),t.textContent=Gr,document.head.appendChild(t),_e=!0}function _r({trigger:t,children:r,defaultOpen:n=!1,open:o,onOpenChange:a,padded:i=!0,disabled:l=!1,style:s}){const d=c.useContext(ye),f=d.px!=="0"||d.py!=="0",m=o!==void 0,[p,k]=c.useState(n),x=m?o:p,g=c.useRef(null),h=c.useRef(!1),u=c.useRef();c.useEffect(Ur,[]),c.useEffect(()=>{h.current=!0},[]),c.useLayoutEffect(()=>{const w=g.current;if(w)if(x){w.style.overflow="hidden";const y=w.scrollHeight;w.style.height=`${y}px`,w.style.transition=Ue,clearTimeout(u.current),u.current=setTimeout(()=>{w.style.height="auto",w.style.overflow="visible",w.style.transition=""},dt+20)}else h.current&&(clearTimeout(u.current),w.style.overflow="hidden",w.style.transition="",w.style.height=`${w.scrollHeight}px`,w.getBoundingClientRect(),w.style.transition=Ue,w.style.height="0px")},[x]),c.useEffect(()=>{const w=g.current;w&&!x&&!h.current&&(w.style.height="0px")},[]),c.useEffect(()=>()=>clearTimeout(u.current),[]);const b=()=>{if(l)return;const w=!x;m||k(w),a==null||a(w)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",...f&&{margin:`calc(-1 * ${d.py}) calc(-1 * ${d.px})`},...s},children:[e.jsxs("button",{"data-lucent-collapsible-trigger":!0,onClick:b,disabled:l,"aria-expanded":x,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",background:"none",border:"none",borderRadius:"var(--lucent-radius-md)",padding:"var(--lucent-space-4)",cursor:l?"not-allowed":"pointer",textAlign:"left",outline:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit",opacity:l?.5:1,transition:`background ${ze} ${te}`},children:[e.jsx("span",{style:{flex:1},children:t}),e.jsx(Yr,{open:x})]}),e.jsx("div",{ref:g,"aria-hidden":!x,style:{overflow:x?"visible":"hidden"},children:e.jsx("div",{style:{...i?{padding:"var(--lucent-space-3) var(--lucent-space-4) var(--lucent-space-4)"}:{},opacity:x?1:0,transform:x?"translateY(0)":"translateY(-4px)",transition:`opacity ${Ge}ms ${te}, transform ${Ge}ms ${te}`},children:r})})]})}function Yr({open:t}){return e.jsx("svg",{"data-lucent-collapsible-chevron":!0,width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)",transform:t?"rotate(180deg)":"rotate(0deg)",transition:`transform ${ze} ${te}, color ${ze} ${te}`},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}const oe="lucent-pl-no-scrollbar",Kr=`.${oe}{scrollbar-width:none}.${oe}::-webkit-scrollbar{display:none}`;function pe(t){return typeof t=="number"?`${t}px`:t}function Xr({children:t,header:r,sidebar:n,sidebarWidth:o=240,headerHeight:a=48,sidebarCollapsed:i=!1,rightSidebar:l,rightSidebarWidth:s=240,rightSidebarCollapsed:d=!1,footer:f,footerHeight:m=28,chromeBackground:p="bgBase",mainStyle:k,style:x}){const g=pe(a),h=pe(o),u=pe(s),b=pe(m),y={bgBase:"var(--lucent-bg-base)",bgSubtle:"var(--lucent-bg-subtle)",surface:"var(--lucent-surface)",surfaceSecondary:"var(--lucent-surface-secondary)"}[p]??"var(--lucent-bg-base)";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",overflow:"hidden",background:y,fontFamily:"var(--lucent-font-family-base)",...x},children:[e.jsx("style",{children:Kr}),r!=null&&e.jsx("div",{style:{flexShrink:0,height:g,zIndex:10,background:y},children:r}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[n!=null&&e.jsx("div",{className:oe,style:{width:i?0:h,flexShrink:0,overflow:"hidden",overflowY:i?"hidden":"auto",background:y,transition:"width 200ms var(--lucent-easing-default)"},children:n}),e.jsx("main",{className:oe,style:{flex:1,overflowY:"auto",minWidth:0,margin:l!=null?"0 0 var(--lucent-space-3) 0":"0 var(--lucent-space-3) var(--lucent-space-3) 0",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"var(--lucent-shadow-sm)",background:"var(--lucent-surface)",...k},children:t}),l!=null&&e.jsx("aside",{className:oe,style:{width:d?0:u,flexShrink:0,overflow:"hidden",overflowY:d?"hidden":"auto",background:y,transition:"width 200ms var(--lucent-easing-default)"},children:l})]}),f!=null&&e.jsx("div",{style:{flexShrink:0,height:b,zIndex:10,background:y},children:f})]})}function Jr({state:t}){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":!0,style:{flexShrink:0,opacity:t==="none"?.35:1},children:[e.jsx("path",{d:"M6 2L9 5H3L6 2Z",fill:"currentColor",opacity:t==="desc"?.35:1}),e.jsx("path",{d:"M6 10L3 7H9L6 10Z",fill:"currentColor",opacity:t==="asc"?.35:1})]})}function Ye({dir:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:t==="left"?"M10 12L6 8l4-4":"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Zr({columns:t,rows:r,pageSize:n=10,page:o,onPageChange:a,onFilterChange:i,emptyState:l,style:s}){const[d,f]=c.useState(null),[m,p]=c.useState(0),[k,x]=c.useState(null),[g,h]=c.useState({}),u=o!==void 0,b=u?o:m,w=t.some(j=>j.filterable),y=w?r.filter(j=>t.every(P=>{if(!P.filterable)return!0;const D=g[P.key];if(!D||D.length===0)return!0;const W=String(j[P.key]??"");return D.includes(W)})):r,S=d?[...y].sort((j,P)=>{const D=j[d.key],W=P[d.key],q=String(D??"").localeCompare(String(W??""),void 0,{numeric:!0});return d.dir==="asc"?q:-q}):y,I=n>0?S.slice(b*n,(b+1)*n):S,v=n>0?Math.max(1,Math.ceil(S.length/n)):1,A=j=>{u||p(j),a==null||a(j)},T=j=>{f(P=>!P||P.key!==j?{key:j,dir:"asc"}:P.dir==="asc"?{key:j,dir:"desc"}:null),u||p(0),a==null||a(0)},z=(j,P)=>{const D={...g,[j]:P};P.length===0&&delete D[j],h(D),u||p(0),a==null||a(0),i==null||i(D)},F=()=>{h({}),u||p(0),a==null||a(0),i==null||i({})},R=[];if(v<=7)for(let j=0;j<v;j++)R.push(j);else{R.push(0),b>2&&R.push("…");for(let j=Math.max(1,b-1);j<=Math.min(v-2,b+1);j++)R.push(j);b<v-3&&R.push("…"),R.push(v-1)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-3)",...s},children:[w&&e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsx(Qr,{columns:t,rows:r,filters:g,onFilter:z,onClearAll:F})}),e.jsx("div",{style:{overflowX:"auto",borderRadius:"var(--lucent-radius-lg)",border:"1px solid var(--lucent-border-default)"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--lucent-border-default)"},children:t.map(j=>{const P=(d==null?void 0:d.key)===j.key?d.dir:"none";return e.jsx("th",{onClick:j.sortable?()=>T(j.key):void 0,style:{padding:"var(--lucent-space-3) var(--lucent-space-4)",textAlign:j.align??"left",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",borderBottom:"1px solid var(--lucent-border-default)",cursor:j.sortable?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",...j.width?{width:j.width}:{}},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[j.header,j.sortable&&e.jsx(Jr,{state:P}),j.headerFilter&&e.jsx("span",{onClick:D=>D.stopPropagation(),style:{display:"inline-flex",marginLeft:"var(--lucent-space-1)"},children:j.headerFilter})]})},j.key)})})}),e.jsx("tbody",{children:I.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,style:{padding:"var(--lucent-space-12)",textAlign:"center"},children:l??e.jsx(C.Text,{color:"secondary",children:"No data"})})}):I.map((j,P)=>e.jsx("tr",{onMouseEnter:()=>x(P),onMouseLeave:()=>x(null),style:{borderBottom:P<I.length-1?"1px solid var(--lucent-border-subtle)":"none",background:k===P?"color-mix(in srgb, var(--lucent-text-primary) 4%, transparent)":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:t.map(D=>e.jsx("td",{style:{padding:"var(--lucent-space-3) var(--lucent-space-4)",color:"var(--lucent-text-primary)",textAlign:D.align??"left",verticalAlign:"middle"},children:D.render?D.render(j,P):String(j[D.key]??"")},D.key))},P))})]})}),n>0&&S.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--lucent-space-3)",flexWrap:"wrap"},children:[e.jsx(C.Text,{color:"secondary",size:"sm",children:S.length===0?`0 rows${r.length>0?` (filtered from ${r.length})`:""}`:S.length===1?`1 row${S.length<r.length?` (filtered from ${r.length})`:""}`:`${b*n+1}–${Math.min((b+1)*n,S.length)} of ${S.length} rows${S.length<r.length?` (filtered from ${r.length})`:""}`}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[e.jsx(ke,{onClick:()=>A(b-1),disabled:b===0,"aria-label":"Previous page",children:e.jsx(Ye,{dir:"left"})}),R.map((j,P)=>j==="…"?e.jsx("span",{style:{padding:"0 var(--lucent-space-1)",color:"var(--lucent-text-disabled)",fontSize:"var(--lucent-font-size-sm)"},children:"…"},`ellipsis-${P}`):e.jsx(ke,{onClick:()=>A(j),active:j===b,"aria-label":`Page ${j+1}`,"aria-current":j===b?"page":void 0,children:j+1},j)),e.jsx(ke,{onClick:()=>A(b+1),disabled:b>=v-1,"aria-label":"Next page",children:e.jsx(Ye,{dir:"right"})})]})]})]})}function Qr({columns:t,rows:r,filters:n,onFilter:o,onClearAll:a}){const i=t.filter(s=>s.filterable),l=Object.keys(n).length;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",flexWrap:"wrap"},children:[i.map(s=>{const d=Array.from(new Set(r.map(f=>String(f[s.key]??"")))).sort();return e.jsx(ea,{label:s.header,values:d,value:n[s.key]??[],onChange:f=>o(s.key,f)},s.key)}),l>0&&e.jsx("button",{onClick:a,style:{display:"inline-flex",alignItems:"center",height:30,padding:"0 var(--lucent-space-2)",border:"none",borderRadius:"var(--lucent-radius-md)",background:"transparent",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer"},children:"Clear all"})]})}function ea({label:t,values:r,value:n,onChange:o}){const[a,i]=c.useState(!1),[l,s]=c.useState(!1),[d,f]=c.useState(""),m=c.useRef(null),p=c.useRef(null),k=n.length>0;c.useEffect(()=>{if(!a){f("");return}setTimeout(()=>{var w;return(w=p.current)==null?void 0:w.focus()},0);const u=w=>{m.current&&!m.current.contains(w.target)&&i(!1)},b=w=>{w.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",b)}},[a]);const x=d?r.filter(u=>u.toLowerCase().includes(d.toLowerCase())):r,g=u=>o(n.includes(u)?n.filter(b=>b!==u):[...n,u]),h=n.length===0?null:n.length===1?e.jsxs("span",{style:{color:"var(--lucent-text-secondary)",fontWeight:"var(--lucent-font-weight-regular)"},children:[": ",n[0]]}):e.jsxs("span",{style:{color:"var(--lucent-accent-default)"},children:["(",n.length,")"]});return e.jsxs("div",{ref:m,style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>i(u=>!u),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",height:30,padding:"0 var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:`1px solid ${k?"var(--lucent-accent-default)":l?"var(--lucent-border-strong)":"var(--lucent-border-default)"}`,background:k?"var(--lucent-accent-subtle)":"var(--lucent-surface)",color:k?"var(--lucent-accent-default)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:k?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:"pointer",outline:"none",whiteSpace:"nowrap",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:[t,h,e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,style:{transform:a?"rotate(180deg)":"none",transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default)"},children:e.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),a&&e.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,maxHeight:280,display:"flex",flexDirection:"column",background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 4px 16px color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",zIndex:50},children:[e.jsx("div",{style:{padding:"var(--lucent-space-2)",paddingBottom:0},children:e.jsx("input",{ref:p,type:"text",value:d,onChange:u=>f(u.target.value),placeholder:"Search…",style:{width:"100%",boxSizing:"border-box",height:26,padding:"0 var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",border:"1px solid var(--lucent-border-default)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",color:"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",outline:"none"}})}),n.length>0&&e.jsx("div",{style:{padding:"var(--lucent-space-1) var(--lucent-space-2) 0"},children:e.jsx("button",{onClick:()=>o([]),style:{display:"inline-flex",padding:"2px var(--lucent-space-2)",border:"none",borderRadius:"var(--lucent-radius-sm)",background:"transparent",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer",textDecoration:"underline"},children:"Clear selection"})}),e.jsx("div",{style:{overflowY:"auto",padding:"var(--lucent-space-1)",borderTop:"1px solid var(--lucent-border-subtle)",marginTop:"var(--lucent-space-2)"},children:x.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-3)",color:"var(--lucent-text-disabled)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",textAlign:"center"},children:"No results"}):x.map(u=>e.jsx(ta,{label:u,isSelected:n.includes(u),onClick:()=>g(u)},u))})]})]})}function ta({label:t,isSelected:r,onClick:n}){const[o,a]=c.useState(!1);return e.jsxs("button",{onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",width:"100%",textAlign:"left",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:"none",background:o?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:r?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:"pointer",outline:"none",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{flexShrink:0,width:14,height:14,borderRadius:"var(--lucent-radius-sm)",border:`1.5px solid ${r?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:r?"var(--lucent-accent-default)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"border-color var(--lucent-duration-fast), background var(--lucent-duration-fast)"},children:r&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M1 4L3 6L7 2",stroke:"var(--lucent-accent-fg)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t]})}function ke({children:t,onClick:r,disabled:n,active:o,...a}){const[i,l]=c.useState(!1);return e.jsx("button",{...a,onClick:r,disabled:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,height:32,padding:"0 var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",border:o?"1px solid var(--lucent-accent-default)":"1px solid transparent",background:o?"var(--lucent-accent-default)":i&&!n?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:o?"var(--lucent-accent-fg)":n?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontSize:"var(--lucent-font-size-sm)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-regular)",cursor:n?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:t})}const na={id:"data-table",name:"DataTable",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A sortable, filterable, paginated data table with configurable columns, custom cell renderers, and keyboard-accessible pagination controls.",designIntent:'DataTable is generic over row type T so TypeScript consumers get full type safety on column keys and renderers. Sorting is client-side and composable — each column opts in via sortable:true; clicking a sorted column cycles asc → desc → unsorted. Filtering is per-column — each column opts in via filterable:true, which adds a dropdown button above the table. Each dropdown is searchable and multi-select: a search input filters the option list, and each option is a checkbox that toggles membership in the active set. Filtering uses set-membership: a row passes if its column value is included in the selected values array. A "Clear selection" link inside each dropdown clears that column; a "Clear all" button in the bar appears when any filter is active. Filter → sort → paginate is the fixed pipeline order; any filter change resets the page to 0. Pagination is either controlled (page prop + onPageChange) or uncontrolled (internal state). A pageSize of 0 disables pagination entirely, useful when the parent manages windowing. Row hover uses bg-subtle, not a border change, so the visual weight stays low for dense data views.',props:[{name:"columns",type:"array",required:!0,description:"Column definitions. Each column has a key, header, optional render function, optional sortable flag, optional filterable flag (renders a text filter input below the header), optional width, and optional text align."},{name:"rows",type:"array",required:!0,description:"Array of data objects to display. The generic type T is inferred from this prop."},{name:"pageSize",type:"number",required:!1,default:"10",description:"Number of rows per page. Set to 0 to disable pagination."},{name:"page",type:"number",required:!1,description:"Controlled current page (0-indexed). When provided, the component is fully controlled."},{name:"onPageChange",type:"function",required:!1,description:"Called with the new page index whenever the page changes (from pagination controls or after a sort/filter reset)."},{name:"onFilterChange",type:"function",required:!1,description:"Called with the current filter map (Record<string, string[]>) whenever any column filter changes. Keys are column keys; columns with no selection are omitted from the map."},{name:"emptyState",type:"ReactNode",required:!1,description:'Content to render when rows is empty. Defaults to a "No data" text.'},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic sortable table",code:`<DataTable
328
+ `;let _e=!1;function Ur(){if(_e||typeof document>"u")return;const t=document.createElement("style");t.setAttribute("data-lucent-collapsible",""),t.textContent=Gr,document.head.appendChild(t),_e=!0}function _r({trigger:t,children:r,defaultOpen:n=!1,open:o,onOpenChange:a,padded:i=!0,disabled:s=!1,style:l}){const d=c.useContext(ye),p=d.px!=="0"||d.py!=="0",m=o!==void 0,[f,w]=c.useState(n),y=m?o:f,g=c.useRef(null),h=c.useRef(!1),u=c.useRef();c.useEffect(Ur,[]),c.useEffect(()=>{h.current=!0},[]),c.useLayoutEffect(()=>{const x=g.current;if(x)if(y){x.style.overflow="hidden";const k=x.scrollHeight;x.style.height=`${k}px`,x.style.transition=Ue,clearTimeout(u.current),u.current=setTimeout(()=>{x.style.height="auto",x.style.overflow="visible",x.style.transition=""},dt+20)}else h.current&&(clearTimeout(u.current),x.style.overflow="hidden",x.style.transition="",x.style.height=`${x.scrollHeight}px`,x.getBoundingClientRect(),x.style.transition=Ue,x.style.height="0px")},[y]),c.useEffect(()=>{const x=g.current;x&&!y&&!h.current&&(x.style.height="0px")},[]),c.useEffect(()=>()=>clearTimeout(u.current),[]);const b=()=>{if(s)return;const x=!y;m||w(x),a==null||a(x)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",...p&&{margin:`calc(-1 * ${d.py}) calc(-1 * ${d.px})`},...l},children:[e.jsxs("button",{"data-lucent-collapsible-trigger":!0,onClick:b,disabled:s,"aria-expanded":y,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",background:"none",border:"none",borderRadius:"var(--lucent-radius-md)",padding:"var(--lucent-space-4)",cursor:s?"not-allowed":"pointer",textAlign:"left",outline:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit",opacity:s?.5:1,transition:`background ${ze} ${te}`},children:[e.jsx("span",{style:{flex:1},children:t}),e.jsx(Yr,{open:y})]}),e.jsx("div",{ref:g,"aria-hidden":!y,style:{overflow:y?"visible":"hidden"},children:e.jsx("div",{style:{...i?{padding:"var(--lucent-space-3) var(--lucent-space-4) var(--lucent-space-4)"}:{},opacity:y?1:0,transform:y?"translateY(0)":"translateY(-4px)",transition:`opacity ${Ge}ms ${te}, transform ${Ge}ms ${te}`},children:r})})]})}function Yr({open:t}){return e.jsx("svg",{"data-lucent-collapsible-chevron":!0,width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)",transform:t?"rotate(180deg)":"rotate(0deg)",transition:`transform ${ze} ${te}, color ${ze} ${te}`},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}const oe="lucent-pl-no-scrollbar",Kr=`.${oe}{scrollbar-width:none}.${oe}::-webkit-scrollbar{display:none}`;function pe(t){return typeof t=="number"?`${t}px`:t}function Xr({children:t,header:r,sidebar:n,sidebarWidth:o=240,headerHeight:a=48,sidebarCollapsed:i=!1,rightSidebar:s,rightSidebarWidth:l=240,rightSidebarCollapsed:d=!1,footer:p,footerHeight:m=28,chromeBackground:f="bgBase",mainStyle:w,style:y}){const g=pe(a),h=pe(o),u=pe(l),b=pe(m),k={bgBase:"var(--lucent-bg-base)",bgSubtle:"var(--lucent-bg-subtle)",surface:"var(--lucent-surface)",surfaceSecondary:"var(--lucent-surface-secondary)"}[f]??"var(--lucent-bg-base)";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",overflow:"hidden",background:k,fontFamily:"var(--lucent-font-family-base)",...y},children:[e.jsx("style",{children:Kr}),r!=null&&e.jsx("div",{style:{flexShrink:0,height:g,zIndex:10,background:k},children:r}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[n!=null&&e.jsx("div",{className:oe,style:{width:i?0:h,flexShrink:0,overflow:"hidden",overflowY:i?"hidden":"auto",background:k,transition:"width 200ms var(--lucent-easing-default)"},children:n}),e.jsx("main",{className:oe,style:{flex:1,overflowY:"auto",minWidth:0,margin:s!=null?"0 0 var(--lucent-space-3) 0":"0 var(--lucent-space-3) var(--lucent-space-3) 0",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"var(--lucent-shadow-sm)",background:"var(--lucent-surface)",...w},children:t}),s!=null&&e.jsx("aside",{className:oe,style:{width:d?0:u,flexShrink:0,overflow:"hidden",overflowY:d?"hidden":"auto",background:k,transition:"width 200ms var(--lucent-easing-default)"},children:s})]}),p!=null&&e.jsx("div",{style:{flexShrink:0,height:b,zIndex:10,background:k},children:p})]})}function Jr({state:t}){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":!0,style:{flexShrink:0,opacity:t==="none"?.35:1},children:[e.jsx("path",{d:"M6 2L9 5H3L6 2Z",fill:"currentColor",opacity:t==="desc"?.35:1}),e.jsx("path",{d:"M6 10L3 7H9L6 10Z",fill:"currentColor",opacity:t==="asc"?.35:1})]})}function Ye({dir:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:t==="left"?"M10 12L6 8l4-4":"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Zr({columns:t,rows:r,pageSize:n=10,page:o,onPageChange:a,onFilterChange:i,emptyState:s,style:l}){const[d,p]=c.useState(null),[m,f]=c.useState(0),[w,y]=c.useState(null),[g,h]=c.useState({}),u=o!==void 0,b=u?o:m,x=t.some(j=>j.filterable),k=x?r.filter(j=>t.every(P=>{if(!P.filterable)return!0;const D=g[P.key];if(!D||D.length===0)return!0;const W=String(j[P.key]??"");return D.includes(W)})):r,S=d?[...k].sort((j,P)=>{const D=j[d.key],W=P[d.key],q=String(D??"").localeCompare(String(W??""),void 0,{numeric:!0});return d.dir==="asc"?q:-q}):k,C=n>0?S.slice(b*n,(b+1)*n):S,v=n>0?Math.max(1,Math.ceil(S.length/n)):1,z=j=>{u||f(j),a==null||a(j)},T=j=>{p(P=>!P||P.key!==j?{key:j,dir:"asc"}:P.dir==="asc"?{key:j,dir:"desc"}:null),u||f(0),a==null||a(0)},E=(j,P)=>{const D={...g,[j]:P};P.length===0&&delete D[j],h(D),u||f(0),a==null||a(0),i==null||i(D)},F=()=>{h({}),u||f(0),a==null||a(0),i==null||i({})},R=[];if(v<=7)for(let j=0;j<v;j++)R.push(j);else{R.push(0),b>2&&R.push("…");for(let j=Math.max(1,b-1);j<=Math.min(v-2,b+1);j++)R.push(j);b<v-3&&R.push("…"),R.push(v-1)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-3)",...l},children:[x&&e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsx(Qr,{columns:t,rows:r,filters:g,onFilter:E,onClearAll:F})}),e.jsx("div",{style:{overflowX:"auto",borderRadius:"var(--lucent-radius-lg)",border:"1px solid var(--lucent-border-default)"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--lucent-border-default)"},children:t.map(j=>{const P=(d==null?void 0:d.key)===j.key?d.dir:"none";return e.jsx("th",{onClick:j.sortable?()=>T(j.key):void 0,style:{padding:"var(--lucent-space-3) var(--lucent-space-4)",textAlign:j.align??"left",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",borderBottom:"1px solid var(--lucent-border-default)",cursor:j.sortable?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",...j.width?{width:j.width}:{}},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[j.header,j.sortable&&e.jsx(Jr,{state:P}),j.headerFilter&&e.jsx("span",{onClick:D=>D.stopPropagation(),style:{display:"inline-flex",marginLeft:"var(--lucent-space-1)"},children:j.headerFilter})]})},j.key)})})}),e.jsx("tbody",{children:C.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,style:{padding:"var(--lucent-space-12)",textAlign:"center"},children:s??e.jsx(I.Text,{color:"secondary",children:"No data"})})}):C.map((j,P)=>e.jsx("tr",{onMouseEnter:()=>y(P),onMouseLeave:()=>y(null),style:{borderBottom:P<C.length-1?"1px solid var(--lucent-border-subtle)":"none",background:w===P?"color-mix(in srgb, var(--lucent-text-primary) 4%, transparent)":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:t.map(D=>e.jsx("td",{style:{padding:"var(--lucent-space-3) var(--lucent-space-4)",color:"var(--lucent-text-primary)",textAlign:D.align??"left",verticalAlign:"middle"},children:D.render?D.render(j,P):String(j[D.key]??"")},D.key))},P))})]})}),n>0&&S.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--lucent-space-3)",flexWrap:"wrap"},children:[e.jsx(I.Text,{color:"secondary",size:"sm",children:S.length===0?`0 rows${r.length>0?` (filtered from ${r.length})`:""}`:S.length===1?`1 row${S.length<r.length?` (filtered from ${r.length})`:""}`:`${b*n+1}–${Math.min((b+1)*n,S.length)} of ${S.length} rows${S.length<r.length?` (filtered from ${r.length})`:""}`}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[e.jsx(ke,{onClick:()=>z(b-1),disabled:b===0,"aria-label":"Previous page",children:e.jsx(Ye,{dir:"left"})}),R.map((j,P)=>j==="…"?e.jsx("span",{style:{padding:"0 var(--lucent-space-1)",color:"var(--lucent-text-disabled)",fontSize:"var(--lucent-font-size-sm)"},children:"…"},`ellipsis-${P}`):e.jsx(ke,{onClick:()=>z(j),active:j===b,"aria-label":`Page ${j+1}`,"aria-current":j===b?"page":void 0,children:j+1},j)),e.jsx(ke,{onClick:()=>z(b+1),disabled:b>=v-1,"aria-label":"Next page",children:e.jsx(Ye,{dir:"right"})})]})]})]})}function Qr({columns:t,rows:r,filters:n,onFilter:o,onClearAll:a}){const i=t.filter(l=>l.filterable),s=Object.keys(n).length;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",flexWrap:"wrap"},children:[i.map(l=>{const d=Array.from(new Set(r.map(p=>String(p[l.key]??"")))).sort();return e.jsx(ea,{label:l.header,values:d,value:n[l.key]??[],onChange:p=>o(l.key,p)},l.key)}),s>0&&e.jsx("button",{onClick:a,style:{display:"inline-flex",alignItems:"center",height:30,padding:"0 var(--lucent-space-2)",border:"none",borderRadius:"var(--lucent-radius-md)",background:"transparent",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer"},children:"Clear all"})]})}function ea({label:t,values:r,value:n,onChange:o}){const[a,i]=c.useState(!1),[s,l]=c.useState(!1),[d,p]=c.useState(""),m=c.useRef(null),f=c.useRef(null),w=n.length>0;c.useEffect(()=>{if(!a){p("");return}setTimeout(()=>{var x;return(x=f.current)==null?void 0:x.focus()},0);const u=x=>{m.current&&!m.current.contains(x.target)&&i(!1)},b=x=>{x.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",b)}},[a]);const y=d?r.filter(u=>u.toLowerCase().includes(d.toLowerCase())):r,g=u=>o(n.includes(u)?n.filter(b=>b!==u):[...n,u]),h=n.length===0?null:n.length===1?e.jsxs("span",{style:{color:"var(--lucent-text-secondary)",fontWeight:"var(--lucent-font-weight-regular)"},children:[": ",n[0]]}):e.jsxs("span",{style:{color:"var(--lucent-accent-default)"},children:["(",n.length,")"]});return e.jsxs("div",{ref:m,style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>i(u=>!u),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"inline-flex",alignItems:"center",gap:"var(--lucent-space-1)",height:30,padding:"0 var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:`1px solid ${w?"var(--lucent-accent-default)":s?"var(--lucent-border-strong)":"var(--lucent-border-default)"}`,background:w?"var(--lucent-accent-subtle)":"var(--lucent-surface)",color:w?"var(--lucent-accent-default)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:w?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:"pointer",outline:"none",whiteSpace:"nowrap",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:[t,h,e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,style:{transform:a?"rotate(180deg)":"none",transition:"transform var(--lucent-duration-fast) var(--lucent-easing-default)"},children:e.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),a&&e.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,maxHeight:280,display:"flex",flexDirection:"column",background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 4px 16px color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",zIndex:50},children:[e.jsx("div",{style:{padding:"var(--lucent-space-2)",paddingBottom:0},children:e.jsx("input",{ref:f,type:"text",value:d,onChange:u=>p(u.target.value),placeholder:"Search…",style:{width:"100%",boxSizing:"border-box",height:26,padding:"0 var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",border:"1px solid var(--lucent-border-default)",background:"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)",color:"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",outline:"none"}})}),n.length>0&&e.jsx("div",{style:{padding:"var(--lucent-space-1) var(--lucent-space-2) 0"},children:e.jsx("button",{onClick:()=>o([]),style:{display:"inline-flex",padding:"2px var(--lucent-space-2)",border:"none",borderRadius:"var(--lucent-radius-sm)",background:"transparent",color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",cursor:"pointer",textDecoration:"underline"},children:"Clear selection"})}),e.jsx("div",{style:{overflowY:"auto",padding:"var(--lucent-space-1)",borderTop:"1px solid var(--lucent-border-subtle)",marginTop:"var(--lucent-space-2)"},children:y.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-3)",color:"var(--lucent-text-disabled)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",textAlign:"center"},children:"No results"}):y.map(u=>e.jsx(ta,{label:u,isSelected:n.includes(u),onClick:()=>g(u)},u))})]})]})}function ta({label:t,isSelected:r,onClick:n}){const[o,a]=c.useState(!1);return e.jsxs("button",{onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",width:"100%",textAlign:"left",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:"none",background:o?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:r?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:"pointer",outline:"none",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{flexShrink:0,width:14,height:14,borderRadius:"var(--lucent-radius-sm)",border:`1.5px solid ${r?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:r?"var(--lucent-accent-default)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"border-color var(--lucent-duration-fast), background var(--lucent-duration-fast)"},children:r&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M1 4L3 6L7 2",stroke:"var(--lucent-accent-fg)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t]})}function ke({children:t,onClick:r,disabled:n,active:o,...a}){const[i,s]=c.useState(!1);return e.jsx("button",{...a,onClick:r,disabled:n,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,height:32,padding:"0 var(--lucent-space-2)",borderRadius:"var(--lucent-radius-md)",border:o?"1px solid var(--lucent-accent-default)":"1px solid transparent",background:o?"var(--lucent-accent-default)":i&&!n?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:o?"var(--lucent-accent-fg)":n?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontSize:"var(--lucent-font-size-sm)",fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-regular)",cursor:n?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:t})}const na={id:"data-table",name:"DataTable",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A sortable, filterable, paginated data table with configurable columns, custom cell renderers, and keyboard-accessible pagination controls.",designIntent:'DataTable is generic over row type T so TypeScript consumers get full type safety on column keys and renderers. Sorting is client-side and composable — each column opts in via sortable:true; clicking a sorted column cycles asc → desc → unsorted. Filtering is per-column — each column opts in via filterable:true, which adds a dropdown button above the table. Each dropdown is searchable and multi-select: a search input filters the option list, and each option is a checkbox that toggles membership in the active set. Filtering uses set-membership: a row passes if its column value is included in the selected values array. A "Clear selection" link inside each dropdown clears that column; a "Clear all" button in the bar appears when any filter is active. Filter → sort → paginate is the fixed pipeline order; any filter change resets the page to 0. Pagination is either controlled (page prop + onPageChange) or uncontrolled (internal state). A pageSize of 0 disables pagination entirely, useful when the parent manages windowing. Row hover uses bg-subtle, not a border change, so the visual weight stays low for dense data views.',props:[{name:"columns",type:"array",required:!0,description:"Column definitions. Each column has a key, header, optional render function, optional sortable flag, optional filterable flag (renders a text filter input below the header), optional width, and optional text align."},{name:"rows",type:"array",required:!0,description:"Array of data objects to display. The generic type T is inferred from this prop."},{name:"pageSize",type:"number",required:!1,default:"10",description:"Number of rows per page. Set to 0 to disable pagination."},{name:"page",type:"number",required:!1,description:"Controlled current page (0-indexed). When provided, the component is fully controlled."},{name:"onPageChange",type:"function",required:!1,description:"Called with the new page index whenever the page changes (from pagination controls or after a sort/filter reset)."},{name:"onFilterChange",type:"function",required:!1,description:"Called with the current filter map (Record<string, string[]>) whenever any column filter changes. Keys are column keys; columns with no selection are omitted from the map."},{name:"emptyState",type:"ReactNode",required:!1,description:'Content to render when rows is empty. Defaults to a "No data" text.'},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Basic sortable table",code:`<DataTable
329
329
  columns={[
330
330
  { key: 'name', header: 'Name', sortable: true },
331
331
  { key: 'role', header: 'Role', sortable: true },
@@ -352,7 +352,7 @@ const [results, setResults] = useState([]);
352
352
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
353
353
  to { opacity: 1; transform: scale(1) translateY(0); }
354
354
  }
355
- `;function aa(t,r){var o;const n=r.toLowerCase();return t.label.toLowerCase().includes(n)||(((o=t.description)==null?void 0:o.toLowerCase().includes(n))??!1)}function oa({commands:t,placeholder:r="Search commands…",shortcutKey:n="k",open:o,onOpenChange:a,style:i}){const l=o!==void 0,[s,d]=c.useState(!1),f=l?o:s,[m,p]=c.useState(""),[k,x]=c.useState(0),g=c.useRef(null),h=c.useRef(null),u=c.useRef(!1);if(!u.current){const T=document.createElement("style");T.textContent=ra,document.head.appendChild(T),u.current=!0}const b=c.useCallback(T=>{l||d(T),a==null||a(T)},[l,a]);c.useEffect(()=>{const T=z=>{(z.metaKey||z.ctrlKey)&&z.key===n&&(z.preventDefault(),b(!f))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[f,n,b]),c.useEffect(()=>{f&&(p(""),x(0),setTimeout(()=>{var T;return(T=g.current)==null?void 0:T.focus()},10))},[f]);const w=m?t.filter(T=>aa(T,m)):t,y=w.filter(T=>!T.disabled);c.useEffect(()=>{const T=h.current;if(!T)return;const z=T.querySelector('[data-active="true"]');z==null||z.scrollIntoView({block:"nearest"})},[k]);const S=T=>{T.disabled||(T.onSelect(),b(!1))},I=T=>{if(T.key==="Escape"){b(!1);return}if(T.key==="ArrowDown")T.preventDefault(),y.length>0&&x(z=>(z+1)%y.length);else if(T.key==="ArrowUp")T.preventDefault(),y.length>0&&x(z=>(z-1+y.length)%y.length);else if(T.key==="Enter"){const z=y[k];z&&S(z)}},v=[];for(const T of w){const z=v[v.length-1];z&&z.group===T.group?z.items.push(T):v.push({group:T.group,items:[T]})}if(!f)return null;let A=0;return e.jsx("div",{role:"dialog","aria-label":"Command palette","aria-modal":"true",onClick:()=>b(!1),style:{position:"fixed",inset:0,zIndex:9e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",background:"rgba(0, 0, 0, 0.15)",...i},children:e.jsxs("div",{role:"combobox","aria-haspopup":"listbox","aria-expanded":"true",onClick:T=>T.stopPropagation(),style:{width:"100%",maxWidth:560,margin:"0 var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",borderRadius:"var(--lucent-radius-xl)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-xl)",overflow:"hidden",animation:"lucent-palette-in 150ms var(--lucent-easing-decelerate)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",borderBottom:w.length>0?"1px solid var(--lucent-border-subtle)":"none"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)"},children:[e.jsx("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M10.5 10.5L13.5 13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e.jsx("input",{ref:g,role:"searchbox","aria-autocomplete":"list","aria-controls":"lucent-command-list",value:m,onChange:T=>{p(T.target.value),x(0)},onKeyDown:I,placeholder:r,style:{flex:1,border:"none",outline:"none",background:"transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",color:"var(--lucent-text-primary)",lineHeight:"var(--lucent-line-height-base)"}}),e.jsx(C.Button,{size:"xs",variant:"outline",tabIndex:-1,style:{pointerEvents:"none",flexShrink:0},children:"Esc"})]}),e.jsx("div",{id:"lucent-command-list",role:"listbox",ref:h,style:{maxHeight:360,overflowY:"auto",padding:"var(--lucent-space-1) var(--lucent-space-2)"},children:w.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-8)",textAlign:"center"},children:e.jsxs(C.Text,{color:"secondary",children:['No results for "',m,'"']})}):v.map(({group:T,items:z},F)=>e.jsxs("div",{children:[T&&e.jsx("div",{style:{padding:"var(--lucent-space-2) var(--lucent-space-2) var(--lucent-space-1)",...F>0?{borderTop:"1px solid var(--lucent-border-subtle)",marginTop:"var(--lucent-space-2)"}:{}},children:e.jsx(C.Text,{size:"xs",color:"secondary",weight:"medium",children:T})}),z.map(R=>{const j=R.disabled??!1;let P=!1;return j||(P=A===k,A++),e.jsxs("div",{role:"option","aria-selected":P,"aria-disabled":j,"data-active":P,onClick:()=>S(R),onMouseEnter:()=>{if(!j){const D=y.indexOf(R);D!==-1&&x(D)}},style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",cursor:j?"not-allowed":"pointer",background:P?"color-mix(in srgb, var(--lucent-accent-default) 20%, var(--lucent-surface-secondary))":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)",opacity:j?.5:1},children:[R.icon&&e.jsx("span",{style:{flexShrink:0,color:"var(--lucent-text-secondary)",display:"flex"},children:R.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(C.Text,{size:"sm",weight:"medium",truncate:!0,children:R.label}),R.description&&e.jsx(C.Text,{size:"xs",color:"secondary",truncate:!0,children:R.description})]})]},R.id)})]},F))}),e.jsx("div",{style:{display:"flex",gap:"var(--lucent-space-4)",padding:"var(--lucent-space-2) var(--lucent-space-4)",borderTop:"1px solid var(--lucent-border-subtle)",background:"var(--lucent-surface-secondary)"},children:[["↑↓","Navigate"],["↵","Select"],["Esc","Close"]].map(([T,z])=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[e.jsx(C.Button,{size:"xs",variant:"outline",tabIndex:-1,style:{pointerEvents:"none"},children:T}),e.jsx(C.Text,{size:"xs",color:"secondary",children:z})]},T))})]})})}const ia={id:"command-palette",name:"CommandPalette",tier:"overlay",domain:"neutral",specVersion:"1.0",description:"A keyboard-driven modal command palette with fuzzy search, grouped results, and a built-in ⌘K / Ctrl+K global shortcut.",designIntent:"CommandPalette renders as a portal-style overlay (fixed, full-viewport) with a centred panel that animates in with a subtle scale+fade. The ⌘K shortcut is registered as a global window listener so it works regardless of focus — consumers can override the key via shortcutKey prop. Clicking the backdrop dismisses the palette; Escape also closes it. Results are filtered client-side against label and description using simple substring match — no fuzzy library needed. Navigation is purely keyboard-driven: ↑↓ move the active index, Enter selects, mouse hover syncs the active index so mouse and keyboard stay in sync. Groups are derived from the group field on each CommandItem; the order of groups follows the order they first appear in the commands array. The component is controlled-or-uncontrolled: pass open + onOpenChange for controlled use, or omit both to use internal state.",props:[{name:"commands",type:"array",required:!0,description:"Array of CommandItem objects. Each has id, label, onSelect, and optional description, icon, group, disabled."},{name:"placeholder",type:"string",required:!1,default:'"Search commands…"',description:"Placeholder text for the search input."},{name:"shortcutKey",type:"string",required:!1,default:'"k"',description:'Key that opens the palette when pressed with Meta (Mac) or Ctrl (Windows). Defaults to "k" for ⌘K.'},{name:"open",type:"boolean",required:!1,description:"Controlled open state. When provided, the component is fully controlled."},{name:"onOpenChange",type:"function",required:!1,description:"Called when the palette requests an open/close state change."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the backdrop element."}],usageExamples:[{title:"Uncontrolled with ⌘K",code:`<CommandPalette
355
+ `;function aa(t,r){var o;const n=r.toLowerCase();return t.label.toLowerCase().includes(n)||(((o=t.description)==null?void 0:o.toLowerCase().includes(n))??!1)}function oa({commands:t,placeholder:r="Search commands…",shortcutKey:n="k",open:o,onOpenChange:a,style:i}){const s=o!==void 0,[l,d]=c.useState(!1),p=s?o:l,[m,f]=c.useState(""),[w,y]=c.useState(0),g=c.useRef(null),h=c.useRef(null),u=c.useRef(!1);if(!u.current){const T=document.createElement("style");T.textContent=ra,document.head.appendChild(T),u.current=!0}const b=c.useCallback(T=>{s||d(T),a==null||a(T)},[s,a]);c.useEffect(()=>{const T=E=>{(E.metaKey||E.ctrlKey)&&E.key===n&&(E.preventDefault(),b(!p))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[p,n,b]),c.useEffect(()=>{p&&(f(""),y(0),setTimeout(()=>{var T;return(T=g.current)==null?void 0:T.focus()},10))},[p]);const x=m?t.filter(T=>aa(T,m)):t,k=x.filter(T=>!T.disabled);c.useEffect(()=>{const T=h.current;if(!T)return;const E=T.querySelector('[data-active="true"]');E==null||E.scrollIntoView({block:"nearest"})},[w]);const S=T=>{T.disabled||(T.onSelect(),b(!1))},C=T=>{if(T.key==="Escape"){b(!1);return}if(T.key==="ArrowDown")T.preventDefault(),k.length>0&&y(E=>(E+1)%k.length);else if(T.key==="ArrowUp")T.preventDefault(),k.length>0&&y(E=>(E-1+k.length)%k.length);else if(T.key==="Enter"){const E=k[w];E&&S(E)}},v=[];for(const T of x){const E=v[v.length-1];E&&E.group===T.group?E.items.push(T):v.push({group:T.group,items:[T]})}if(!p)return null;let z=0;return e.jsx("div",{role:"dialog","aria-label":"Command palette","aria-modal":"true",onClick:()=>b(!1),style:{position:"fixed",inset:0,zIndex:9e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",background:"rgba(0, 0, 0, 0.15)",...i},children:e.jsxs("div",{role:"combobox","aria-haspopup":"listbox","aria-expanded":"true",onClick:T=>T.stopPropagation(),style:{width:"100%",maxWidth:560,margin:"0 var(--lucent-space-4)",background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",borderRadius:"var(--lucent-radius-xl)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-xl)",overflow:"hidden",animation:"lucent-palette-in 150ms var(--lucent-easing-decelerate)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",borderBottom:x.length>0?"1px solid var(--lucent-border-subtle)":"none"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)"},children:[e.jsx("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M10.5 10.5L13.5 13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e.jsx("input",{ref:g,role:"searchbox","aria-autocomplete":"list","aria-controls":"lucent-command-list",value:m,onChange:T=>{f(T.target.value),y(0)},onKeyDown:C,placeholder:r,style:{flex:1,border:"none",outline:"none",background:"transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-md)",color:"var(--lucent-text-primary)",lineHeight:"var(--lucent-line-height-base)"}}),e.jsx(I.Button,{size:"xs",variant:"outline",tabIndex:-1,style:{pointerEvents:"none",flexShrink:0},children:"Esc"})]}),e.jsx("div",{id:"lucent-command-list",role:"listbox",ref:h,style:{maxHeight:360,overflowY:"auto",padding:"var(--lucent-space-1) var(--lucent-space-2)"},children:x.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-8)",textAlign:"center"},children:e.jsxs(I.Text,{color:"secondary",children:['No results for "',m,'"']})}):v.map(({group:T,items:E},F)=>e.jsxs("div",{children:[T&&e.jsx("div",{style:{padding:"var(--lucent-space-2) var(--lucent-space-2) var(--lucent-space-1)",...F>0?{borderTop:"1px solid var(--lucent-border-subtle)",marginTop:"var(--lucent-space-2)"}:{}},children:e.jsx(I.Text,{size:"xs",color:"secondary",weight:"medium",children:T})}),E.map(R=>{const j=R.disabled??!1;let P=!1;return j||(P=z===w,z++),e.jsxs("div",{role:"option","aria-selected":P,"aria-disabled":j,"data-active":P,onClick:()=>S(R),onMouseEnter:()=>{if(!j){const D=k.indexOf(R);D!==-1&&y(D)}},style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",cursor:j?"not-allowed":"pointer",background:P?"color-mix(in srgb, var(--lucent-accent-default) 20%, var(--lucent-surface-secondary))":"transparent",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)",opacity:j?.5:1},children:[R.icon&&e.jsx("span",{style:{flexShrink:0,color:"var(--lucent-text-secondary)",display:"flex"},children:R.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(I.Text,{size:"sm",weight:"medium",truncate:!0,children:R.label}),R.description&&e.jsx(I.Text,{size:"xs",color:"secondary",truncate:!0,children:R.description})]})]},R.id)})]},F))}),e.jsx("div",{style:{display:"flex",gap:"var(--lucent-space-4)",padding:"var(--lucent-space-2) var(--lucent-space-4)",borderTop:"1px solid var(--lucent-border-subtle)",background:"var(--lucent-surface-secondary)"},children:[["↑↓","Navigate"],["↵","Select"],["Esc","Close"]].map(([T,E])=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-1)"},children:[e.jsx(I.Button,{size:"xs",variant:"outline",tabIndex:-1,style:{pointerEvents:"none"},children:T}),e.jsx(I.Text,{size:"xs",color:"secondary",children:E})]},T))})]})})}const ia={id:"command-palette",name:"CommandPalette",tier:"overlay",domain:"neutral",specVersion:"1.0",description:"A keyboard-driven modal command palette with fuzzy search, grouped results, and a built-in ⌘K / Ctrl+K global shortcut.",designIntent:"CommandPalette renders as a portal-style overlay (fixed, full-viewport) with a centred panel that animates in with a subtle scale+fade. The ⌘K shortcut is registered as a global window listener so it works regardless of focus — consumers can override the key via shortcutKey prop. Clicking the backdrop dismisses the palette; Escape also closes it. Results are filtered client-side against label and description using simple substring match — no fuzzy library needed. Navigation is purely keyboard-driven: ↑↓ move the active index, Enter selects, mouse hover syncs the active index so mouse and keyboard stay in sync. Groups are derived from the group field on each CommandItem; the order of groups follows the order they first appear in the commands array. The component is controlled-or-uncontrolled: pass open + onOpenChange for controlled use, or omit both to use internal state.",props:[{name:"commands",type:"array",required:!0,description:"Array of CommandItem objects. Each has id, label, onSelect, and optional description, icon, group, disabled."},{name:"placeholder",type:"string",required:!1,default:'"Search commands…"',description:"Placeholder text for the search input."},{name:"shortcutKey",type:"string",required:!1,default:'"k"',description:'Key that opens the palette when pressed with Meta (Mac) or Ctrl (Windows). Defaults to "k" for ⌘K.'},{name:"open",type:"boolean",required:!1,description:"Controlled open state. When provided, the component is fully controlled."},{name:"onOpenChange",type:"function",required:!1,description:"Called when the palette requests an open/close state change."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the backdrop element."}],usageExamples:[{title:"Uncontrolled with ⌘K",code:`<CommandPalette
356
356
  commands={[
357
357
  { id: 'new', label: 'New document', icon: <PlusIcon />, onSelect: () => router.push('/new') },
358
358
  { id: 'settings', label: 'Settings', description: 'Open app settings', onSelect: () => router.push('/settings') },
@@ -367,7 +367,7 @@ const [results, setResults] = useState([]);
367
367
  onOpenChange={setOpen}
368
368
  shortcutKey="p"
369
369
  />
370
- </>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Group labels, item labels, descriptions, and empty state",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-label","aria-modal","aria-expanded","aria-selected","aria-disabled","aria-controls","aria-autocomplete"],keyboardInteractions:["⌘K / Ctrl+K to open","↑↓ to navigate","Enter to select","Escape to close"],notes:'The backdrop and panel use role="dialog" with aria-modal="true". The input is role="searchbox". The result list is role="listbox" with role="option" items. Focus is moved to the search input on open.'}},sa={sm:"calc(var(--lucent-space-8) * 0.5 + 16px + 2px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px + 2px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px + 2px)"},la={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-lg)"},ca={sm:"var(--lucent-space-1) var(--lucent-space-2)",md:"var(--lucent-space-1) var(--lucent-space-2)",lg:"var(--lucent-space-2) var(--lucent-space-3)"},fe={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},Se={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ke={sm:"sm",md:"md",lg:"lg"},da={sm:"sm",md:"md",lg:"lg"};function ua({options:t,value:r,defaultValue:n=[],onChange:o,placeholder:a="Select…",disabled:i=!1,max:l,size:s="md",label:d,helperText:f,errorText:m,style:p}){const k=r!==void 0,[x,g]=c.useState(n),h=k?r:x,[u,b]=c.useState(!1),[w,y]=c.useState(""),[S,I]=c.useState(0),[v,A]=c.useState(!1),T=c.useRef(null),z=c.useRef(null),F=c.useRef(null),R=c.useRef(null),[j,P]=c.useState({top:0,left:0,width:0}),D=c.useId();c.useEffect(()=>{if(!u)return;const L=G=>{var U,Z;!((U=T.current)!=null&&U.contains(G.target))&&!((Z=R.current)!=null&&Z.contains(G.target))&&(b(!1),y(""))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[u]),c.useLayoutEffect(()=>{if(!u||!F.current)return;const L=F.current.getBoundingClientRect();P({top:L.bottom+4,left:L.left,width:L.width})},[u,h,w]);const W=L=>{const G=h.includes(L)?h.filter(U=>U!==L):l!==void 0&&h.length>=l?h:[...h,L];k||g(G),o==null||o(G)},q=L=>{const G=h.filter(U=>U!==L);k||g(G),o==null||o(G)},N=t.filter(L=>L.label.toLowerCase().includes(w.toLowerCase())),H=L=>{if(L.key==="Escape"){b(!1),y("");return}if(L.key==="ArrowDown"&&(L.preventDefault(),b(!0),I(G=>Math.min(G+1,N.length-1))),L.key==="ArrowUp"&&(L.preventDefault(),I(G=>Math.max(G-1,0))),L.key==="Enter"){L.preventDefault();const G=N[S];G&&!G.disabled&&W(G.value)}L.key==="Backspace"&&w===""&&h.length>0&&q(h[h.length-1])},E=l!==void 0&&h.length>=l,B=!!m,M=i?"var(--lucent-border-default)":B?"var(--lucent-danger-default)":v?"var(--lucent-accent-border)":"var(--lucent-border-default)",$=v?`0 0 0 3px ${B?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none",V=`lucent-multiselect-${c.useId()}`;return e.jsxs("div",{ref:T,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...p},children:[d&&e.jsx("label",{htmlFor:V,style:{fontSize:Se[s],fontWeight:"var(--lucent-font-weight-medium)",color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),e.jsxs("div",{ref:F,children:[e.jsxs("div",{onClick:()=>{var L;i||(b(!0),(L=z.current)==null||L.focus())},style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:fe[s],minHeight:sa[s],boxSizing:"border-box",padding:ca[s],borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${M}`,background:i?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",cursor:i?"not-allowed":"text",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)",boxShadow:$},children:[h.map(L=>{const G=t.find(U=>U.value===L);return G?e.jsx(se,{size:da[s],onDismiss:()=>q(L),disabled:i,children:G.label},L):null}),e.jsx("input",{id:V,ref:z,value:w,onChange:L=>{y(L.target.value),b(!0),I(0)},onKeyDown:H,onFocus:()=>A(!0),onBlur:()=>A(!1),disabled:i,placeholder:h.length===0?a:"","aria-autocomplete":"list","aria-controls":D,"aria-expanded":u,"aria-describedby":B?`${V}-error`:f?`${V}-helper`:void 0,role:"combobox",style:{flex:"1 1 80px",minWidth:80,border:"none",outline:"none",background:"transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:la[s],color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",cursor:i?"not-allowed":"text",padding:h.length===0?"2px 0 2px var(--lucent-space-1)":"2px 0"}})]}),u&&!i&&J.createPortal(e.jsxs("div",{ref:R,id:D,role:"listbox","aria-multiselectable":"true",style:{position:"fixed",top:j.top,left:j.left,width:j.width,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",maxHeight:240,overflowY:"auto",padding:fe[s]},children:[N.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-2)"},children:e.jsx(C.Text,{color:"secondary",size:Ke[s],children:"No options"})}):N.map((L,G)=>{const U=h.includes(L.value),Z=G===S,K=L.disabled??!1,O=E&&!U;return e.jsxs("div",{role:"option","aria-selected":U,"aria-disabled":K||O,onClick:()=>{!K&&!O&&W(L.value)},onMouseEnter:()=>I(G),style:{display:"flex",alignItems:"center",gap:fe[s],padding:fe[s],borderRadius:"var(--lucent-radius-md)",cursor:K||O?"not-allowed":"pointer",background:Z?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",opacity:K||O?.5:1},children:[e.jsx(be,{checked:U,disabled:K||O,size:s,style:{margin:0,pointerEvents:"none"},"aria-hidden":!0,readOnly:!0}),e.jsx(C.Text,{size:Ke[s],children:L.label})]},L.value)}),E&&e.jsx("div",{style:{padding:"var(--lucent-space-2)",borderTop:"1px solid var(--lucent-border-subtle)"},children:e.jsxs(C.Text,{size:s==="lg"?"sm":"xs",color:"secondary",children:["Max ",l," selected"]})})]}),document.body)]}),B&&e.jsx("span",{id:`${V}-error`,role:"alert",style:{fontSize:Se[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!B&&f&&e.jsx("span",{id:`${V}-helper`,style:{fontSize:Se[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:f})]})}const pa={id:"multi-select",name:"MultiSelect",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A tag-based multi-option selector with inline search, keyboard navigation, and an optional selection cap.",designIntent:"MultiSelect renders selected values as removable tags inside the trigger area, giving immediate visual feedback on what is selected. The search input sits inline with the tags so there is no separate search field to discover. Backspace with an empty query removes the last selected tag — a standard UX pattern in multi-select inputs. The max prop caps selection without disabling the entire component: unselected options beyond the cap are grayed out and show a hint. The dropdown closes on outside click, Escape, or when focus leaves. Checkbox indicators in the dropdown make the selected state scannable at a glance without relying solely on background color.",props:[{name:"options",type:"array",required:!0,description:"Array of { value, label, disabled? } option objects."},{name:"value",type:"array",required:!1,description:"Controlled array of selected values."},{name:"defaultValue",type:"array",required:!1,default:"[]",description:"Initial selected values for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the updated array of selected values on each change."},{name:"placeholder",type:"string",required:!1,default:'"Select…"',description:"Placeholder shown when nothing is selected."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables interaction and dims the component."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"max",type:"number",required:!1,description:"Maximum number of selectable options. Unselected options beyond the cap are grayed out."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:`<MultiSelect
370
+ </>`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Group labels, item labels, descriptions, and empty state",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-label","aria-modal","aria-expanded","aria-selected","aria-disabled","aria-controls","aria-autocomplete"],keyboardInteractions:["⌘K / Ctrl+K to open","↑↓ to navigate","Enter to select","Escape to close"],notes:'The backdrop and panel use role="dialog" with aria-modal="true". The input is role="searchbox". The result list is role="listbox" with role="option" items. Focus is moved to the search input on open.'}},sa={sm:"calc(var(--lucent-space-8) * 0.5 + 16px + 2px)",md:"calc(var(--lucent-space-10) * 0.5 + 20px + 2px)",lg:"calc(var(--lucent-space-12) * 0.5 + 24px + 2px)"},la={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-lg)"},ca={sm:"var(--lucent-space-1) var(--lucent-space-2)",md:"var(--lucent-space-1) var(--lucent-space-2)",lg:"var(--lucent-space-2) var(--lucent-space-3)"},fe={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},Se={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ke={sm:"sm",md:"md",lg:"lg"},da={sm:"sm",md:"md",lg:"lg"};function ua({options:t,value:r,defaultValue:n=[],onChange:o,placeholder:a="Select…",disabled:i=!1,max:s,size:l="md",label:d,helperText:p,errorText:m,style:f}){const w=r!==void 0,[y,g]=c.useState(n),h=w?r:y,[u,b]=c.useState(!1),[x,k]=c.useState(""),[S,C]=c.useState(0),[v,z]=c.useState(!1),T=c.useRef(null),E=c.useRef(null),F=c.useRef(null),R=c.useRef(null),[j,P]=c.useState({top:0,left:0,width:0}),D=c.useId();c.useEffect(()=>{if(!u)return;const L=G=>{var U,Z;!((U=T.current)!=null&&U.contains(G.target))&&!((Z=R.current)!=null&&Z.contains(G.target))&&(b(!1),k(""))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[u]),c.useLayoutEffect(()=>{if(!u||!F.current)return;const L=F.current.getBoundingClientRect();P({top:L.bottom+4,left:L.left,width:L.width})},[u,h,x]);const W=L=>{const G=h.includes(L)?h.filter(U=>U!==L):s!==void 0&&h.length>=s?h:[...h,L];w||g(G),o==null||o(G)},q=L=>{const G=h.filter(U=>U!==L);w||g(G),o==null||o(G)},N=t.filter(L=>L.label.toLowerCase().includes(x.toLowerCase())),H=L=>{if(L.key==="Escape"){b(!1),k("");return}if(L.key==="ArrowDown"&&(L.preventDefault(),b(!0),C(G=>Math.min(G+1,N.length-1))),L.key==="ArrowUp"&&(L.preventDefault(),C(G=>Math.max(G-1,0))),L.key==="Enter"){L.preventDefault();const G=N[S];G&&!G.disabled&&W(G.value)}L.key==="Backspace"&&x===""&&h.length>0&&q(h[h.length-1])},A=s!==void 0&&h.length>=s,B=!!m,M=i?"var(--lucent-border-default)":B?"var(--lucent-danger-default)":v?"var(--lucent-accent-border)":"var(--lucent-border-default)",$=v?`0 0 0 3px ${B?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none",V=`lucent-multiselect-${c.useId()}`;return e.jsxs("div",{ref:T,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...f},children:[d&&e.jsx("label",{htmlFor:V,style:{fontSize:Se[l],fontWeight:"var(--lucent-font-weight-medium)",color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),e.jsxs("div",{ref:F,children:[e.jsxs("div",{onClick:()=>{var L;i||(b(!0),(L=E.current)==null||L.focus())},style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:fe[l],minHeight:sa[l],boxSizing:"border-box",padding:ca[l],borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${M}`,background:i?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",cursor:i?"not-allowed":"text",transition:"border-color var(--lucent-duration-fast) var(--lucent-easing-default), box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)",boxShadow:$},children:[h.map(L=>{const G=t.find(U=>U.value===L);return G?e.jsx(se,{size:da[l],onDismiss:()=>q(L),disabled:i,children:G.label},L):null}),e.jsx("input",{id:V,ref:E,value:x,onChange:L=>{k(L.target.value),b(!0),C(0)},onKeyDown:H,onFocus:()=>z(!0),onBlur:()=>z(!1),disabled:i,placeholder:h.length===0?a:"","aria-autocomplete":"list","aria-controls":D,"aria-expanded":u,"aria-describedby":B?`${V}-error`:p?`${V}-helper`:void 0,role:"combobox",style:{flex:"1 1 80px",minWidth:80,border:"none",outline:"none",background:"transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:la[l],color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",cursor:i?"not-allowed":"text",padding:h.length===0?"2px 0 2px var(--lucent-space-1)":"2px 0"}})]}),u&&!i&&J.createPortal(e.jsxs("div",{ref:R,id:D,role:"listbox","aria-multiselectable":"true",style:{position:"fixed",top:j.top,left:j.left,width:j.width,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",maxHeight:240,overflowY:"auto",padding:fe[l]},children:[N.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-2)"},children:e.jsx(I.Text,{color:"secondary",size:Ke[l],children:"No options"})}):N.map((L,G)=>{const U=h.includes(L.value),Z=G===S,K=L.disabled??!1,O=A&&!U;return e.jsxs("div",{role:"option","aria-selected":U,"aria-disabled":K||O,onClick:()=>{!K&&!O&&W(L.value)},onMouseEnter:()=>C(G),style:{display:"flex",alignItems:"center",gap:fe[l],padding:fe[l],borderRadius:"var(--lucent-radius-md)",cursor:K||O?"not-allowed":"pointer",background:Z?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",opacity:K||O?.5:1},children:[e.jsx(be,{checked:U,disabled:K||O,size:l,style:{margin:0,pointerEvents:"none"},"aria-hidden":!0,readOnly:!0}),e.jsx(I.Text,{size:Ke[l],children:L.label})]},L.value)}),A&&e.jsx("div",{style:{padding:"var(--lucent-space-2)",borderTop:"1px solid var(--lucent-border-subtle)"},children:e.jsxs(I.Text,{size:l==="lg"?"sm":"xs",color:"secondary",children:["Max ",s," selected"]})})]}),document.body)]}),B&&e.jsx("span",{id:`${V}-error`,role:"alert",style:{fontSize:Se[l],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!B&&p&&e.jsx("span",{id:`${V}-helper`,style:{fontSize:Se[l],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p})]})}const pa={id:"multi-select",name:"MultiSelect",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A tag-based multi-option selector with inline search, keyboard navigation, and an optional selection cap.",designIntent:"MultiSelect renders selected values as removable tags inside the trigger area, giving immediate visual feedback on what is selected. The search input sits inline with the tags so there is no separate search field to discover. Backspace with an empty query removes the last selected tag — a standard UX pattern in multi-select inputs. The max prop caps selection without disabling the entire component: unselected options beyond the cap are grayed out and show a hint. The dropdown closes on outside click, Escape, or when focus leaves. Checkbox indicators in the dropdown make the selected state scannable at a glance without relying solely on background color.",props:[{name:"options",type:"array",required:!0,description:"Array of { value, label, disabled? } option objects."},{name:"value",type:"array",required:!1,description:"Controlled array of selected values."},{name:"defaultValue",type:"array",required:!1,default:"[]",description:"Initial selected values for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the updated array of selected values on each change."},{name:"placeholder",type:"string",required:!1,default:'"Select…"',description:"Placeholder shown when nothing is selected."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables interaction and dims the component."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"max",type:"number",required:!1,description:"Maximum number of selectable options. Unselected options beyond the cap are grayed out."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:`<MultiSelect
371
371
  options={[
372
372
  { value: 'react', label: 'React' },
373
373
  { value: 'vue', label: 'Vue' },
@@ -381,14 +381,14 @@ const [results, setResults] = useState([]);
381
381
  onChange={setTags}
382
382
  max={3}
383
383
  placeholder="Up to 3 tags"
384
- />`}],compositionGraph:[{componentId:"chip",componentName:"Chip",role:"Selected value chips with dismiss button",required:!0},{componentId:"checkbox",componentName:"Checkbox",role:"Selection indicator in dropdown options",required:!0},{componentId:"text",componentName:"Text",role:"Option labels, empty state, and max hint",required:!0}],accessibility:{role:"combobox",ariaAttributes:["aria-autocomplete","aria-controls","aria-expanded","aria-multiselectable","aria-selected","aria-disabled"],keyboardInteractions:["↑↓ to navigate options","Enter to toggle selection","Escape to close","Backspace to remove last tag"],notes:'The input carries role="combobox" with aria-expanded and aria-controls pointing to the listbox. Each option has role="option" with aria-selected. Remove buttons on tags have descriptive aria-label.'}};function fa(t,r){return new Date(t,r+1,0).getDate()}function ha(t,r){return new Date(t,r,1).getDay()}function ge(t,r){return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()}function ve(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())<new Date(r.getFullYear(),r.getMonth(),r.getDate())}function Xe(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())>new Date(r.getFullYear(),r.getMonth(),r.getDate())}const ma=["January","February","March","April","May","June","July","August","September","October","November","December"],ga=["Su","Mo","Tu","We","Th","Fr","Sa"];function ie(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}const va={sm:"calc(var(--lucent-space-8) * 0.5 + 18px)",md:"calc(var(--lucent-space-10) * 0.5 + 22px)",lg:"calc(var(--lucent-space-12) * 0.5 + 26px)"},ba={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Te={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},ya={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},xa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},wa={sm:28,md:32,lg:38},ka={sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Sa={sm:"xs",md:"sm",lg:"md"},Ta={sm:"xs",md:"xs",lg:"sm"},Ca={sm:24,md:28,lg:32},Ia={sm:14,md:16,lg:18},ut={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-5)"},Ee={sm:220,md:260,lg:300};function Je({dir:t,onClick:r,disabled:n,size:o="md"}){const[a,i]=c.useState(!1),l=Ca[o],s=Ia[o];return e.jsx("button",{type:"button",onClick:r,disabled:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-label":t==="prev"?"Previous month":"Next month",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:l,height:l,border:"none",borderRadius:"var(--lucent-radius-md)",background:a&&!n?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:n?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",cursor:n?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast)"},children:e.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:t==="prev"?"M10 12L6 8l4-4":"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Ae({year:t,month:r,selected:n,today:o,min:a,max:i,onSelect:l,onPrevMonth:s,onNextMonth:d,highlightRange:f,onDayHover:m,size:p="md"}){const k=fa(t,r),x=ha(t,r),[g,h]=c.useState(null),u=[...Array(x).fill(null),...Array.from({length:k},(b,w)=>w+1)];for(;u.length%7!==0;)u.push(null);return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--lucent-space-3)"},children:[e.jsx(Je,{dir:"prev",onClick:s,size:p}),e.jsxs(C.Text,{weight:"medium",size:Sa[p],children:[ma[r]," ",t]}),e.jsx(Je,{dir:"next",onClick:d,size:p})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:"var(--lucent-space-1)"},children:ga.map(b=>e.jsx("div",{style:{textAlign:"center"},children:e.jsx(C.Text,{size:Ta[p],color:"secondary",children:b})},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:u.map((b,w)=>{if(!b)return e.jsx("div",{},w);const y=new Date(t,r,b),S=n?ge(y,n):!1,I=ge(y,o),v=(a?ve(y,a):!1)||(i?Xe(y,i):!1);let A=!1;return f!=null&&f.start&&(f!=null&&f.end)&&(A=!ve(y,f.start)&&!Xe(y,f.end)),e.jsx("button",{type:"button",disabled:v,onClick:()=>!v&&l(y),onMouseEnter:()=>{h(b),m==null||m(y)},onMouseLeave:()=>{h(null),m==null||m(null)},"aria-label":ie(y),"aria-pressed":S,style:{display:"flex",alignItems:"center",justifyContent:"center",height:wa[p],width:"100%",border:I&&!S?"1px solid var(--lucent-border-strong)":"1px solid transparent",borderRadius:"var(--lucent-radius-md)",background:S?"var(--lucent-accent-default)":A?"var(--lucent-accent-subtle)":g===b&&!v?"color-mix(in srgb, var(--lucent-accent-default) 14%, transparent)":"transparent",color:S?"var(--lucent-accent-fg)":v?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontSize:ka[p],fontFamily:"var(--lucent-font-family-base)",fontWeight:I?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:v?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast)"},children:b},w)})})]})}function ja({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date",disabled:a=!1,min:i,max:l,size:s="md",label:d,helperText:f,errorText:m,style:p}){const k=t!==void 0,[x,g]=c.useState(r),h=k?t:x,u=!!m,b=a,w=`lucent-datepicker-${Math.random().toString(36).slice(2,7)}`,y=new Date,[S,I]=c.useState((h??y).getFullYear()),[v,A]=c.useState((h??y).getMonth()),[T,z]=c.useState(!1),[F,R]=c.useState(!1),j=c.useRef(null),P=c.useRef(null),[D,W]=c.useState({top:0,left:0});c.useEffect(()=>{if(!T)return;const M=$=>{var V,L;!((V=j.current)!=null&&V.contains($.target))&&!((L=P.current)!=null&&L.contains($.target))&&z(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[T]),c.useLayoutEffect(()=>{if(!T||!j.current)return;const M=j.current.getBoundingClientRect();W({top:M.bottom+4,left:M.left})},[T]);const q=M=>{k||g(M),n==null||n(M),z(!1)},N=()=>{v===0?(A(11),I(M=>M-1)):A(M=>M-1)},H=()=>{v===11?(A(0),I(M=>M+1)):A(M=>M+1)},E=b?"transparent":u?"var(--lucent-danger-default)":F?"var(--lucent-accent-border)":"var(--lucent-border-default)",B=F?`0 0 0 3px ${u?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none";return e.jsxs("div",{ref:j,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...p},children:[d&&e.jsx("label",{htmlFor:w,style:{fontSize:Te[s],fontWeight:"var(--lucent-font-weight-medium)",color:b?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),e.jsxs("button",{type:"button",id:w,disabled:a,onClick:()=>!a&&z(M=>!M),onFocus:()=>R(!0),onBlur:()=>R(!1),"aria-haspopup":"dialog","aria-expanded":T,"aria-invalid":u,style:{display:"flex",alignItems:"center",gap:xa[s],width:"100%",height:va[s],boxSizing:"border-box",padding:`0 ${ya[s]}`,borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${E}`,boxShadow:B,background:b?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",color:h?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:ba[s],cursor:b?"not-allowed":"pointer",outline:"none",transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", ")},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("rect",{x:"1",y:"2",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1 6h12",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M4 1v2M10 1v2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),e.jsx("span",{style:{flex:1,textAlign:"left"},children:h?ie(h):o})]}),u&&e.jsx("span",{role:"alert",style:{fontSize:Te[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!u&&f&&e.jsx("span",{style:{fontSize:Te[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:f}),T&&J.createPortal(e.jsx("div",{ref:P,role:"dialog","aria-label":"Date picker",style:{position:"fixed",top:D.top,left:D.left,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:ut[s],minWidth:Ee[s]},children:e.jsx(Ae,{year:S,month:v,...h!==void 0&&{selected:h},today:y,...i!==void 0&&{min:i},...l!==void 0&&{max:l},onSelect:q,onPrevMonth:N,onNextMonth:H,size:s})}),document.body)]})}const Ma={id:"date-picker",name:"DatePicker",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A single-date picker with a calendar popover, month navigation, today highlight, min/max constraints, and controlled or uncontrolled modes.",designIntent:`DatePicker deliberately avoids native <input type="date"> to guarantee consistent cross-browser appearance that matches the Lucent token system. The trigger button shows the selected date in YYYY-MM-DD format (ISO-sortable, unambiguous locale-wise) or a placeholder. The calendar popover renders as a role="dialog" and closes on outside click. Today is outlined rather than filled so it doesn't compete visually with the selected date. Disabled dates (outside min/max) are grayed out and non-interactive. The Calendar primitive is exported separately so DateRangePicker can compose two calendars side by side.`,props:[{name:"value",type:"object",required:!1,description:"Controlled selected Date. When provided the component is fully controlled."},{name:"defaultValue",type:"object",required:!1,description:"Initial selected Date for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the newly selected Date when the user picks a day."},{name:"placeholder",type:"string",required:!1,default:'"Pick a date"',description:"Trigger button text when no date is selected."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Label text rendered above the trigger, with size-aware font sizing matching Input/Select."},{name:"helperText",type:"string",required:!1,description:"Helper text rendered below the trigger. Hidden when errorText is present."},{name:"errorText",type:"string",required:!1,description:"Error text rendered below the trigger in danger color. Takes precedence over helperText."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the trigger button and all interaction."},{name:"min",type:"object",required:!1,description:"Earliest selectable Date. Days before this are grayed out."},{name:"max",type:"object",required:!1,description:"Latest selectable Date. Days after this are grayed out."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:"<DatePicker onChange={(d) => console.log(d)} />"},{title:"Controlled with constraints",code:`const [date, setDate] = useState<Date>();
384
+ />`}],compositionGraph:[{componentId:"chip",componentName:"Chip",role:"Selected value chips with dismiss button",required:!0},{componentId:"checkbox",componentName:"Checkbox",role:"Selection indicator in dropdown options",required:!0},{componentId:"text",componentName:"Text",role:"Option labels, empty state, and max hint",required:!0}],accessibility:{role:"combobox",ariaAttributes:["aria-autocomplete","aria-controls","aria-expanded","aria-multiselectable","aria-selected","aria-disabled"],keyboardInteractions:["↑↓ to navigate options","Enter to toggle selection","Escape to close","Backspace to remove last tag"],notes:'The input carries role="combobox" with aria-expanded and aria-controls pointing to the listbox. Each option has role="option" with aria-selected. Remove buttons on tags have descriptive aria-label.'}};function fa(t,r){return new Date(t,r+1,0).getDate()}function ha(t,r){return new Date(t,r,1).getDay()}function ge(t,r){return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()}function ve(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())<new Date(r.getFullYear(),r.getMonth(),r.getDate())}function Xe(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())>new Date(r.getFullYear(),r.getMonth(),r.getDate())}const ma=["January","February","March","April","May","June","July","August","September","October","November","December"],ga=["Su","Mo","Tu","We","Th","Fr","Sa"];function ie(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}const va={sm:"calc(var(--lucent-space-8) * 0.5 + 18px)",md:"calc(var(--lucent-space-10) * 0.5 + 22px)",lg:"calc(var(--lucent-space-12) * 0.5 + 26px)"},ba={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Te={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},ya={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},xa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},wa={sm:28,md:32,lg:38},ka={sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Sa={sm:"xs",md:"sm",lg:"md"},Ta={sm:"xs",md:"xs",lg:"sm"},Ca={sm:24,md:28,lg:32},Ia={sm:14,md:16,lg:18},ut={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-5)"},Ee={sm:220,md:260,lg:300};function Je({dir:t,onClick:r,disabled:n,size:o="md"}){const[a,i]=c.useState(!1),s=Ca[o],l=Ia[o];return e.jsx("button",{type:"button",onClick:r,disabled:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-label":t==="prev"?"Previous month":"Next month",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:s,height:s,border:"none",borderRadius:"var(--lucent-radius-md)",background:a&&!n?"color-mix(in srgb, var(--lucent-text-primary) 5%, transparent)":"transparent",color:n?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",cursor:n?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast)"},children:e.jsx("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:t==="prev"?"M10 12L6 8l4-4":"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Ae({year:t,month:r,selected:n,today:o,min:a,max:i,onSelect:s,onPrevMonth:l,onNextMonth:d,highlightRange:p,onDayHover:m,size:f="md"}){const w=fa(t,r),y=ha(t,r),[g,h]=c.useState(null),u=[...Array(y).fill(null),...Array.from({length:w},(b,x)=>x+1)];for(;u.length%7!==0;)u.push(null);return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--lucent-space-3)"},children:[e.jsx(Je,{dir:"prev",onClick:l,size:f}),e.jsxs(I.Text,{weight:"medium",size:Sa[f],children:[ma[r]," ",t]}),e.jsx(Je,{dir:"next",onClick:d,size:f})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:"var(--lucent-space-1)"},children:ga.map(b=>e.jsx("div",{style:{textAlign:"center"},children:e.jsx(I.Text,{size:Ta[f],color:"secondary",children:b})},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:u.map((b,x)=>{if(!b)return e.jsx("div",{},x);const k=new Date(t,r,b),S=n?ge(k,n):!1,C=ge(k,o),v=(a?ve(k,a):!1)||(i?Xe(k,i):!1);let z=!1;return p!=null&&p.start&&(p!=null&&p.end)&&(z=!ve(k,p.start)&&!Xe(k,p.end)),e.jsx("button",{type:"button",disabled:v,onClick:()=>!v&&s(k),onMouseEnter:()=>{h(b),m==null||m(k)},onMouseLeave:()=>{h(null),m==null||m(null)},"aria-label":ie(k),"aria-pressed":S,style:{display:"flex",alignItems:"center",justifyContent:"center",height:wa[f],width:"100%",border:C&&!S?"1px solid var(--lucent-border-strong)":"1px solid transparent",borderRadius:"var(--lucent-radius-md)",background:S?"var(--lucent-accent-default)":z?"var(--lucent-accent-subtle)":g===b&&!v?"color-mix(in srgb, var(--lucent-accent-default) 14%, transparent)":"transparent",color:S?"var(--lucent-accent-fg)":v?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontSize:ka[f],fontFamily:"var(--lucent-font-family-base)",fontWeight:C?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:v?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast)"},children:b},x)})})]})}function ja({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date",disabled:a=!1,min:i,max:s,size:l="md",label:d,helperText:p,errorText:m,style:f}){const w=t!==void 0,[y,g]=c.useState(r),h=w?t:y,u=!!m,b=a,x=`lucent-datepicker-${Math.random().toString(36).slice(2,7)}`,k=new Date,[S,C]=c.useState((h??k).getFullYear()),[v,z]=c.useState((h??k).getMonth()),[T,E]=c.useState(!1),[F,R]=c.useState(!1),j=c.useRef(null),P=c.useRef(null),[D,W]=c.useState({top:0,left:0});c.useEffect(()=>{if(!T)return;const M=$=>{var V,L;!((V=j.current)!=null&&V.contains($.target))&&!((L=P.current)!=null&&L.contains($.target))&&E(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[T]),c.useLayoutEffect(()=>{if(!T||!j.current)return;const M=j.current.getBoundingClientRect();W({top:M.bottom+4,left:M.left})},[T]);const q=M=>{w||g(M),n==null||n(M),E(!1)},N=()=>{v===0?(z(11),C(M=>M-1)):z(M=>M-1)},H=()=>{v===11?(z(0),C(M=>M+1)):z(M=>M+1)},A=b?"transparent":u?"var(--lucent-danger-default)":F?"var(--lucent-accent-border)":"var(--lucent-border-default)",B=F?`0 0 0 3px ${u?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none";return e.jsxs("div",{ref:j,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...f},children:[d&&e.jsx("label",{htmlFor:x,style:{fontSize:Te[l],fontWeight:"var(--lucent-font-weight-medium)",color:b?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),e.jsxs("button",{type:"button",id:x,disabled:a,onClick:()=>!a&&E(M=>!M),onFocus:()=>R(!0),onBlur:()=>R(!1),"aria-haspopup":"dialog","aria-expanded":T,"aria-invalid":u,style:{display:"flex",alignItems:"center",gap:xa[l],width:"100%",height:va[l],boxSizing:"border-box",padding:`0 ${ya[l]}`,borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${A}`,boxShadow:B,background:b?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",color:h?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:ba[l],cursor:b?"not-allowed":"pointer",outline:"none",transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", ")},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("rect",{x:"1",y:"2",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1 6h12",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M4 1v2M10 1v2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),e.jsx("span",{style:{flex:1,textAlign:"left"},children:h?ie(h):o})]}),u&&e.jsx("span",{role:"alert",style:{fontSize:Te[l],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!u&&p&&e.jsx("span",{style:{fontSize:Te[l],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p}),T&&J.createPortal(e.jsx("div",{ref:P,role:"dialog","aria-label":"Date picker",style:{position:"fixed",top:D.top,left:D.left,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:ut[l],minWidth:Ee[l]},children:e.jsx(Ae,{year:S,month:v,...h!==void 0&&{selected:h},today:k,...i!==void 0&&{min:i},...s!==void 0&&{max:s},onSelect:q,onPrevMonth:N,onNextMonth:H,size:l})}),document.body)]})}const Ma={id:"date-picker",name:"DatePicker",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A single-date picker with a calendar popover, month navigation, today highlight, min/max constraints, and controlled or uncontrolled modes.",designIntent:`DatePicker deliberately avoids native <input type="date"> to guarantee consistent cross-browser appearance that matches the Lucent token system. The trigger button shows the selected date in YYYY-MM-DD format (ISO-sortable, unambiguous locale-wise) or a placeholder. The calendar popover renders as a role="dialog" and closes on outside click. Today is outlined rather than filled so it doesn't compete visually with the selected date. Disabled dates (outside min/max) are grayed out and non-interactive. The Calendar primitive is exported separately so DateRangePicker can compose two calendars side by side.`,props:[{name:"value",type:"object",required:!1,description:"Controlled selected Date. When provided the component is fully controlled."},{name:"defaultValue",type:"object",required:!1,description:"Initial selected Date for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the newly selected Date when the user picks a day."},{name:"placeholder",type:"string",required:!1,default:'"Pick a date"',description:"Trigger button text when no date is selected."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Label text rendered above the trigger, with size-aware font sizing matching Input/Select."},{name:"helperText",type:"string",required:!1,description:"Helper text rendered below the trigger. Hidden when errorText is present."},{name:"errorText",type:"string",required:!1,description:"Error text rendered below the trigger in danger color. Takes precedence over helperText."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the trigger button and all interaction."},{name:"min",type:"object",required:!1,description:"Earliest selectable Date. Days before this are grayed out."},{name:"max",type:"object",required:!1,description:"Latest selectable Date. Days after this are grayed out."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:"<DatePicker onChange={(d) => console.log(d)} />"},{title:"Controlled with constraints",code:`const [date, setDate] = useState<Date>();
385
385
  <DatePicker
386
386
  value={date}
387
387
  onChange={setDate}
388
388
  min={new Date()}
389
389
  placeholder="Select a future date"
390
- />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Month/year header and weekday labels",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-haspopup","aria-expanded","aria-invalid","aria-label","aria-pressed"],keyboardInteractions:["Enter/Space to open calendar","Click day to select","Escape closes popover (click outside)"],notes:'The calendar popover is role="dialog". Each day button has aria-label with the full date and aria-pressed for selected state. Full arrow-key navigation within the calendar grid is a planned enhancement.'}},za={sm:"calc(var(--lucent-space-8) * 0.5 + 18px)",md:"calc(var(--lucent-space-10) * 0.5 + 22px)",lg:"calc(var(--lucent-space-12) * 0.5 + 26px)"},Ea={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Aa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},qa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},Ce={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"};function Da(t,r){return t?ge(t.start,t.end)?ie(t.start):`${ie(t.start)} → ${ie(t.end)}`:r}function pt({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date range",disabled:a=!1,min:i,max:l,size:s="md",label:d,helperText:f,errorText:m,trigger:p,style:k}){const x=t!==void 0,[g,h]=c.useState(r),u=x?t:g,b=!!m,w=a,y=`lucent-daterangepicker-${Math.random().toString(36).slice(2,7)}`,[S,I]=c.useState(null),[v,A]=c.useState(null),T=new Date,[z,F]=c.useState(((u==null?void 0:u.start)??T).getFullYear()),[R,j]=c.useState(((u==null?void 0:u.start)??T).getMonth()),P=R===11?0:R+1,D=R===11?z+1:z,[W,q]=c.useState(!1),[N,H]=c.useState(!1),E=c.useRef(null),B=c.useRef(null),[M,$]=c.useState({top:0,left:0});c.useEffect(()=>{if(!W)return;const O=Q=>{var ce,re;!((ce=E.current)!=null&&ce.contains(Q.target))&&!((re=B.current)!=null&&re.contains(Q.target))&&(q(!1),I(null))};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[W]),c.useLayoutEffect(()=>{if(!W||!E.current)return;const O=E.current.getBoundingClientRect();$({top:O.bottom+4,left:O.left})},[W]);const V=O=>{if(!S)I(O);else{const[Q,ce]=ve(O,S)||ge(O,S)?[O,S]:[S,O],re={start:Q,end:ce};x||h(re),n==null||n(re),I(null),q(!1)}},L=()=>{R===0?(j(11),F(O=>O-1)):j(O=>O-1)},G=()=>{R===11?(j(0),F(O=>O+1)):j(O=>O+1)};let U;if(S&&v){const[O,Q]=ve(v,S)?[v,S]:[S,v];U={start:O,end:Q}}else S?U={start:S,end:S}:u&&(U={start:u.start,end:u.end});const Z=w?"transparent":b?"var(--lucent-danger-default)":N?"var(--lucent-accent-border)":"var(--lucent-border-default)",K=N?`0 0 0 3px ${b?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none";return e.jsxs("div",{ref:E,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...k},children:[d&&e.jsx("label",{htmlFor:y,style:{fontSize:Ce[s],fontWeight:"var(--lucent-font-weight-medium)",color:w?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),p?e.jsx("span",{onClick:()=>!a&&q(O=>!O),"aria-haspopup":"dialog","aria-expanded":W,style:{display:"inline-flex",cursor:a?"not-allowed":"pointer"},children:p}):e.jsxs("button",{type:"button",id:y,disabled:a,onClick:()=>!a&&q(O=>!O),onFocus:()=>H(!0),onBlur:()=>H(!1),"aria-haspopup":"dialog","aria-expanded":W,"aria-invalid":b,style:{display:"flex",alignItems:"center",gap:qa[s],width:"100%",height:za[s],boxSizing:"border-box",padding:`0 ${Aa[s]}`,borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${Z}`,boxShadow:K,background:w?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",color:u?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:Ea[s],cursor:w?"not-allowed":"pointer",outline:"none",transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", ")},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("rect",{x:"1",y:"2",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1 6h12",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M4 1v2M10 1v2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),e.jsx("span",{style:{flex:1,textAlign:"left"},children:Da(u,o)})]}),b&&e.jsx("span",{role:"alert",style:{fontSize:Ce[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!b&&f&&e.jsx("span",{style:{fontSize:Ce[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:f}),W&&J.createPortal(e.jsxs("div",{ref:B,role:"dialog","aria-label":"Date range picker",style:{position:"fixed",top:M.top,left:M.left,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:ut[s],display:"flex",gap:"var(--lucent-space-6)"},children:[e.jsx("div",{style:{minWidth:Ee[s]},children:e.jsx(Ae,{year:z,month:R,...(u==null?void 0:u.start)!==void 0&&{selected:u.start},today:T,...i!==void 0&&{min:i},...l!==void 0&&{max:l},onSelect:V,onPrevMonth:L,onNextMonth:G,...U!==void 0&&{highlightRange:U},...S&&{onDayHover:A},size:s})}),e.jsx("div",{style:{width:1,background:"var(--lucent-border-subtle)",flexShrink:0}}),e.jsx("div",{style:{minWidth:Ee[s]},children:e.jsx(Ae,{year:D,month:P,...(u==null?void 0:u.end)!==void 0&&{selected:u.end},today:T,...i!==void 0&&{min:i},...l!==void 0&&{max:l},onSelect:V,onPrevMonth:L,onNextMonth:G,...U!==void 0&&{highlightRange:U},...S&&{onDayHover:A},size:s})})]}),document.body),S&&W&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + var(--lucent-space-1))",left:0,zIndex:1001,pointerEvents:"none"}}),S&&W&&e.jsx("div",{style:{position:"absolute",bottom:-24,left:0},children:e.jsx(C.Text,{size:"xs",color:"secondary",children:"Now pick the end date"})})]})}const Ra={id:"date-range-picker",name:"DateRangePicker",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A two-calendar date range picker. First click sets the start date, second click sets the end; the selected interval is highlighted across both calendars.",designIntent:'DateRangePicker composes two Calendar primitives from DatePicker side by side, advancing in lockstep (left = current month, right = next month). Selection is a two-click flow: first click anchors the start, a hint appears ("Now pick the end date"), second click resolves the range with automatic start/end ordering so users can click in either direction. The highlight range (accent-subtle background) spans both calendars to give clear visual feedback for the selected interval. Navigation (prev/next month) advances both calendars together to maintain the one-month-apart constraint.',props:[{name:"value",type:"object",required:!1,description:"Controlled DateRange { start: Date; end: Date }. When provided the component is fully controlled."},{name:"defaultValue",type:"object",required:!1,description:"Initial DateRange for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the completed DateRange after the user picks both start and end."},{name:"placeholder",type:"string",required:!1,default:'"Pick a date range"',description:"Trigger button text when no range is selected."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Label text rendered above the trigger, with size-aware font sizing matching Input/Select."},{name:"helperText",type:"string",required:!1,description:"Helper text rendered below the trigger. Hidden when errorText is present."},{name:"errorText",type:"string",required:!1,description:"Error text rendered below the trigger in danger color. Takes precedence over helperText."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the trigger button and all interaction."},{name:"min",type:"object",required:!1,description:"Earliest selectable Date."},{name:"max",type:"object",required:!1,description:"Latest selectable Date."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:"<DateRangePicker onChange={({ start, end }) => console.log(start, end)} />"},{title:"Controlled",code:`const [range, setRange] = useState<DateRange>();
391
- <DateRangePicker value={range} onChange={setRange} min={new Date()} />`}],compositionGraph:[{componentId:"date-picker",componentName:"DatePicker",role:"Calendar primitive (two instances, left and right)",required:!0},{componentId:"text",componentName:"Text",role:"Mid-selection hint and calendar headers",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-haspopup","aria-expanded","aria-invalid","aria-label","aria-pressed"],keyboardInteractions:["Enter/Space to open","Click first day to set start","Click second day to set end","Escape/click outside to cancel"],notes:'Inherits Calendar accessibility from DatePicker. The two-step selection flow is reinforced with a visible "Now pick the end date" hint.'}};function qe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ba(){return Math.random().toString(36).slice(2)}function Pa({item:t,onRemove:r}){const[n,o]=c.useState(!1),a=t.progress,i=!!t.error;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:`1px solid ${i?"var(--lucent-danger-default)":"var(--lucent-border-default)"}`,background:"var(--lucent-surface)"},children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)"},children:[e.jsx("path",{d:"M5 2h7l4 4v12a1 1 0 01-1 1H5a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M12 2v4h4",stroke:"currentColor",strokeWidth:"1.3"})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(C.Text,{size:"sm",truncate:!0,children:t.file.name}),i?e.jsx(C.Text,{size:"xs",color:"danger",children:t.error}):e.jsx(C.Text,{size:"xs",color:"secondary",children:qe(t.file.size)}),a!==void 0&&!i&&e.jsx("div",{style:{marginTop:4,height:3,borderRadius:"var(--lucent-radius-full)",background:"var(--lucent-surface-secondary)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${a}%`,borderRadius:"var(--lucent-radius-full)",background:a===100?"var(--lucent-success-default)":"var(--lucent-accent-default)",transition:"width 200ms var(--lucent-easing-default)"}})})]}),e.jsx("button",{type:"button",onClick:()=>r(t.id),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"aria-label":`Remove ${t.file.name}`,style:{flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:"none",borderRadius:"var(--lucent-radius-md)",background:n?"var(--lucent-surface-secondary)":"transparent",color:"var(--lucent-text-secondary)",cursor:"pointer",transition:"background var(--lucent-duration-fast)"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}function La({accept:t,multiple:r=!1,maxSize:n,value:o,onChange:a,onError:i,disabled:l=!1,style:s}){const d=o!==void 0,[f,m]=c.useState([]),p=d?o:f,[k,x]=c.useState(!1),[g,h]=c.useState(!1),u=c.useRef(null),b=c.useCallback(I=>{if(!I||l)return;const v=[];for(const T of Array.from(I)){if(n&&T.size>n){i==null||i(`"${T.name}" exceeds the ${qe(n)} limit.`);continue}if(!r&&p.length+v.length>=1)break;v.push({id:Ba(),file:T})}if(v.length===0)return;const A=r?[...p,...v]:v;d||m(A),a==null||a(A)},[l,p,d,n,r,a,i]),w=I=>{const v=p.filter(A=>A.id!==I);d||m(v),a==null||a(v)},y=I=>{I.preventDefault(),x(!1),b(I.dataTransfer.files)},S=I=>{b(I.target.files),I.target.value=""};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-3)",...s},children:[e.jsxs("div",{role:"button",tabIndex:l?-1:0,"aria-label":"Upload files","aria-disabled":l,onClick:()=>{var I;return!l&&((I=u.current)==null?void 0:I.click())},onKeyDown:I=>{var v;(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),(v=u.current)==null||v.click())},onFocus:()=>h(!0),onBlur:()=>h(!1),onDragOver:I=>{I.preventDefault(),l||x(!0)},onDragLeave:()=>x(!1),onDrop:y,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--lucent-space-2)",padding:"var(--lucent-space-8) var(--lucent-space-6)",borderRadius:"var(--lucent-radius-lg)",border:`2px dashed ${l?"var(--lucent-border-default)":k||g?"var(--lucent-accent-default)":"var(--lucent-border-default)"}`,background:k?"var(--lucent-accent-subtle)":"var(--lucent-surface-secondary)",cursor:l?"not-allowed":"pointer",transition:"border-color var(--lucent-duration-fast), background var(--lucent-duration-fast)",outline:"none"},children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none","aria-hidden":!0,style:{color:l?"var(--lucent-text-disabled)":k?"var(--lucent-accent-default)":"var(--lucent-text-secondary)"},children:[e.jsx("path",{d:"M16 20V10M16 10l-4 4M16 10l4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 24h16",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),e.jsxs("div",{style:{textAlign:"center",width:"100%"},children:[e.jsx(C.Text,{color:l?"disabled":"primary",weight:"medium",align:"center",children:k?"Drop to upload":"Drop files here or click to browse"}),(t||n)&&e.jsx(C.Text,{size:"xs",color:"secondary",align:"center",children:[t&&`Accepted: ${t}`,n&&`Max size: ${qe(n)}`].filter(Boolean).join(" · ")})]}),e.jsx("input",{ref:u,type:"file",accept:t,multiple:r,disabled:l,onChange:S,style:{display:"none"},tabIndex:-1})]}),p.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)"},children:p.map(I=>e.jsx(Pa,{item:I,onRemove:w},I.id))})]})}const Fa={id:"file-upload",name:"FileUpload",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A drag-and-drop file upload zone with a file list, per-file progress bars, error display, and size/type validation.",designIntent:'FileUpload separates concerns between the drop zone (entry point) and the file list (status display). The drop zone uses a dashed border and an upload arrow icon to communicate droppability without words. Progress is modelled as a field on UploadFile rather than as a callback so the parent controls upload logic — this component is purely presentational for the upload state. The progress bar turns success-green at 100% to give clear completion feedback. Errors are shown inline on each file row (not as a toast) so the user knows exactly which file failed and why. The hidden <input type="file"> is triggered programmatically on click/keyboard so the drop zone can have a fully custom appearance.',props:[{name:"accept",type:"string",required:!1,description:'Accepted MIME types or extensions passed to the file input, e.g. "image/*,.pdf".'},{name:"multiple",type:"boolean",required:!1,default:"false",description:"Allow selecting multiple files at once."},{name:"maxSize",type:"number",required:!1,description:"Maximum file size in bytes. Files exceeding this trigger onError and are not added."},{name:"value",type:"array",required:!1,description:"Controlled array of UploadFile objects. Each has id, file (File), optional progress (0–100), and optional error string."},{name:"onChange",type:"function",required:!1,description:"Called with the updated UploadFile array after files are added or removed."},{name:"onError",type:"function",required:!1,description:"Called with an error message string when a file fails validation (e.g. exceeds maxSize)."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the drop zone and all file interaction."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled multi-file upload",code:`<FileUpload
390
+ />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Month/year header and weekday labels",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-haspopup","aria-expanded","aria-invalid","aria-label","aria-pressed"],keyboardInteractions:["Enter/Space to open calendar","Click day to select","Escape closes popover (click outside)"],notes:'The calendar popover is role="dialog". Each day button has aria-label with the full date and aria-pressed for selected state. Full arrow-key navigation within the calendar grid is a planned enhancement.'}},za={sm:"calc(var(--lucent-space-8) * 0.5 + 18px)",md:"calc(var(--lucent-space-10) * 0.5 + 22px)",lg:"calc(var(--lucent-space-12) * 0.5 + 26px)"},Ea={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},Aa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},qa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},Ce={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"};function Da(t,r){return t?ge(t.start,t.end)?ie(t.start):`${ie(t.start)} → ${ie(t.end)}`:r}function pt({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date range",disabled:a=!1,min:i,max:s,size:l="md",label:d,helperText:p,errorText:m,trigger:f,style:w}){const y=t!==void 0,[g,h]=c.useState(r),u=y?t:g,b=!!m,x=a,k=`lucent-daterangepicker-${Math.random().toString(36).slice(2,7)}`,[S,C]=c.useState(null),[v,z]=c.useState(null),T=new Date,[E,F]=c.useState(((u==null?void 0:u.start)??T).getFullYear()),[R,j]=c.useState(((u==null?void 0:u.start)??T).getMonth()),P=R===11?0:R+1,D=R===11?E+1:E,[W,q]=c.useState(!1),[N,H]=c.useState(!1),A=c.useRef(null),B=c.useRef(null),[M,$]=c.useState({top:0,left:0});c.useEffect(()=>{if(!W)return;const O=Q=>{var ce,re;!((ce=A.current)!=null&&ce.contains(Q.target))&&!((re=B.current)!=null&&re.contains(Q.target))&&(q(!1),C(null))};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[W]),c.useLayoutEffect(()=>{if(!W||!A.current)return;const O=A.current.getBoundingClientRect();$({top:O.bottom+4,left:O.left})},[W]);const V=O=>{if(!S)C(O);else{const[Q,ce]=ve(O,S)||ge(O,S)?[O,S]:[S,O],re={start:Q,end:ce};y||h(re),n==null||n(re),C(null),q(!1)}},L=()=>{R===0?(j(11),F(O=>O-1)):j(O=>O-1)},G=()=>{R===11?(j(0),F(O=>O+1)):j(O=>O+1)};let U;if(S&&v){const[O,Q]=ve(v,S)?[v,S]:[S,v];U={start:O,end:Q}}else S?U={start:S,end:S}:u&&(U={start:u.start,end:u.end});const Z=x?"transparent":b?"var(--lucent-danger-default)":N?"var(--lucent-accent-border)":"var(--lucent-border-default)",K=N?`0 0 0 3px ${b?"var(--lucent-danger-subtle)":"var(--lucent-accent-subtle)"}`:"none";return e.jsxs("div",{ref:A,style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)",...w},children:[d&&e.jsx("label",{htmlFor:k,style:{fontSize:Ce[l],fontWeight:"var(--lucent-font-weight-medium)",color:x?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",fontFamily:"var(--lucent-font-family-base)"},children:d}),f?e.jsx("span",{onClick:()=>!a&&q(O=>!O),"aria-haspopup":"dialog","aria-expanded":W,style:{display:"inline-flex",cursor:a?"not-allowed":"pointer"},children:f}):e.jsxs("button",{type:"button",id:k,disabled:a,onClick:()=>!a&&q(O=>!O),onFocus:()=>H(!0),onBlur:()=>H(!1),"aria-haspopup":"dialog","aria-expanded":W,"aria-invalid":b,style:{display:"flex",alignItems:"center",gap:qa[l],width:"100%",height:za[l],boxSizing:"border-box",padding:`0 ${Aa[l]}`,borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${Z}`,boxShadow:K,background:x?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",color:u?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:Ea[l],cursor:x?"not-allowed":"pointer",outline:"none",transition:["border-color var(--lucent-duration-fast) var(--lucent-easing-default)","box-shadow var(--lucent-duration-fast) var(--lucent-easing-default)"].join(", ")},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("rect",{x:"1",y:"2",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1 6h12",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M4 1v2M10 1v2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),e.jsx("span",{style:{flex:1,textAlign:"left"},children:Da(u,o)})]}),b&&e.jsx("span",{role:"alert",style:{fontSize:Ce[l],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:m}),!b&&p&&e.jsx("span",{style:{fontSize:Ce[l],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p}),W&&J.createPortal(e.jsxs("div",{ref:B,role:"dialog","aria-label":"Date range picker",style:{position:"fixed",top:M.top,left:M.left,zIndex:1e3,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:ut[l],display:"flex",gap:"var(--lucent-space-6)"},children:[e.jsx("div",{style:{minWidth:Ee[l]},children:e.jsx(Ae,{year:E,month:R,...(u==null?void 0:u.start)!==void 0&&{selected:u.start},today:T,...i!==void 0&&{min:i},...s!==void 0&&{max:s},onSelect:V,onPrevMonth:L,onNextMonth:G,...U!==void 0&&{highlightRange:U},...S&&{onDayHover:z},size:l})}),e.jsx("div",{style:{width:1,background:"var(--lucent-border-subtle)",flexShrink:0}}),e.jsx("div",{style:{minWidth:Ee[l]},children:e.jsx(Ae,{year:D,month:P,...(u==null?void 0:u.end)!==void 0&&{selected:u.end},today:T,...i!==void 0&&{min:i},...s!==void 0&&{max:s},onSelect:V,onPrevMonth:L,onNextMonth:G,...U!==void 0&&{highlightRange:U},...S&&{onDayHover:z},size:l})})]}),document.body),S&&W&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + var(--lucent-space-1))",left:0,zIndex:1001,pointerEvents:"none"}}),S&&W&&e.jsx("div",{style:{position:"absolute",bottom:-24,left:0},children:e.jsx(I.Text,{size:"xs",color:"secondary",children:"Now pick the end date"})})]})}const Ra={id:"date-range-picker",name:"DateRangePicker",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A two-calendar date range picker. First click sets the start date, second click sets the end; the selected interval is highlighted across both calendars.",designIntent:'DateRangePicker composes two Calendar primitives from DatePicker side by side, advancing in lockstep (left = current month, right = next month). Selection is a two-click flow: first click anchors the start, a hint appears ("Now pick the end date"), second click resolves the range with automatic start/end ordering so users can click in either direction. The highlight range (accent-subtle background) spans both calendars to give clear visual feedback for the selected interval. Navigation (prev/next month) advances both calendars together to maintain the one-month-apart constraint.',props:[{name:"value",type:"object",required:!1,description:"Controlled DateRange { start: Date; end: Date }. When provided the component is fully controlled."},{name:"defaultValue",type:"object",required:!1,description:"Initial DateRange for uncontrolled usage."},{name:"onChange",type:"function",required:!1,description:"Called with the completed DateRange after the user picks both start and end."},{name:"placeholder",type:"string",required:!1,default:'"Pick a date range"',description:"Trigger button text when no range is selected."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls trigger height and font size to match Input/Select.",enumValues:["sm","md","lg"]},{name:"label",type:"string",required:!1,description:"Label text rendered above the trigger, with size-aware font sizing matching Input/Select."},{name:"helperText",type:"string",required:!1,description:"Helper text rendered below the trigger. Hidden when errorText is present."},{name:"errorText",type:"string",required:!1,description:"Error text rendered below the trigger in danger color. Takes precedence over helperText."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the trigger button and all interaction."},{name:"min",type:"object",required:!1,description:"Earliest selectable Date."},{name:"max",type:"object",required:!1,description:"Latest selectable Date."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled",code:"<DateRangePicker onChange={({ start, end }) => console.log(start, end)} />"},{title:"Controlled",code:`const [range, setRange] = useState<DateRange>();
391
+ <DateRangePicker value={range} onChange={setRange} min={new Date()} />`}],compositionGraph:[{componentId:"date-picker",componentName:"DatePicker",role:"Calendar primitive (two instances, left and right)",required:!0},{componentId:"text",componentName:"Text",role:"Mid-selection hint and calendar headers",required:!0}],accessibility:{role:"dialog",ariaAttributes:["aria-haspopup","aria-expanded","aria-invalid","aria-label","aria-pressed"],keyboardInteractions:["Enter/Space to open","Click first day to set start","Click second day to set end","Escape/click outside to cancel"],notes:'Inherits Calendar accessibility from DatePicker. The two-step selection flow is reinforced with a visible "Now pick the end date" hint.'}};function qe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ba(){return Math.random().toString(36).slice(2)}function Pa({item:t,onRemove:r}){const[n,o]=c.useState(!1),a=t.progress,i=!!t.error;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-2) var(--lucent-space-3)",borderRadius:"var(--lucent-radius-md)",border:`1px solid ${i?"var(--lucent-danger-default)":"var(--lucent-border-default)"}`,background:"var(--lucent-surface)"},children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)"},children:[e.jsx("path",{d:"M5 2h7l4 4v12a1 1 0 01-1 1H5a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M12 2v4h4",stroke:"currentColor",strokeWidth:"1.3"})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(I.Text,{size:"sm",truncate:!0,children:t.file.name}),i?e.jsx(I.Text,{size:"xs",color:"danger",children:t.error}):e.jsx(I.Text,{size:"xs",color:"secondary",children:qe(t.file.size)}),a!==void 0&&!i&&e.jsx("div",{style:{marginTop:4,height:3,borderRadius:"var(--lucent-radius-full)",background:"var(--lucent-surface-secondary)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${a}%`,borderRadius:"var(--lucent-radius-full)",background:a===100?"var(--lucent-success-default)":"var(--lucent-accent-default)",transition:"width 200ms var(--lucent-easing-default)"}})})]}),e.jsx("button",{type:"button",onClick:()=>r(t.id),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"aria-label":`Remove ${t.file.name}`,style:{flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:"none",borderRadius:"var(--lucent-radius-md)",background:n?"var(--lucent-surface-secondary)":"transparent",color:"var(--lucent-text-secondary)",cursor:"pointer",transition:"background var(--lucent-duration-fast)"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}function La({accept:t,multiple:r=!1,maxSize:n,value:o,onChange:a,onError:i,disabled:s=!1,style:l}){const d=o!==void 0,[p,m]=c.useState([]),f=d?o:p,[w,y]=c.useState(!1),[g,h]=c.useState(!1),u=c.useRef(null),b=c.useCallback(C=>{if(!C||s)return;const v=[];for(const T of Array.from(C)){if(n&&T.size>n){i==null||i(`"${T.name}" exceeds the ${qe(n)} limit.`);continue}if(!r&&f.length+v.length>=1)break;v.push({id:Ba(),file:T})}if(v.length===0)return;const z=r?[...f,...v]:v;d||m(z),a==null||a(z)},[s,f,d,n,r,a,i]),x=C=>{const v=f.filter(z=>z.id!==C);d||m(v),a==null||a(v)},k=C=>{C.preventDefault(),y(!1),b(C.dataTransfer.files)},S=C=>{b(C.target.files),C.target.value=""};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-3)",...l},children:[e.jsxs("div",{role:"button",tabIndex:s?-1:0,"aria-label":"Upload files","aria-disabled":s,onClick:()=>{var C;return!s&&((C=u.current)==null?void 0:C.click())},onKeyDown:C=>{var v;(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),(v=u.current)==null||v.click())},onFocus:()=>h(!0),onBlur:()=>h(!1),onDragOver:C=>{C.preventDefault(),s||y(!0)},onDragLeave:()=>y(!1),onDrop:k,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--lucent-space-2)",padding:"var(--lucent-space-8) var(--lucent-space-6)",borderRadius:"var(--lucent-radius-lg)",border:`2px dashed ${s?"var(--lucent-border-default)":w||g?"var(--lucent-accent-default)":"var(--lucent-border-default)"}`,background:w?"var(--lucent-accent-subtle)":"var(--lucent-surface-secondary)",cursor:s?"not-allowed":"pointer",transition:"border-color var(--lucent-duration-fast), background var(--lucent-duration-fast)",outline:"none"},children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none","aria-hidden":!0,style:{color:s?"var(--lucent-text-disabled)":w?"var(--lucent-accent-default)":"var(--lucent-text-secondary)"},children:[e.jsx("path",{d:"M16 20V10M16 10l-4 4M16 10l4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 24h16",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),e.jsxs("div",{style:{textAlign:"center",width:"100%"},children:[e.jsx(I.Text,{color:s?"disabled":"primary",weight:"medium",align:"center",children:w?"Drop to upload":"Drop files here or click to browse"}),(t||n)&&e.jsx(I.Text,{size:"xs",color:"secondary",align:"center",children:[t&&`Accepted: ${t}`,n&&`Max size: ${qe(n)}`].filter(Boolean).join(" · ")})]}),e.jsx("input",{ref:u,type:"file",accept:t,multiple:r,disabled:s,onChange:S,style:{display:"none"},tabIndex:-1})]}),f.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-2)"},children:f.map(C=>e.jsx(Pa,{item:C,onRemove:x},C.id))})]})}const Fa={id:"file-upload",name:"FileUpload",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A drag-and-drop file upload zone with a file list, per-file progress bars, error display, and size/type validation.",designIntent:'FileUpload separates concerns between the drop zone (entry point) and the file list (status display). The drop zone uses a dashed border and an upload arrow icon to communicate droppability without words. Progress is modelled as a field on UploadFile rather than as a callback so the parent controls upload logic — this component is purely presentational for the upload state. The progress bar turns success-green at 100% to give clear completion feedback. Errors are shown inline on each file row (not as a toast) so the user knows exactly which file failed and why. The hidden <input type="file"> is triggered programmatically on click/keyboard so the drop zone can have a fully custom appearance.',props:[{name:"accept",type:"string",required:!1,description:'Accepted MIME types or extensions passed to the file input, e.g. "image/*,.pdf".'},{name:"multiple",type:"boolean",required:!1,default:"false",description:"Allow selecting multiple files at once."},{name:"maxSize",type:"number",required:!1,description:"Maximum file size in bytes. Files exceeding this trigger onError and are not added."},{name:"value",type:"array",required:!1,description:"Controlled array of UploadFile objects. Each has id, file (File), optional progress (0–100), and optional error string."},{name:"onChange",type:"function",required:!1,description:"Called with the updated UploadFile array after files are added or removed."},{name:"onError",type:"function",required:!1,description:"Called with an error message string when a file fails validation (e.g. exceeds maxSize)."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables the drop zone and all file interaction."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer wrapper."}],usageExamples:[{title:"Uncontrolled multi-file upload",code:`<FileUpload
392
392
  multiple
393
393
  accept="image/*,.pdf"
394
394
  maxSize={5 * 1024 * 1024}
@@ -407,7 +407,7 @@ const handleChange = async (updated: UploadFile[]) => {
407
407
  }
408
408
  };
409
409
 
410
- <FileUpload value={files} onChange={handleChange} multiple />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Drop zone label, file name, file size, and error messages",required:!0}],accessibility:{role:"button",ariaAttributes:["aria-label","aria-disabled"],keyboardInteractions:["Enter/Space to open file picker","Tab to focus drop zone"],notes:'The drop zone has role="button" with tabIndex=0 and responds to Enter/Space. Remove buttons on file rows have aria-label including the filename.'}},Na={default:"var(--lucent-text-disabled)",success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"};function $a({status:t}){return t==="success"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M2.5 5.2l1.8 1.8L7.5 3.5",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):t==="danger"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3 3l4 4M7 3L3 7",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})}):t==="warning"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M5 2.5v3M5 7.5v.01",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})}):t==="info"?e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:[e.jsx("circle",{cx:"5",cy:"3",r:"0.75",fill:"#fff"}),e.jsx("path",{d:"M5 5v2.5",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})]}):e.jsx("svg",{width:"6",height:"6",viewBox:"0 0 6 6","aria-hidden":!0,children:e.jsx("circle",{cx:"3",cy:"3",r:"3",fill:"#fff"})})}function Wa({items:t,style:r}){return e.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",...r},children:t.map((n,o)=>{const a=n.status??"default",i=Na[a],l=o===t.length-1;return e.jsxs("li",{style:{display:"flex",gap:"var(--lucent-space-3)",position:"relative"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0,width:20},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"var(--lucent-radius-full)",background:i,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,zIndex:1},children:n.icon??e.jsx($a,{status:a})}),!l&&e.jsx("div",{style:{flex:1,width:1.5,background:"var(--lucent-border-subtle)",minHeight:"var(--lucent-space-3)"}})]}),e.jsxs("div",{style:{flex:1,paddingBottom:l?0:"var(--lucent-space-5)",paddingTop:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--lucent-space-2)",flexWrap:"wrap"},children:[e.jsx(C.Text,{weight:"medium",size:"sm",children:n.title}),n.date&&e.jsx(C.Text,{size:"xs",color:"secondary",children:n.date})]}),n.description&&e.jsx("div",{style:{marginTop:"var(--lucent-space-1)"},children:e.jsx(C.Text,{size:"sm",color:"secondary",children:n.description})}),n.content&&e.jsx("div",{style:{marginTop:"var(--lucent-space-3)"},children:n.content})]})]},n.id)})})}const Oa={id:"timeline",name:"Timeline",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A vertical activity feed with filled status dots, inline timestamps, optional nested content blocks, and custom icons.",designIntent:"Timeline renders as a semantic <ol> with each event as a <li>, preserving document order for assistive technologies. Dots are compact (20px) and filled with the status color, with white iconography for high contrast — this mirrors modern activity-feed patterns. Title and date sit inline (date follows title) to keep the eye on a single reading line, rather than splitting attention across the row. Each item supports an optional content slot for embedded blocks — comment cards, review notes, nested detail panels — placed below the title/description. The connector line is thin (1.5px) and omitted on the last item. Status colors follow the same semantic token set as Alert and Badge so danger/success/warning/info carry consistent meaning across the design system. Custom icons slot in via the icon prop to handle domain-specific event types (e.g. a deploy icon, a payment icon).",props:[{name:"items",type:"array",required:!0,description:"Array of TimelineItem objects. Each has id, title, optional description, optional content (ReactNode for embedded blocks), optional date string, optional status, and optional icon."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer <ol> wrapper."}],usageExamples:[{title:"Basic event log",code:`<Timeline
410
+ <FileUpload value={files} onChange={handleChange} multiple />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Drop zone label, file name, file size, and error messages",required:!0}],accessibility:{role:"button",ariaAttributes:["aria-label","aria-disabled"],keyboardInteractions:["Enter/Space to open file picker","Tab to focus drop zone"],notes:'The drop zone has role="button" with tabIndex=0 and responds to Enter/Space. Remove buttons on file rows have aria-label including the filename.'}},Na={default:"var(--lucent-text-disabled)",success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"};function $a({status:t}){return t==="success"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M2.5 5.2l1.8 1.8L7.5 3.5",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):t==="danger"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3 3l4 4M7 3L3 7",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})}):t==="warning"?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M5 2.5v3M5 7.5v.01",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})}):t==="info"?e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:[e.jsx("circle",{cx:"5",cy:"3",r:"0.75",fill:"#fff"}),e.jsx("path",{d:"M5 5v2.5",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})]}):e.jsx("svg",{width:"6",height:"6",viewBox:"0 0 6 6","aria-hidden":!0,children:e.jsx("circle",{cx:"3",cy:"3",r:"3",fill:"#fff"})})}function Wa({items:t,style:r}){return e.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",...r},children:t.map((n,o)=>{const a=n.status??"default",i=Na[a],s=o===t.length-1;return e.jsxs("li",{style:{display:"flex",gap:"var(--lucent-space-3)",position:"relative"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0,width:20},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"var(--lucent-radius-full)",background:i,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,zIndex:1},children:n.icon??e.jsx($a,{status:a})}),!s&&e.jsx("div",{style:{flex:1,width:1.5,background:"var(--lucent-border-subtle)",minHeight:"var(--lucent-space-3)"}})]}),e.jsxs("div",{style:{flex:1,paddingBottom:s?0:"var(--lucent-space-5)",paddingTop:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--lucent-space-2)",flexWrap:"wrap"},children:[e.jsx(I.Text,{weight:"medium",size:"sm",children:n.title}),n.date&&e.jsx(I.Text,{size:"xs",color:"secondary",children:n.date})]}),n.description&&e.jsx("div",{style:{marginTop:"var(--lucent-space-1)"},children:e.jsx(I.Text,{size:"sm",color:"secondary",children:n.description})}),n.content&&e.jsx("div",{style:{marginTop:"var(--lucent-space-3)"},children:n.content})]})]},n.id)})})}const Oa={id:"timeline",name:"Timeline",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A vertical activity feed with filled status dots, inline timestamps, optional nested content blocks, and custom icons.",designIntent:"Timeline renders as a semantic <ol> with each event as a <li>, preserving document order for assistive technologies. Dots are compact (20px) and filled with the status color, with white iconography for high contrast — this mirrors modern activity-feed patterns. Title and date sit inline (date follows title) to keep the eye on a single reading line, rather than splitting attention across the row. Each item supports an optional content slot for embedded blocks — comment cards, review notes, nested detail panels — placed below the title/description. The connector line is thin (1.5px) and omitted on the last item. Status colors follow the same semantic token set as Alert and Badge so danger/success/warning/info carry consistent meaning across the design system. Custom icons slot in via the icon prop to handle domain-specific event types (e.g. a deploy icon, a payment icon).",props:[{name:"items",type:"array",required:!0,description:"Array of TimelineItem objects. Each has id, title, optional description, optional content (ReactNode for embedded blocks), optional date string, optional status, and optional icon."},{name:"style",type:"object",required:!1,description:"Inline style overrides for the outer <ol> wrapper."}],usageExamples:[{title:"Basic event log",code:`<Timeline
411
411
  items={[
412
412
  { id: '1', title: 'Order placed', date: 'Mar 1, 2026', status: 'success' },
413
413
  { id: '2', title: 'Payment processed', date: 'Mar 1, 2026', status: 'success' },
@@ -432,7 +432,7 @@ const handleChange = async (updated: UploadFile[]) => {
432
432
  { id: '3', title: 'Resubmitted', date: 'Mar 28', status: 'info' },
433
433
  { id: '4', title: 'Approved', date: 'Mar 29', status: 'success' },
434
434
  ]}
435
- />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Event title, description, and date label",required:!0},{componentId:"card",componentName:"Card",role:"Container for nested content blocks in the content slot",required:!1}],accessibility:{role:"list",ariaAttributes:[],keyboardInteractions:["Standard document flow — no interactive elements unless custom icons include them"],notes:"Timeline is a semantic <ol> with <li> items. It is non-interactive by default. If items contain interactive elements (links, buttons), those elements carry their own keyboard behaviour."}},ft=c.createContext(null);function Va(){const t=c.useContext(ft);if(!t)throw new Error("useToast must be used inside <ToastProvider>");return t}const Ha=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 5.5V8.5M8 10.5V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ga=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ua=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M8 2L14.5 13H1.5L8 2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),_a=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5.5 5.5L10.5 10.5M10.5 5.5L5.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ya=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Ka={info:e.jsx(Ha,{}),success:e.jsx(Ga,{}),warning:e.jsx(Ua,{}),danger:e.jsx(_a,{})},Xa={default:{border:"var(--lucent-border-default)",iconColor:"var(--lucent-text-secondary)"},info:{border:"var(--lucent-info-default)",iconColor:"var(--lucent-info-text)"},success:{border:"var(--lucent-success-default)",iconColor:"var(--lucent-success-text)"},warning:{border:"var(--lucent-warning-default)",iconColor:"var(--lucent-warning-text)"},danger:{border:"var(--lucent-danger-default)",iconColor:"var(--lucent-danger-text)"}};let Ja=0;function Za(){return`lucent-toast-${++Ja}`}function ht(t){return t.startsWith("top")}const Qa=200,eo=8,to=.04,no=.2,ro=3,ao=356;function Ze({entry:t,onDismiss:r,hideContent:n,fixedHeight:o}){const{id:a,title:i,description:l,variant:s,action:d,icon:f}=t,m=Xa[s],p=f??(s!=="default"?Ka[s]:null),k=(d==null?void 0:d.style)??"button";return e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:"var(--lucent-surface-raised)",border:`1px solid ${m.border}`,borderRadius:"var(--lucent-radius-lg)",boxShadow:n?"none":"var(--lucent-shadow-lg)",boxSizing:"border-box",width:ao,maxWidth:"calc(100vw - var(--lucent-space-8))",fontFamily:"var(--lucent-font-family-base)",transition:"height var(--lucent-duration-base) var(--lucent-easing-emphasized), box-shadow var(--lucent-duration-base) var(--lucent-easing-default)",...o!==void 0&&{height:o,overflow:"hidden"}},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",width:"100%",opacity:n?0:1,transition:"opacity var(--lucent-duration-base) var(--lucent-easing-default)"},children:[p&&e.jsx("span",{style:{flexShrink:0,color:m.iconColor,display:"flex",alignItems:"center"},children:p}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)"},children:[e.jsx(C.Text,{as:"span",size:"sm",weight:"semibold",color:"primary",lineHeight:"tight",children:i}),l&&e.jsx(C.Text,{as:"span",size:"sm",color:"secondary",lineHeight:"base",style:{whiteSpace:"pre-line"},children:l})]}),d&&k==="button"&&e.jsx(oo,{label:d.label,onClick:()=>{d.onClick(),r(a)}}),d&&k==="link"&&e.jsx(io,{label:d.label,iconColor:m.iconColor,onClick:()=>{d.onClick(),r(a)}}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a),style:{flexShrink:0,display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:"var(--lucent-text-secondary)",opacity:n?0:.6},onMouseEnter:x=>{n||(x.currentTarget.style.opacity="1")},onMouseLeave:x=>{n||(x.currentTarget.style.opacity="0.6")},children:e.jsx(Ya,{})})]})})}function oo({label:t,onClick:r}){return e.jsx("button",{type:"button",onClick:r,style:{flexShrink:0,padding:"var(--lucent-space-1) var(--lucent-space-3)",background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-md)",cursor:"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-primary)",lineHeight:"var(--lucent-line-height-tight)",whiteSpace:"nowrap",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:n=>{n.currentTarget.style.background="var(--lucent-surface-secondary)"},onMouseLeave:n=>{n.currentTarget.style.background="var(--lucent-surface)"},children:t})}function io({label:t,iconColor:r,onClick:n}){return e.jsx("button",{type:"button",onClick:n,style:{flexShrink:0,padding:0,background:"none",border:"none",cursor:"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)",fontWeight:"var(--lucent-font-weight-semibold)",color:r==="var(--lucent-text-secondary)"?"var(--lucent-accent-default)":r,textDecoration:"underline",textUnderlineOffset:2,whiteSpace:"nowrap"},children:t})}const Qe="var(--lucent-space-6)",so=40,lo=120;function co(t){const r={position:"fixed",zIndex:9999,pointerEvents:"none",boxSizing:"border-box"};return ht(t)?r.top=so:r.top=`calc(100vh - ${lo}px)`,t.endsWith("left")?r.left=Qe:t.endsWith("right")?r.right=Qe:(r.left="50%",r.transform="translateX(-50%)"),r}function uo({toasts:t,position:r,onDismiss:n,portalContainer:o}){const[a,i]=c.useState(!1),[l,s]=c.useState(void 0),d=c.useCallback(u=>{u&&s(u.offsetHeight)},[]),f=ht(r),m=t.filter(u=>u.phase!=="exiting"),p=t.filter(u=>u.phase==="exiting");c.useEffect(()=>{m.length<=1&&i(!1)},[m.length]);const k=c.useRef(null),x=c.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null),m.length>1&&i(!0)},[m.length]),g=c.useCallback(()=>{k.current=setTimeout(()=>{i(!1),k.current=null},150)},[]),h=e.jsx("div",{style:co(r),children:e.jsx("div",{onMouseEnter:x,onMouseLeave:g,style:{margin:"calc(-1 * var(--lucent-space-2))",padding:"var(--lucent-space-2)"},children:e.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:f?"column-reverse":"column",gap:a?"var(--lucent-space-2)":0,transform:a&&!f?"translateY(-100%)":void 0,marginTop:a&&!f?l??0:0,transition:"transform var(--lucent-duration-base) var(--lucent-easing-emphasized), margin var(--lucent-duration-base) var(--lucent-easing-emphasized), gap var(--lucent-duration-base) var(--lucent-easing-emphasized)"},children:[m.map((u,b)=>{const w=m.length-1-b,y=!a&&w>ro,S=w*eo,I=f?S:-S,v=a?1:1-w*to,A=a?1:Math.max(0,1-w*no),T=u.phase==="entering",z=w===0,F=!a&&!z;return e.jsx("div",{ref:z?d:void 0,role:"status","aria-live":"polite","aria-hidden":y,style:{position:z||a?"relative":"absolute",...!a&&!z&&(f?{bottom:0}:{top:0}),zIndex:100-w,transform:T?`translateY(${f?"-20px":"20px"}) scale(0.96)`:a?void 0:`translateY(${I}px) scaleX(${v})`,opacity:T||u.phase==="exiting"?0:A,transformOrigin:f?"bottom center":"top center",transition:T?"none":"transform var(--lucent-duration-base) var(--lucent-easing-emphasized), opacity var(--lucent-duration-base) var(--lucent-easing-default)",pointerEvents:y?"none":"auto",visibility:y?"hidden":"visible"},children:e.jsx(Ze,{entry:u,onDismiss:n,hideContent:F,...F&&l!==void 0&&{fixedHeight:l}})},u.id)}),p.map(u=>e.jsx("div",{role:"status","aria-live":"polite",style:{position:"absolute",...f?{bottom:0}:{top:0},zIndex:200,transform:`translateY(${f?"20px":"-20px"}) scale(0.96)`,opacity:0,transformOrigin:f?"bottom center":"top center",transition:"transform var(--lucent-duration-base) var(--lucent-easing-default), opacity var(--lucent-duration-base) var(--lucent-easing-default)",pointerEvents:"none"},children:e.jsx(Ze,{entry:u,onDismiss:n})},u.id))]})})});return J.createPortal(h,o??document.body)}function po({children:t,position:r="bottom-right",duration:n=5e3,max:o=5,portalContainer:a}){const[i,l]=c.useState([]),s=c.useCallback(m=>{l(p=>{const k=p.find(x=>x.id===m);return!k||k.phase==="exiting"?p:p.map(x=>x.id===m?{...x,phase:"exiting"}:x)}),setTimeout(()=>{l(p=>p.filter(k=>k.id!==m))},Qa)},[]),d=c.useCallback(m=>{const p=Za(),k={id:p,title:m.title,variant:m.variant??"default",duration:m.duration??n,...m.description!==void 0&&{description:m.description},...m.action!==void 0&&{action:m.action},...m.icon!==void 0&&{icon:m.icon},phase:"entering"};return l(x=>{const g=[...x,k],h=g.filter(u=>u.phase!=="exiting");if(h.length>o){const u=h.slice(0,h.length-o);for(const b of u)setTimeout(()=>s(b.id),0)}return g}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{l(x=>x.map(g=>g.id===p&&g.phase==="entering"?{...g,phase:"visible"}:g))})}),p},[n,o,s]);c.useEffect(()=>{const m=[];for(const p of i)if(p.phase==="visible"&&p.duration!==1/0){const k=setTimeout(()=>s(p.id),p.duration);m.push(k)}return()=>m.forEach(clearTimeout)},[i,s]);const f={toast:d,dismiss:s};return e.jsxs(ft.Provider,{value:f,children:[t,i.length>0&&e.jsx(uo,{toasts:i,position:r,onDismiss:s,...a!==void 0&&{portalContainer:a}})]})}const fo={id:"toast",name:"Toast",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Ephemeral notification system with auto-dismiss, cascading card-stack, hover-to-expand, action buttons/links, and animated enter/exit transitions. Comprises ToastProvider (context + portal), useToast hook, and toast card rendering.",designIntent:`Toast provides ephemeral feedback for actions that don't require the user to navigate away or acknowledge inline. It fills the gap between Alert (persistent, inline) and Modal (blocking).
435
+ />`}],compositionGraph:[{componentId:"text",componentName:"Text",role:"Event title, description, and date label",required:!0},{componentId:"card",componentName:"Card",role:"Container for nested content blocks in the content slot",required:!1}],accessibility:{role:"list",ariaAttributes:[],keyboardInteractions:["Standard document flow — no interactive elements unless custom icons include them"],notes:"Timeline is a semantic <ol> with <li> items. It is non-interactive by default. If items contain interactive elements (links, buttons), those elements carry their own keyboard behaviour."}},ft=c.createContext(null);function Va(){const t=c.useContext(ft);if(!t)throw new Error("useToast must be used inside <ToastProvider>");return t}const Ha=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 5.5V8.5M8 10.5V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ga=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ua=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M8 2L14.5 13H1.5L8 2Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),_a=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M5.5 5.5L10.5 10.5M10.5 5.5L5.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ya=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3L11 11M11 3L3 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Ka={info:e.jsx(Ha,{}),success:e.jsx(Ga,{}),warning:e.jsx(Ua,{}),danger:e.jsx(_a,{})},Xa={default:{border:"var(--lucent-border-default)",iconColor:"var(--lucent-text-secondary)"},info:{border:"var(--lucent-info-default)",iconColor:"var(--lucent-info-text)"},success:{border:"var(--lucent-success-default)",iconColor:"var(--lucent-success-text)"},warning:{border:"var(--lucent-warning-default)",iconColor:"var(--lucent-warning-text)"},danger:{border:"var(--lucent-danger-default)",iconColor:"var(--lucent-danger-text)"}};let Ja=0;function Za(){return`lucent-toast-${++Ja}`}function ht(t){return t.startsWith("top")}const Qa=200,eo=8,to=.04,no=.2,ro=3,ao=356;function Ze({entry:t,onDismiss:r,hideContent:n,fixedHeight:o}){const{id:a,title:i,description:s,variant:l,action:d,icon:p}=t,m=Xa[l],f=p??(l!=="default"?Ka[l]:null),w=(d==null?void 0:d.style)??"button";return e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",padding:"var(--lucent-space-3) var(--lucent-space-4)",background:"var(--lucent-surface-raised)",border:`1px solid ${m.border}`,borderRadius:"var(--lucent-radius-lg)",boxShadow:n?"none":"var(--lucent-shadow-lg)",boxSizing:"border-box",width:ao,maxWidth:"calc(100vw - var(--lucent-space-8))",fontFamily:"var(--lucent-font-family-base)",transition:"height var(--lucent-duration-base) var(--lucent-easing-emphasized), box-shadow var(--lucent-duration-base) var(--lucent-easing-default)",...o!==void 0&&{height:o,overflow:"hidden"}},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-3)",width:"100%",opacity:n?0:1,transition:"opacity var(--lucent-duration-base) var(--lucent-easing-default)"},children:[f&&e.jsx("span",{style:{flexShrink:0,color:m.iconColor,display:"flex",alignItems:"center"},children:f}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"var(--lucent-space-1)"},children:[e.jsx(I.Text,{as:"span",size:"sm",weight:"semibold",color:"primary",lineHeight:"tight",children:i}),s&&e.jsx(I.Text,{as:"span",size:"sm",color:"secondary",lineHeight:"base",style:{whiteSpace:"pre-line"},children:s})]}),d&&w==="button"&&e.jsx(oo,{label:d.label,onClick:()=>{d.onClick(),r(a)}}),d&&w==="link"&&e.jsx(io,{label:d.label,iconColor:m.iconColor,onClick:()=>{d.onClick(),r(a)}}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a),style:{flexShrink:0,display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,borderRadius:"var(--lucent-radius-sm)",color:"var(--lucent-text-secondary)",opacity:n?0:.6},onMouseEnter:y=>{n||(y.currentTarget.style.opacity="1")},onMouseLeave:y=>{n||(y.currentTarget.style.opacity="0.6")},children:e.jsx(Ya,{})})]})})}function oo({label:t,onClick:r}){return e.jsx("button",{type:"button",onClick:r,style:{flexShrink:0,padding:"var(--lucent-space-1) var(--lucent-space-3)",background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-md)",cursor:"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-primary)",lineHeight:"var(--lucent-line-height-tight)",whiteSpace:"nowrap",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},onMouseEnter:n=>{n.currentTarget.style.background="var(--lucent-surface-secondary)"},onMouseLeave:n=>{n.currentTarget.style.background="var(--lucent-surface)"},children:t})}function io({label:t,iconColor:r,onClick:n}){return e.jsx("button",{type:"button",onClick:n,style:{flexShrink:0,padding:0,background:"none",border:"none",cursor:"pointer",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-sm)",fontWeight:"var(--lucent-font-weight-semibold)",color:r==="var(--lucent-text-secondary)"?"var(--lucent-accent-default)":r,textDecoration:"underline",textUnderlineOffset:2,whiteSpace:"nowrap"},children:t})}const Qe="var(--lucent-space-6)",so=40,lo=120;function co(t){const r={position:"fixed",zIndex:9999,pointerEvents:"none",boxSizing:"border-box"};return ht(t)?r.top=so:r.top=`calc(100vh - ${lo}px)`,t.endsWith("left")?r.left=Qe:t.endsWith("right")?r.right=Qe:(r.left="50%",r.transform="translateX(-50%)"),r}function uo({toasts:t,position:r,onDismiss:n,portalContainer:o}){const[a,i]=c.useState(!1),[s,l]=c.useState(void 0),d=c.useCallback(u=>{u&&l(u.offsetHeight)},[]),p=ht(r),m=t.filter(u=>u.phase!=="exiting"),f=t.filter(u=>u.phase==="exiting");c.useEffect(()=>{m.length<=1&&i(!1)},[m.length]);const w=c.useRef(null),y=c.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null),m.length>1&&i(!0)},[m.length]),g=c.useCallback(()=>{w.current=setTimeout(()=>{i(!1),w.current=null},150)},[]),h=e.jsx("div",{style:co(r),children:e.jsx("div",{onMouseEnter:y,onMouseLeave:g,style:{margin:"calc(-1 * var(--lucent-space-2))",padding:"var(--lucent-space-2)"},children:e.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:p?"column-reverse":"column",gap:a?"var(--lucent-space-2)":0,transform:a&&!p?"translateY(-100%)":void 0,marginTop:a&&!p?s??0:0,transition:"transform var(--lucent-duration-base) var(--lucent-easing-emphasized), margin var(--lucent-duration-base) var(--lucent-easing-emphasized), gap var(--lucent-duration-base) var(--lucent-easing-emphasized)"},children:[m.map((u,b)=>{const x=m.length-1-b,k=!a&&x>ro,S=x*eo,C=p?S:-S,v=a?1:1-x*to,z=a?1:Math.max(0,1-x*no),T=u.phase==="entering",E=x===0,F=!a&&!E;return e.jsx("div",{ref:E?d:void 0,role:"status","aria-live":"polite","aria-hidden":k,style:{position:E||a?"relative":"absolute",...!a&&!E&&(p?{bottom:0}:{top:0}),zIndex:100-x,transform:T?`translateY(${p?"-20px":"20px"}) scale(0.96)`:a?void 0:`translateY(${C}px) scaleX(${v})`,opacity:T||u.phase==="exiting"?0:z,transformOrigin:p?"bottom center":"top center",transition:T?"none":"transform var(--lucent-duration-base) var(--lucent-easing-emphasized), opacity var(--lucent-duration-base) var(--lucent-easing-default)",pointerEvents:k?"none":"auto",visibility:k?"hidden":"visible"},children:e.jsx(Ze,{entry:u,onDismiss:n,hideContent:F,...F&&s!==void 0&&{fixedHeight:s}})},u.id)}),f.map(u=>e.jsx("div",{role:"status","aria-live":"polite",style:{position:"absolute",...p?{bottom:0}:{top:0},zIndex:200,transform:`translateY(${p?"20px":"-20px"}) scale(0.96)`,opacity:0,transformOrigin:p?"bottom center":"top center",transition:"transform var(--lucent-duration-base) var(--lucent-easing-default), opacity var(--lucent-duration-base) var(--lucent-easing-default)",pointerEvents:"none"},children:e.jsx(Ze,{entry:u,onDismiss:n})},u.id))]})})});return J.createPortal(h,o??document.body)}function po({children:t,position:r="bottom-right",duration:n=5e3,max:o=5,portalContainer:a}){const[i,s]=c.useState([]),l=c.useCallback(m=>{s(f=>{const w=f.find(y=>y.id===m);return!w||w.phase==="exiting"?f:f.map(y=>y.id===m?{...y,phase:"exiting"}:y)}),setTimeout(()=>{s(f=>f.filter(w=>w.id!==m))},Qa)},[]),d=c.useCallback(m=>{const f=Za(),w={id:f,title:m.title,variant:m.variant??"default",duration:m.duration??n,...m.description!==void 0&&{description:m.description},...m.action!==void 0&&{action:m.action},...m.icon!==void 0&&{icon:m.icon},phase:"entering"};return s(y=>{const g=[...y,w],h=g.filter(u=>u.phase!=="exiting");if(h.length>o){const u=h.slice(0,h.length-o);for(const b of u)setTimeout(()=>l(b.id),0)}return g}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{s(y=>y.map(g=>g.id===f&&g.phase==="entering"?{...g,phase:"visible"}:g))})}),f},[n,o,l]);c.useEffect(()=>{const m=[];for(const f of i)if(f.phase==="visible"&&f.duration!==1/0){const w=setTimeout(()=>l(f.id),f.duration);m.push(w)}return()=>m.forEach(clearTimeout)},[i,l]);const p={toast:d,dismiss:l};return e.jsxs(ft.Provider,{value:p,children:[t,i.length>0&&e.jsx(uo,{toasts:i,position:r,onDismiss:l,...a!==void 0&&{portalContainer:a}})]})}const fo={id:"toast",name:"Toast",tier:"molecule",domain:"neutral",specVersion:"0.1",description:"Ephemeral notification system with auto-dismiss, cascading card-stack, hover-to-expand, action buttons/links, and animated enter/exit transitions. Comprises ToastProvider (context + portal), useToast hook, and toast card rendering.",designIntent:`Toast provides ephemeral feedback for actions that don't require the user to navigate away or acknowledge inline. It fills the gap between Alert (persistent, inline) and Modal (blocking).
436
436
 
437
437
  **Architecture**: ToastProvider wraps the app and manages a queue of toast entries. It renders toasts into a React portal (document.body by default, configurable via portalContainer) so they float above all page content regardless of stacking contexts. The useToast() hook exposes an imperative \`toast()\` function that returns a dismissible id, and a \`dismiss()\` function.
438
438
 
@@ -506,7 +506,7 @@ dismiss(id);`},{title:"Custom icon",description:"Override the built-in variant i
506
506
  background: color-mix(in srgb, var(--lucent-text-primary) 5%, transparent) !important;
507
507
  color: var(--lucent-text-primary) !important;
508
508
  }
509
- `,he="cubic-bezier(0.34, 1.56, 0.64, 1)",xe={sm:{fontSize:"var(--lucent-font-size-sm)",paddingY:"5px",paddingX:"var(--lucent-space-3)",gap:"var(--lucent-space-2)",itemGap:"0px",iconWidth:"var(--lucent-space-5)",nestedFontSize:"var(--lucent-font-size-xs)"},md:{fontSize:"var(--lucent-font-size-md)",paddingY:"6px",paddingX:"var(--lucent-space-3)",gap:"var(--lucent-space-2)",itemGap:"2px",iconWidth:"var(--lucent-space-5)",nestedFontSize:"var(--lucent-font-size-sm)"},lg:{fontSize:"var(--lucent-font-size-lg)",paddingY:"var(--lucent-space-2)",paddingX:"var(--lucent-space-4)",gap:"var(--lucent-space-3)",itemGap:"var(--lucent-space-1)",iconWidth:"var(--lucent-space-6)",nestedFontSize:"var(--lucent-font-size-md)"}},X=c.createContext({orientation:"vertical",depth:0,inverse:!1,size:"md",hasIcons:!1,parentHasIcon:!1,requestMeasure:()=>{}});function le({children:t,orientation:r="vertical",inverse:n=!1,size:o="md",hasIcons:a=!1,style:i,"aria-label":l="Navigation"}){const s=c.useRef(!1);if(!s.current&&typeof document<"u"){const h=document.createElement("style");h.textContent=ho,document.head.appendChild(h),s.current=!0}const d=xe[o],f=c.useRef(null),m=c.useRef(null),p=c.useRef(!1),k=c.useRef(0),x=c.useCallback(()=>{const h=f.current,u=m.current;if(!h||!u)return;const b=h.querySelector('[data-active="true"]'),w=h.querySelector('[data-active-parent="true"]');let y=null,S=!1;if(b&&!b.closest('[aria-hidden="true"]')?y=b:w&&!w.closest('[aria-hidden="true"]')&&(y=w,S=!0),!y){u.style.opacity="0";return}const I=h.getBoundingClientRect(),v=y.getBoundingClientRect();p.current?u.style.transition=[`top 150ms ${he}`,`left 150ms ${he}`,`width 150ms ${he}`,`height 150ms ${he}`,"opacity 100ms ease","background 150ms ease","box-shadow 150ms ease"].join(", "):(u.style.transition="none",p.current=!0),u.style.top=`${v.top-I.top}px`,u.style.left=`${v.left-I.left}px`,u.style.width=`${v.width}px`,u.style.height=`${v.height}px`,u.style.opacity="1",S?(u.style.background=n?"var(--lucent-surface-secondary)":"color-mix(in srgb, var(--lucent-accent-default) 12%, transparent)",u.style.boxShadow="none"):(u.style.background=n?"var(--lucent-surface)":"var(--lucent-accent-default)",u.style.boxShadow=n?"inset -3px 0 0 var(--lucent-accent-default), var(--lucent-shadow-sm)":"none")},[n]),g=c.useCallback(()=>{cancelAnimationFrame(k.current),k.current=requestAnimationFrame(x)},[x]);return c.useEffect(()=>{const h=f.current;if(!h)return;const u=new MutationObserver(g);return u.observe(h,{attributes:!0,attributeFilter:["data-active","data-active-parent","aria-hidden"],subtree:!0}),()=>u.disconnect()},[g]),c.useEffect(()=>{const h=f.current;if(!h)return;const u=new ResizeObserver(g);return u.observe(h),()=>u.disconnect()},[g]),c.useEffect(()=>{document.fonts.ready.then(g)},[g]),c.useEffect(()=>{g()},[t,n,o,g]),e.jsx(X.Provider,{value:{orientation:r,depth:0,inverse:n,size:o,hasIcons:a,parentHasIcon:!1,requestMeasure:g},children:e.jsxs("nav",{ref:f,"aria-label":l,style:{display:"flex",flexDirection:r==="vertical"?"column":"row",gap:d.itemGap,fontFamily:"var(--lucent-font-family-base)",fontSize:d.fontSize,position:"relative",...i},children:[e.jsx("div",{ref:m,"aria-hidden":!0,style:{position:"absolute",borderRadius:"var(--lucent-radius-md)",pointerEvents:"none",zIndex:0,opacity:0,top:0,left:0,width:0,height:0}}),t]})})}function mt({children:t,href:r,isActive:n=!1,icon:o,badge:a,disabled:i=!1,onClick:l,as:s,style:d}){const{orientation:f,depth:m,inverse:p,size:k,parentHasIcon:x,requestMeasure:g}=c.useContext(X),h=xe[k];c.useEffect(()=>{g()},[n,g]);let u=null;const b=[],w=Array.isArray(t)?t:[t];for(const S of w)S!=null&&typeof S=="object"&&"type"in S&&S.type===Fe?u=S:b.push(S);if(u)return e.jsx(mo,{subMenu:u,orientation:f,depth:m,inverse:p,size:k,isActive:n,disabled:i,...o!==void 0&&{icon:o},...a!==void 0&&{badge:a},...l!==void 0&&{onClick:l},...d!==void 0&&{style:d},children:b});const y=s??"a";return e.jsxs(y,{"data-lucent-navitem":"","data-active":n||void 0,href:i?void 0:r,onClick:i?void 0:l,"aria-current":n?"page":void 0,"aria-disabled":i||void 0,style:{display:"flex",alignItems:"center",gap:h.gap,padding:f==="vertical"?`${h.paddingY} ${h.paddingX} ${h.paddingY} ${o!=null||x?"var(--lucent-space-2)":"var(--lucent-space-4)"}`:`${h.paddingY} ${h.paddingX}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:i?"var(--lucent-text-disabled)":n?p?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",border:0,borderBottom:n&&f==="horizontal"?"2px solid var(--lucent-accent-default)":f==="horizontal"?"2px solid transparent":0,boxShadow:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:h.fontSize,fontWeight:n?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textDecoration:"none",cursor:i?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",position:"relative",zIndex:1,whiteSpace:f==="horizontal"?"nowrap":void 0,width:f==="vertical"?"100%":void 0,textAlign:"left",outline:"none",...d},children:[o!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:h.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:o}),e.jsx("span",{style:{flex:1},children:b}),a!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,marginLeft:"auto"},children:a})]})}function mo({children:t,icon:r,badge:n,isActive:o=!1,disabled:a=!1,onClick:i,style:l,subMenu:s,orientation:d,depth:f,inverse:m,size:p}){const{hasIcons:k,requestMeasure:x}=c.useContext(X),g=xe[p],[h,u]=c.useState(!1),b=c.useRef(null),[w,y]=c.useState(0),S=c.useRef(null),I=c.useRef(null),v=c.useRef(),A=go(s),T=o&&!A,z=!T&&!h&&A,F=o||A;c.useEffect(()=>{x()},[h,o,A,x]),c.useEffect(()=>{if(d!=="vertical")return;const M=b.current;if(M)if(h){const $=M.scrollHeight;y($);const V=setTimeout(()=>{y(void 0)},130);return()=>clearTimeout(V)}else y(M.scrollHeight),M.getBoundingClientRect(),y(0)},[h,d]),c.useEffect(()=>{if(d!=="horizontal"||!h)return;const M=$=>{S.current&&!S.current.contains($.target)&&q()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d,h]),c.useLayoutEffect(()=>{if(d!=="horizontal"||!h)return;const M=I.current;if(!M)return;const $=M.getBoundingClientRect();$.right>window.innerWidth&&(M.style.left="auto",M.style.right="0"),$.bottom>window.innerHeight&&(M.style.top="auto",M.style.bottom="100%",M.style.marginTop="0",M.style.marginBottom="var(--lucent-space-1)")},[d,h]);const[R,j]=c.useState("idle"),[P,D]=c.useState(!1),W=()=>{a||(D(!0),j("entering"),u(!0))},q=()=>{j("exiting"),setTimeout(()=>{u(!1),D(!1),j("idle")},Ie)},N=()=>{a||(d==="horizontal"?h?q():W():u(!h))},H=M=>{a||(d==="vertical"?(M.key==="ArrowRight"&&!h&&(M.preventDefault(),u(!0)),M.key==="ArrowLeft"&&h&&(M.preventDefault(),u(!1))):(M.key==="ArrowDown"&&!h&&(M.preventDefault(),W()),M.key==="ArrowUp"&&h&&(M.preventDefault(),q())),(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),N()),M.key==="Escape"&&h&&(M.preventDefault(),d==="horizontal"?q():u(!1)))},E=()=>{d==="horizontal"&&!a&&(clearTimeout(v.current),W())},B=()=>{d==="horizontal"&&(v.current=setTimeout(()=>q(),150))};return d==="horizontal"?e.jsxs("div",{ref:S,style:{position:"relative"},onMouseEnter:E,onMouseLeave:B,children:[e.jsxs("button",{"data-lucent-navitem":"","data-hint":F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":h,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:g.gap,padding:`${g.paddingY} ${g.paddingX}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:a?"var(--lucent-text-disabled)":F?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",border:0,borderBottom:F?"2px solid var(--lucent-accent-default)":"2px solid transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:g.fontSize,fontWeight:F?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",whiteSpace:"nowrap",outline:"none",boxSizing:"border-box",...l},children:[r!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:g.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:r}),e.jsx("span",{children:t}),n!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0},children:n})]}),P&&e.jsx(X.Provider,{value:{orientation:"vertical",depth:0,inverse:m,size:p,hasIcons:k,parentHasIcon:!1,requestMeasure:x},children:e.jsx("div",{ref:I,style:{position:"absolute",top:"100%",left:0,marginTop:"var(--lucent-space-1)",minWidth:180,background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"var(--lucent-shadow-lg)",padding:"var(--lucent-space-1)",zIndex:100,animation:R==="exiting"?`lucent-navmenu-dropdown-out ${Ie}ms var(--lucent-easing-default) forwards`:`lucent-navmenu-dropdown-in ${Ie}ms var(--lucent-easing-default) forwards`},children:s})})]}):e.jsxs("div",{style:{position:"relative",zIndex:1},children:[e.jsxs("button",{"data-lucent-navitem":"","data-active":T||void 0,"data-active-parent":z||void 0,"data-hint":!T&&!z&&F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":h,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:g.gap,width:"100%",padding:`${g.paddingY} ${g.paddingX} ${g.paddingY} ${r!=null?"var(--lucent-space-2)":"var(--lucent-space-4)"}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:a?"var(--lucent-text-disabled)":T?m?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":z||F?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",border:0,boxShadow:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:g.fontSize,fontWeight:F?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textAlign:"left",textDecoration:"none",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",outline:"none",...l},children:[r!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:g.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:r}),e.jsx("span",{style:{flex:1},children:t}),n!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0},children:n})]}),e.jsx("div",{ref:b,"aria-hidden":!h,style:{overflow:"hidden",height:w!==void 0?w:"auto",transition:"height 120ms var(--lucent-easing-default)"},children:e.jsx(X.Provider,{value:{orientation:d,depth:f+1,inverse:m,size:p,hasIcons:k,parentHasIcon:r!=null,requestMeasure:x},children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:g.itemGap,padding:"var(--lucent-space-1) 0",marginLeft:r!=null?`calc(${g.iconWidth} + ${g.gap})`:"var(--lucent-space-3)",animation:h?"lucent-navmenu-open 200ms var(--lucent-easing-default) forwards":void 0},children:s})})})]})}function go(t){return De(t)}function De(t){if(t==null)return!1;if(Array.isArray(t))return t.some(De);if(typeof t=="object"&&"props"in t){const r=t;if(r.props.isActive)return!0;if(r.props.children)return De(r.props.children)}return!1}function Fe({children:t}){return e.jsx(e.Fragment,{children:t})}function gt({children:t,label:r,defaultOpen:n=!0,open:o,onOpenChange:a,collapsible:i,style:l}){const{orientation:s,inverse:d,size:f,hasIcons:m}=c.useContext(X),p=xe[f],k=i??r!=null,x=m?"var(--lucent-space-2)":"var(--lucent-space-4)";if(s==="horizontal")return e.jsx(e.Fragment,{children:t});const g=o!==void 0,[h,u]=c.useState(n),b=g?o:h,w=c.useRef(null),[y,S]=c.useState(b?void 0:0);c.useEffect(()=>{if(!k)return;const v=w.current;if(v)if(b){const A=v.scrollHeight;S(A);const T=setTimeout(()=>{S(void 0)},130);return()=>clearTimeout(T)}else S(v.scrollHeight),v.getBoundingClientRect(),S(0)},[b,k]);const I=c.useCallback(()=>{const v=!b;g||u(v),a==null||a(v)},[b,g,a]);return r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",marginTop:"var(--lucent-space-3)",...l},children:[k?e.jsxs("button",{onClick:I,"aria-expanded":b,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`var(--lucent-space-1) var(--lucent-space-3) var(--lucent-space-1) ${x}`,background:"none",border:0,cursor:"pointer",outline:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-semibold)",color:"var(--lucent-text-secondary)",letterSpacing:"0.05em",textTransform:"uppercase",textAlign:"left",userSelect:"none",marginBottom:b?"var(--lucent-space-1)":"0",transition:"margin-bottom 200ms var(--lucent-easing-default)"},children:[e.jsx("span",{children:r}),e.jsx(vo,{open:b,size:12})]}):e.jsx("div",{style:{padding:`var(--lucent-space-1) var(--lucent-space-3) var(--lucent-space-1) ${x}`,fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-semibold)",color:"var(--lucent-text-secondary)",letterSpacing:"0.05em",textTransform:"uppercase",userSelect:"none",marginBottom:"var(--lucent-space-1)"},children:r}),k?e.jsx("div",{ref:w,"aria-hidden":!b,style:{overflow:"hidden",height:y!==void 0?y:"auto",transition:"height 120ms var(--lucent-easing-default)"},children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:p.itemGap},children:t})}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:p.itemGap},children:t})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:p.itemGap,...l},children:t})}function vt({style:t}){const{orientation:r}=c.useContext(X);return e.jsx("div",{role:"separator",style:{...r==="vertical"?{height:1,margin:"var(--lucent-space-2) var(--lucent-space-4)"}:{width:1,alignSelf:"stretch",margin:"var(--lucent-space-1) var(--lucent-space-1)"},background:"var(--lucent-border-default)",flexShrink:0,...t}})}function vo({open:t,size:r=14}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)",transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms var(--lucent-easing-default)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}le.Item=mt;le.Group=gt;le.Sub=Fe;le.Separator=vt;const je=120,bo=`
509
+ `,he="cubic-bezier(0.34, 1.56, 0.64, 1)",xe={sm:{fontSize:"var(--lucent-font-size-sm)",paddingY:"5px",paddingX:"var(--lucent-space-3)",gap:"var(--lucent-space-2)",itemGap:"0px",iconWidth:"var(--lucent-space-5)",nestedFontSize:"var(--lucent-font-size-xs)"},md:{fontSize:"var(--lucent-font-size-md)",paddingY:"6px",paddingX:"var(--lucent-space-3)",gap:"var(--lucent-space-2)",itemGap:"2px",iconWidth:"var(--lucent-space-5)",nestedFontSize:"var(--lucent-font-size-sm)"},lg:{fontSize:"var(--lucent-font-size-lg)",paddingY:"var(--lucent-space-2)",paddingX:"var(--lucent-space-4)",gap:"var(--lucent-space-3)",itemGap:"var(--lucent-space-1)",iconWidth:"var(--lucent-space-6)",nestedFontSize:"var(--lucent-font-size-md)"}},X=c.createContext({orientation:"vertical",depth:0,inverse:!1,size:"md",hasIcons:!1,parentHasIcon:!1,requestMeasure:()=>{}});function le({children:t,orientation:r="vertical",inverse:n=!1,size:o="md",hasIcons:a=!1,style:i,"aria-label":s="Navigation"}){const l=c.useRef(!1);if(!l.current&&typeof document<"u"){const h=document.createElement("style");h.textContent=ho,document.head.appendChild(h),l.current=!0}const d=xe[o],p=c.useRef(null),m=c.useRef(null),f=c.useRef(!1),w=c.useRef(0),y=c.useCallback(()=>{const h=p.current,u=m.current;if(!h||!u)return;const b=h.querySelector('[data-active="true"]'),x=h.querySelector('[data-active-parent="true"]');let k=null,S=!1;if(b&&!b.closest('[aria-hidden="true"]')?k=b:x&&!x.closest('[aria-hidden="true"]')&&(k=x,S=!0),!k){u.style.opacity="0";return}const C=h.getBoundingClientRect(),v=k.getBoundingClientRect();f.current?u.style.transition=[`top 150ms ${he}`,`left 150ms ${he}`,`width 150ms ${he}`,`height 150ms ${he}`,"opacity 100ms ease","background 150ms ease","box-shadow 150ms ease"].join(", "):(u.style.transition="none",f.current=!0),u.style.top=`${v.top-C.top}px`,u.style.left=`${v.left-C.left}px`,u.style.width=`${v.width}px`,u.style.height=`${v.height}px`,u.style.opacity="1",S?(u.style.background=n?"var(--lucent-surface-secondary)":"color-mix(in srgb, var(--lucent-accent-default) 12%, transparent)",u.style.boxShadow="none"):(u.style.background=n?"var(--lucent-surface)":"var(--lucent-accent-default)",u.style.boxShadow=n?"inset -3px 0 0 var(--lucent-accent-default), var(--lucent-shadow-sm)":"none")},[n]),g=c.useCallback(()=>{cancelAnimationFrame(w.current),w.current=requestAnimationFrame(y)},[y]);return c.useEffect(()=>{const h=p.current;if(!h)return;const u=new MutationObserver(g);return u.observe(h,{attributes:!0,attributeFilter:["data-active","data-active-parent","aria-hidden"],subtree:!0}),()=>u.disconnect()},[g]),c.useEffect(()=>{const h=p.current;if(!h)return;const u=new ResizeObserver(g);return u.observe(h),()=>u.disconnect()},[g]),c.useEffect(()=>{document.fonts.ready.then(g)},[g]),c.useEffect(()=>{g()},[t,n,o,g]),e.jsx(X.Provider,{value:{orientation:r,depth:0,inverse:n,size:o,hasIcons:a,parentHasIcon:!1,requestMeasure:g},children:e.jsxs("nav",{ref:p,"aria-label":s,style:{display:"flex",flexDirection:r==="vertical"?"column":"row",gap:d.itemGap,fontFamily:"var(--lucent-font-family-base)",fontSize:d.fontSize,position:"relative",...i},children:[e.jsx("div",{ref:m,"aria-hidden":!0,style:{position:"absolute",borderRadius:"var(--lucent-radius-md)",pointerEvents:"none",zIndex:0,opacity:0,top:0,left:0,width:0,height:0}}),t]})})}function mt({children:t,href:r,isActive:n=!1,icon:o,badge:a,disabled:i=!1,onClick:s,as:l,style:d}){const{orientation:p,depth:m,inverse:f,size:w,parentHasIcon:y,requestMeasure:g}=c.useContext(X),h=xe[w];c.useEffect(()=>{g()},[n,g]);let u=null;const b=[],x=Array.isArray(t)?t:[t];for(const S of x)S!=null&&typeof S=="object"&&"type"in S&&S.type===Fe?u=S:b.push(S);if(u)return e.jsx(mo,{subMenu:u,orientation:p,depth:m,inverse:f,size:w,isActive:n,disabled:i,...o!==void 0&&{icon:o},...a!==void 0&&{badge:a},...s!==void 0&&{onClick:s},...d!==void 0&&{style:d},children:b});const k=l??"a";return e.jsxs(k,{"data-lucent-navitem":"","data-active":n||void 0,href:i?void 0:r,onClick:i?void 0:s,"aria-current":n?"page":void 0,"aria-disabled":i||void 0,style:{display:"flex",alignItems:"center",gap:h.gap,padding:p==="vertical"?`${h.paddingY} ${h.paddingX} ${h.paddingY} ${o!=null||y?"var(--lucent-space-2)":"var(--lucent-space-4)"}`:`${h.paddingY} ${h.paddingX}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:i?"var(--lucent-text-disabled)":n?f?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",border:0,borderBottom:n&&p==="horizontal"?"2px solid var(--lucent-accent-default)":p==="horizontal"?"2px solid transparent":0,boxShadow:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:h.fontSize,fontWeight:n?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textDecoration:"none",cursor:i?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",position:"relative",zIndex:1,whiteSpace:p==="horizontal"?"nowrap":void 0,width:p==="vertical"?"100%":void 0,textAlign:"left",outline:"none",...d},children:[o!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:h.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:o}),e.jsx("span",{style:{flex:1},children:b}),a!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,marginLeft:"auto"},children:a})]})}function mo({children:t,icon:r,badge:n,isActive:o=!1,disabled:a=!1,onClick:i,style:s,subMenu:l,orientation:d,depth:p,inverse:m,size:f}){const{hasIcons:w,requestMeasure:y}=c.useContext(X),g=xe[f],[h,u]=c.useState(!1),b=c.useRef(null),[x,k]=c.useState(0),S=c.useRef(null),C=c.useRef(null),v=c.useRef(),z=go(l),T=o&&!z,E=!T&&!h&&z,F=o||z;c.useEffect(()=>{y()},[h,o,z,y]),c.useEffect(()=>{if(d!=="vertical")return;const M=b.current;if(M)if(h){const $=M.scrollHeight;k($);const V=setTimeout(()=>{k(void 0)},130);return()=>clearTimeout(V)}else k(M.scrollHeight),M.getBoundingClientRect(),k(0)},[h,d]),c.useEffect(()=>{if(d!=="horizontal"||!h)return;const M=$=>{S.current&&!S.current.contains($.target)&&q()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d,h]),c.useLayoutEffect(()=>{if(d!=="horizontal"||!h)return;const M=C.current;if(!M)return;const $=M.getBoundingClientRect();$.right>window.innerWidth&&(M.style.left="auto",M.style.right="0"),$.bottom>window.innerHeight&&(M.style.top="auto",M.style.bottom="100%",M.style.marginTop="0",M.style.marginBottom="var(--lucent-space-1)")},[d,h]);const[R,j]=c.useState("idle"),[P,D]=c.useState(!1),W=()=>{a||(D(!0),j("entering"),u(!0))},q=()=>{j("exiting"),setTimeout(()=>{u(!1),D(!1),j("idle")},Ie)},N=()=>{a||(d==="horizontal"?h?q():W():u(!h))},H=M=>{a||(d==="vertical"?(M.key==="ArrowRight"&&!h&&(M.preventDefault(),u(!0)),M.key==="ArrowLeft"&&h&&(M.preventDefault(),u(!1))):(M.key==="ArrowDown"&&!h&&(M.preventDefault(),W()),M.key==="ArrowUp"&&h&&(M.preventDefault(),q())),(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),N()),M.key==="Escape"&&h&&(M.preventDefault(),d==="horizontal"?q():u(!1)))},A=()=>{d==="horizontal"&&!a&&(clearTimeout(v.current),W())},B=()=>{d==="horizontal"&&(v.current=setTimeout(()=>q(),150))};return d==="horizontal"?e.jsxs("div",{ref:S,style:{position:"relative"},onMouseEnter:A,onMouseLeave:B,children:[e.jsxs("button",{"data-lucent-navitem":"","data-hint":F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":h,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:g.gap,padding:`${g.paddingY} ${g.paddingX}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:a?"var(--lucent-text-disabled)":F?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",border:0,borderBottom:F?"2px solid var(--lucent-accent-default)":"2px solid transparent",fontFamily:"var(--lucent-font-family-base)",fontSize:g.fontSize,fontWeight:F?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",whiteSpace:"nowrap",outline:"none",boxSizing:"border-box",...s},children:[r!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:g.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:r}),e.jsx("span",{children:t}),n!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0},children:n})]}),P&&e.jsx(X.Provider,{value:{orientation:"vertical",depth:0,inverse:m,size:f,hasIcons:w,parentHasIcon:!1,requestMeasure:y},children:e.jsx("div",{ref:C,style:{position:"absolute",top:"100%",left:0,marginTop:"var(--lucent-space-1)",minWidth:180,background:"var(--lucent-surface)",border:"1px solid var(--lucent-border-default)",borderRadius:"var(--lucent-radius-lg)",boxShadow:"var(--lucent-shadow-lg)",padding:"var(--lucent-space-1)",zIndex:100,animation:R==="exiting"?`lucent-navmenu-dropdown-out ${Ie}ms var(--lucent-easing-default) forwards`:`lucent-navmenu-dropdown-in ${Ie}ms var(--lucent-easing-default) forwards`},children:l})})]}):e.jsxs("div",{style:{position:"relative",zIndex:1},children:[e.jsxs("button",{"data-lucent-navitem":"","data-active":T||void 0,"data-active-parent":E||void 0,"data-hint":!T&&!E&&F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":h,"aria-disabled":a||void 0,style:{display:"flex",alignItems:"center",gap:g.gap,width:"100%",padding:`${g.paddingY} ${g.paddingX} ${g.paddingY} ${r!=null?"var(--lucent-space-2)":"var(--lucent-space-4)"}`,borderRadius:"var(--lucent-radius-md)",background:"transparent",color:a?"var(--lucent-text-disabled)":T?m?"var(--lucent-text-primary)":"var(--lucent-accent-fg)":E||F?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",border:0,boxShadow:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:g.fontSize,fontWeight:F?"var(--lucent-font-weight-medium)":"var(--lucent-font-weight-regular)",textAlign:"left",textDecoration:"none",cursor:a?"not-allowed":"pointer",transition:"background var(--lucent-duration-fast) var(--lucent-easing-default), color var(--lucent-duration-fast) var(--lucent-easing-default)",userSelect:"none",boxSizing:"border-box",outline:"none",...s},children:[r!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0,width:g.iconWidth,minWidth:14,minHeight:14,alignItems:"center",justifyContent:"center",color:"inherit"},children:r}),e.jsx("span",{style:{flex:1},children:t}),n!=null&&e.jsx("span",{style:{display:"flex",flexShrink:0},children:n})]}),e.jsx("div",{ref:b,"aria-hidden":!h,style:{overflow:"hidden",height:x!==void 0?x:"auto",transition:"height 120ms var(--lucent-easing-default)"},children:e.jsx(X.Provider,{value:{orientation:d,depth:p+1,inverse:m,size:f,hasIcons:w,parentHasIcon:r!=null,requestMeasure:y},children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:g.itemGap,padding:"var(--lucent-space-1) 0",marginLeft:r!=null?`calc(${g.iconWidth} + ${g.gap})`:"var(--lucent-space-3)",animation:h?"lucent-navmenu-open 200ms var(--lucent-easing-default) forwards":void 0},children:l})})})]})}function go(t){return De(t)}function De(t){if(t==null)return!1;if(Array.isArray(t))return t.some(De);if(typeof t=="object"&&"props"in t){const r=t;if(r.props.isActive)return!0;if(r.props.children)return De(r.props.children)}return!1}function Fe({children:t}){return e.jsx(e.Fragment,{children:t})}function gt({children:t,label:r,defaultOpen:n=!0,open:o,onOpenChange:a,collapsible:i,style:s}){const{orientation:l,inverse:d,size:p,hasIcons:m}=c.useContext(X),f=xe[p],w=i??r!=null,y=m?"var(--lucent-space-2)":"var(--lucent-space-4)";if(l==="horizontal")return e.jsx(e.Fragment,{children:t});const g=o!==void 0,[h,u]=c.useState(n),b=g?o:h,x=c.useRef(null),[k,S]=c.useState(b?void 0:0);c.useEffect(()=>{if(!w)return;const v=x.current;if(v)if(b){const z=v.scrollHeight;S(z);const T=setTimeout(()=>{S(void 0)},130);return()=>clearTimeout(T)}else S(v.scrollHeight),v.getBoundingClientRect(),S(0)},[b,w]);const C=c.useCallback(()=>{const v=!b;g||u(v),a==null||a(v)},[b,g,a]);return r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",marginTop:"var(--lucent-space-3)",...s},children:[w?e.jsxs("button",{onClick:C,"aria-expanded":b,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`var(--lucent-space-1) var(--lucent-space-3) var(--lucent-space-1) ${y}`,background:"none",border:0,cursor:"pointer",outline:"none",fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-semibold)",color:"var(--lucent-text-secondary)",letterSpacing:"0.05em",textTransform:"uppercase",textAlign:"left",userSelect:"none",marginBottom:b?"var(--lucent-space-1)":"0",transition:"margin-bottom 200ms var(--lucent-easing-default)"},children:[e.jsx("span",{children:r}),e.jsx(vo,{open:b,size:12})]}):e.jsx("div",{style:{padding:`var(--lucent-space-1) var(--lucent-space-3) var(--lucent-space-1) ${y}`,fontFamily:"var(--lucent-font-family-base)",fontSize:"var(--lucent-font-size-xs)",fontWeight:"var(--lucent-font-weight-semibold)",color:"var(--lucent-text-secondary)",letterSpacing:"0.05em",textTransform:"uppercase",userSelect:"none",marginBottom:"var(--lucent-space-1)"},children:r}),w?e.jsx("div",{ref:x,"aria-hidden":!b,style:{overflow:"hidden",height:k!==void 0?k:"auto",transition:"height 120ms var(--lucent-easing-default)"},children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:f.itemGap},children:t})}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:f.itemGap},children:t})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:f.itemGap,...s},children:t})}function vt({style:t}){const{orientation:r}=c.useContext(X);return e.jsx("div",{role:"separator",style:{...r==="vertical"?{height:1,margin:"var(--lucent-space-2) var(--lucent-space-4)"}:{width:1,alignSelf:"stretch",margin:"var(--lucent-space-1) var(--lucent-space-1)"},background:"var(--lucent-border-default)",flexShrink:0,...t}})}function vo({open:t,size:r=14}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,color:"var(--lucent-text-secondary)",transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms var(--lucent-easing-default)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}le.Item=mt;le.Group=gt;le.Sub=Fe;le.Separator=vt;const je=120,bo=`
510
510
  @keyframes lucent-filter-ms-in {
511
511
  from { opacity: 0; transform: scale(0.97) translateY(-2px); }
512
512
  to { opacity: 1; transform: scale(1) translateY(0); }
@@ -515,7 +515,7 @@ dismiss(id);`},{title:"Custom icon",description:"Override the built-in variant i
515
515
  from { opacity: 1; transform: scale(1) translateY(0); }
516
516
  to { opacity: 0; transform: scale(0.97) translateY(-2px); }
517
517
  }
518
- `;let et=!1;const yo={xs:"var(--lucent-space-1)",sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},xo={xs:"sm",sm:"sm",md:"md",lg:"lg"},Me=4;function wo(t,r){const n=r.offsetHeight,o=r.offsetWidth,a=window.innerWidth,i=window.innerHeight;let l=t.bottom+Me,s=t.left,d="top left";return l+n>i&&t.top-n-Me>=0&&(l=t.top-n-Me,d="bottom left"),s+o>a&&(s=a-o-8),s<0&&(s=8),{top:l,left:s,transformOrigin:d}}function ko({label:t,options:r,value:n,defaultValue:o=[],onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:f}){const m=n!==void 0,[p,k]=c.useState(o),x=m?n:p,[g,h]=c.useState(!1),[u,b]=c.useState(!1),[w,y]=c.useState("idle"),[S,I]=c.useState(null),[v,A]=c.useState(-1),T=c.useRef(null),z=c.useRef(null);if(!et&&typeof document<"u"){const q=document.createElement("style");q.textContent=bo,document.head.appendChild(q),et=!0}c.useEffect(()=>{if(g)b(!0),y("entering"),A(-1);else if(u){y("exiting");const q=setTimeout(()=>{b(!1),y("idle")},je);return()=>clearTimeout(q)}},[g]),c.useLayoutEffect(()=>{if(!u||w!=="entering"||!T.current)return;const q=requestAnimationFrame(()=>{const N=z.current,H=T.current;!N||!H||I(wo(H.getBoundingClientRect(),N))});return()=>cancelAnimationFrame(q)},[u,w]);const F=c.useCallback(()=>h(!1),[]);c.useEffect(()=>{if(!g)return;const q=H=>{var B,M;const E=H.target;(B=T.current)!=null&&B.contains(E)||(M=z.current)!=null&&M.contains(E)||F()},N=requestAnimationFrame(()=>{document.addEventListener("mousedown",q)});return()=>{cancelAnimationFrame(N),document.removeEventListener("mousedown",q)}},[g,F]),c.useEffect(()=>{if(!g)return;const q=N=>{N.key==="Escape"&&F()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[g,F]);const R=q=>{const N=x.includes(q)?x.filter(H=>H!==q):[...x,q];m||k(N),a==null||a(N)},j=()=>{m||k([]),a==null||a([]),F()},P=q=>{if(q.key==="ArrowDown")q.preventDefault(),A(N=>(N+1)%r.length);else if(q.key==="ArrowUp")q.preventDefault(),A(N=>(N-1+r.length)%r.length);else if((q.key==="Enter"||q.key===" ")&&v>=0){q.preventDefault();const N=r[v];N&&!N.disabled&&R(N.value)}},D=yo[l],W=xo[l];return e.jsxs("span",{ref:T,style:{display:"inline-flex",...f},children:[e.jsxs(C.Button,{variant:i==="outline"&&x.length>0?"secondary":i==="ghost"?"ghost":i,size:l,...t?{chevron:!0}:{},disabled:s,onClick:()=>!s&&h(q=>!q),...d!==void 0&&{leftIcon:d},children:[t||void 0,x.length>0&&e.jsx(se,{variant:"accent",size:l==="xs"?"sm":l,children:x.length})]}),u&&J.createPortal(e.jsxs("div",{ref:z,role:"listbox","aria-multiselectable":!0,"aria-label":t,tabIndex:-1,onKeyDown:P,style:{position:"fixed",top:(S==null?void 0:S.top)??-9999,left:(S==null?void 0:S.left)??-9999,zIndex:1e3,minWidth:180,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:D,maxHeight:"min(320px, calc(100vh - 32px))",overflowY:"auto",animation:w==="exiting"?`lucent-filter-ms-out ${je}ms var(--lucent-easing-default) forwards`:`lucent-filter-ms-in ${je}ms var(--lucent-easing-decelerate)`,transformOrigin:(S==null?void 0:S.transformOrigin)??"top left",outline:"none",pointerEvents:w==="exiting"?"none":"auto",fontFamily:"var(--lucent-font-family-base)"},children:[r.map((q,N)=>{const H=x.includes(q.value),E=v===N;return e.jsxs("div",{role:"option","aria-selected":H,"aria-disabled":q.disabled,onClick:()=>!q.disabled&&R(q.value),onMouseEnter:()=>A(N),style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",padding:`var(--lucent-space-2) ${D}`,borderRadius:"var(--lucent-radius-md)",cursor:q.disabled?"not-allowed":"pointer",background:E?"var(--lucent-surface-secondary)":"transparent",opacity:q.disabled?.5:1,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:[e.jsx(be,{checked:H,onChange:()=>{},disabled:q.disabled,style:{pointerEvents:"none"}}),q.swatch?e.jsx(se,{size:l==="xs"?"sm":l,swatch:q.swatch,children:q.label}):e.jsx(C.Text,{size:W,children:q.label})]},q.value)}),e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)"}}),e.jsx("div",{onClick:x.length>0?j:void 0,style:{display:"flex",alignItems:"center",padding:`var(--lucent-space-2) ${D}`,borderRadius:"var(--lucent-radius-md)",cursor:x.length>0?"pointer":"default",opacity:x.length>0?1:.5},children:e.jsx(C.Text,{size:W,color:x.length>0?"secondary":"disabled",children:"Clear all"})})]}),document.body)]})}function So({label:t,options:r,value:n,defaultValue:o,onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:f}){var w;const m=n!==void 0,[p,k]=c.useState(o),x=m?n:p,g=(w=r.find(y=>y.value===x))==null?void 0:w.label,h=x!==void 0,u=y=>{m||k(y),a==null||a(y)},b=()=>{m||k(void 0),a==null||a(void 0)};return e.jsxs(Le,{trigger:e.jsx(C.Button,{variant:i==="outline"&&h?"secondary":i,size:l,chevron:!0,disabled:s,...d!==void 0&&{leftIcon:d},children:g??t}),size:l,...f!==void 0&&{style:f},children:[r.map(y=>e.jsx(me,{selected:x===y.value,...y.disabled!==void 0&&{disabled:y.disabled},onSelect:()=>u(y.value),children:y.label},y.value)),h&&e.jsxs(e.Fragment,{children:[e.jsx(it,{}),e.jsx(me,{onSelect:b,children:e.jsx(C.Text,{size:l==="lg"?"md":"sm",color:"secondary",children:"Clear"})})]})]})}const To=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6.5",cy:"6.5",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});function Co({value:t,defaultValue:r="",onChange:n,placeholder:o="Search…",variant:a="secondary",size:i="sm",width:l=260,disabled:s=!1,style:d}){const f=t!==void 0,[m,p]=c.useState(r),k=f?t:m,[x,g]=c.useState(!!k),h=c.useRef(null);c.useEffect(()=>{x&&requestAnimationFrame(()=>{var y;return(y=h.current)==null?void 0:y.focus()})},[x]);const u=y=>{const S=y.target.value;f||p(S),n==null||n(S)},b=()=>{k||g(!1)},w=()=>{s||g(!0)};return x?e.jsx(C.Input,{ref:h,placeholder:o,size:i,value:k,onChange:u,onBlur:b,disabled:s,style:{width:l,...d}}):e.jsx(C.Button,{variant:a,size:i,disabled:s,onClick:w,"aria-label":"Search",leftIcon:e.jsx(To,{}),style:d})}function Io(t,r){if(!t)return r;const n=o=>o.toLocaleDateString();return`${n(t.start)} → ${n(t.end)}`}function jo({label:t="Date range",value:r,defaultValue:n,onChange:o,variant:a="secondary",size:i="sm",min:l,max:s,disabled:d=!1,style:f}){const m=r!==void 0;return e.jsx(pt,{size:i,...r!==void 0&&{value:r},...n!==void 0&&{defaultValue:n},...o!==void 0&&{onChange:o},...l!==void 0&&{min:l},...s!==void 0&&{max:s},disabled:d,trigger:e.jsx(C.Button,{variant:a==="outline"&&m?"secondary":a,size:i,chevron:!0,disabled:d,children:Io(r,t)}),...f!==void 0&&{style:f}})}const Mo={sm:{circle:24,checkIcon:12,connector:2,labelSize:"var(--lucent-font-size-xs)",descSize:"var(--lucent-font-size-xs)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-2)"},md:{circle:32,checkIcon:14,connector:2,labelSize:"var(--lucent-font-size-sm)",descSize:"var(--lucent-font-size-xs)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-3)"},lg:{circle:40,checkIcon:18,connector:3,labelSize:"var(--lucent-font-size-md)",descSize:"var(--lucent-font-size-sm)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-3)"}};function zo(t){return typeof t=="string"?{label:t}:t}function Eo({size:t}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Re(t,r){return t<r?"completed":t===r?"current":"pending"}const Ao={completed:"Completed",current:"In Progress",pending:"Pending"},qo={completed:"success",current:"accent",pending:"neutral"},tt="lucent-stepper-keyframes";function Do(){if(typeof document>"u"||document.getElementById(tt))return;const t=document.createElement("style");t.id=tt,t.textContent="@keyframes lucent-stepper-check{0%{transform:scale(0)}60%{transform:scale(1.2)}100%{transform:scale(1)}}",document.head.appendChild(t)}function bt({index:t,state:r,step:n,cfg:o}){const a=r!=="pending";return e.jsx("div",{"aria-current":r==="current"?"step":void 0,style:{width:o.circle,height:o.circle,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:o.labelSize,fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)",background:a?"var(--lucent-accent-default)":"color-mix(in srgb, var(--lucent-text-secondary) 12%, var(--lucent-surface))",color:a?"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",transition:"background var(--lucent-duration-base) var(--lucent-easing-default), color var(--lucent-duration-base) var(--lucent-easing-default)",flexShrink:0},children:n.icon?n.icon:r==="completed"?e.jsx("span",{style:{display:"flex",animation:"lucent-stepper-check 300ms cubic-bezier(0.34, 1.56, 0.64, 1)"},children:e.jsx(Eo,{size:o.checkIcon})}):t+1})}function yt({state:t}){return e.jsx(se,{variant:qo[t],size:"sm",borderless:!0,children:Ao[t]})}function Ro({step:t,state:r,index:n,cfg:o,numbered:a,showStatus:i}){return e.jsxs(e.Fragment,{children:[a&&e.jsxs("span",{style:{fontSize:o.prefixSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",textTransform:"uppercase",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:["Step ",n+1]}),e.jsx("span",{style:{fontSize:o.labelSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:r==="current"?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",color:r!=="pending"?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",transition:"color var(--lucent-duration-base) var(--lucent-easing-default)"},children:t.label}),t.description&&e.jsx("span",{style:{fontSize:o.descSize,fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)"},children:t.description}),i&&e.jsx(yt,{state:r})]})}function Bo({steps:t,current:r,cfg:n,numbered:o,showStatus:a}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:n.gap},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx("div",{style:{position:"absolute",left:n.circle/2,right:n.circle/2,top:n.circle/2-n.connector/2,height:n.connector,borderRadius:n.connector/2,background:"var(--lucent-border-default)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",borderRadius:n.connector/2,background:"var(--lucent-accent-default)",width:t.length>1?`${r/(t.length-1)*100}%`:"0%",transition:"width 300ms var(--lucent-easing-default)"}})}),t.map((i,l)=>e.jsx("div",{style:{flex:1,display:"flex",justifyContent:l===0?"flex-start":l===t.length-1?"flex-end":"center",position:"relative",zIndex:1},children:e.jsx(bt,{index:l,state:Re(l,r),step:i,cfg:n})},i.label))]}),e.jsx("div",{style:{display:"flex"},children:t.map((i,l)=>{const s=Re(l,r),d=l===t.length-1,f=l===0?"flex-start":d?"flex-end":"center",m=l===0?"left":d?"right":"center";return e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:f,gap:"2px",textAlign:m},children:e.jsx(Ro,{step:i,state:s,index:l,cfg:n,numbered:o,showStatus:a})},i.label)})})]})}function Po({steps:t,current:r,cfg:n,numbered:o,showStatus:a}){return e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:t.map((i,l)=>{const s=Re(l,r),d=l===t.length-1;return e.jsxs("div",{style:{display:"flex",gap:n.gap},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[e.jsx(bt,{index:l,state:s,step:i,cfg:n}),!d&&e.jsx("div",{style:{width:n.connector,flex:1,minHeight:24,borderRadius:n.connector/2,background:l<r?"var(--lucent-accent-default)":"var(--lucent-border-default)",transition:"background var(--lucent-duration-base) var(--lucent-easing-default)",margin:"4px 0"}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px",paddingTop:(n.circle-18)/2,paddingBottom:d?0:"var(--lucent-space-4)"},children:[o&&e.jsxs("span",{style:{fontSize:n.prefixSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",textTransform:"uppercase",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:["Step ",l+1]}),e.jsx("span",{style:{fontSize:n.labelSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:s==="current"?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",color:s!=="pending"?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",transition:"color var(--lucent-duration-base) var(--lucent-easing-default)"},children:i.label}),i.description&&e.jsx("span",{style:{fontSize:n.descSize,fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)"},children:i.description}),a&&e.jsx(yt,{state:s})]})]},i.label)})})}function Lo({steps:t,current:r,size:n="md",orientation:o="horizontal",numbered:a=!1,showStatus:i=!1,style:l}){c.useEffect(Do,[]);const s=Mo[n],d=t.map(zo),f=o==="vertical"?Po:Bo;return e.jsx("div",{role:"group","aria-label":"Progress steps",style:{fontFamily:"var(--lucent-font-family-base)",...l},children:e.jsx(f,{steps:d,current:r,cfg:s,numbered:a,showStatus:i})})}const Fo={id:"stepper",name:"Stepper",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A step indicator for multi-step flows — onboarding, wizards, checkout. Supports horizontal and vertical orientations with animated transitions.",designIntent:'Use Stepper to visualise progress through a sequence of discrete steps. Steps can be simple strings or objects with label, description, and custom icon. Completed steps show an animated checkmark (spring scale 0→1.2→1), the current step is highlighted with accent, and future steps are subdued. In horizontal mode the connector track runs behind all circles as a continuous bar; the filled portion animates smoothly between steps. First/last labels align left/right; middle labels center under their circles. Enable numbered to show "STEP N" prefixes and showStatus for Completed/In Progress/Pending Chip badges (success/accent/neutral variants). The vertical orientation suits sidebar layouts and forms with longer descriptive steps. Unlike Progress, Stepper is for discrete named stages, not continuous percentages.',props:[{name:"steps",type:"array",required:!0,description:"Step definitions. Each element is either a string (used as label) or an object { label: string, description?: string, icon?: ReactNode }. Custom icons override the default number/checkmark in the circle."},{name:"current",type:"number",required:!0,description:"Zero-based index of the active step. Steps before this index show as completed; steps after show as pending."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls circle diameter (sm=24, md=32, lg=40), checkmark size, connector thickness, and label font size.",enumValues:["sm","md","lg"]},{name:"orientation",type:"enum",required:!1,default:"horizontal",description:"Layout direction. Horizontal shows circles in a row with a connector track behind them; vertical stacks them with a connector column on the left.",enumValues:["horizontal","vertical"]},{name:"numbered",type:"boolean",required:!1,default:"false",description:'Show uppercase "STEP N" prefix above each step label.'},{name:"showStatus",type:"boolean",required:!1,default:"false",description:'Show a Chip badge below each label — "Completed" (success), "In Progress" (accent), or "Pending" (neutral).'},{name:"style",type:"object",required:!1,description:"Inline style overrides for the root container."}],usageExamples:[{title:"Basic horizontal",code:"<Stepper steps={['Profile', 'Preferences', 'Confirm']} current={1} />",description:"Minimal stepper — string labels, no extras."},{title:"Numbered with status badges",code:`<Stepper
518
+ `;let et=!1;const yo={xs:"var(--lucent-space-1)",sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},xo={xs:"sm",sm:"sm",md:"md",lg:"lg"},Me=4;function wo(t,r){const n=r.offsetHeight,o=r.offsetWidth,a=window.innerWidth,i=window.innerHeight;let s=t.bottom+Me,l=t.left,d="top left";return s+n>i&&t.top-n-Me>=0&&(s=t.top-n-Me,d="bottom left"),l+o>a&&(l=a-o-8),l<0&&(l=8),{top:s,left:l,transformOrigin:d}}function ko({label:t,options:r,value:n,defaultValue:o=[],onChange:a,variant:i="secondary",size:s="sm",disabled:l=!1,icon:d,style:p}){const m=n!==void 0,[f,w]=c.useState(o),y=m?n:f,[g,h]=c.useState(!1),[u,b]=c.useState(!1),[x,k]=c.useState("idle"),[S,C]=c.useState(null),[v,z]=c.useState(-1),T=c.useRef(null),E=c.useRef(null);if(!et&&typeof document<"u"){const q=document.createElement("style");q.textContent=bo,document.head.appendChild(q),et=!0}c.useEffect(()=>{if(g)b(!0),k("entering"),z(-1);else if(u){k("exiting");const q=setTimeout(()=>{b(!1),k("idle")},je);return()=>clearTimeout(q)}},[g]),c.useLayoutEffect(()=>{if(!u||x!=="entering"||!T.current)return;const q=requestAnimationFrame(()=>{const N=E.current,H=T.current;!N||!H||C(wo(H.getBoundingClientRect(),N))});return()=>cancelAnimationFrame(q)},[u,x]);const F=c.useCallback(()=>h(!1),[]);c.useEffect(()=>{if(!g)return;const q=H=>{var B,M;const A=H.target;(B=T.current)!=null&&B.contains(A)||(M=E.current)!=null&&M.contains(A)||F()},N=requestAnimationFrame(()=>{document.addEventListener("mousedown",q)});return()=>{cancelAnimationFrame(N),document.removeEventListener("mousedown",q)}},[g,F]),c.useEffect(()=>{if(!g)return;const q=N=>{N.key==="Escape"&&F()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[g,F]);const R=q=>{const N=y.includes(q)?y.filter(H=>H!==q):[...y,q];m||w(N),a==null||a(N)},j=()=>{m||w([]),a==null||a([]),F()},P=q=>{if(q.key==="ArrowDown")q.preventDefault(),z(N=>(N+1)%r.length);else if(q.key==="ArrowUp")q.preventDefault(),z(N=>(N-1+r.length)%r.length);else if((q.key==="Enter"||q.key===" ")&&v>=0){q.preventDefault();const N=r[v];N&&!N.disabled&&R(N.value)}},D=yo[s],W=xo[s];return e.jsxs("span",{ref:T,style:{display:"inline-flex",...p},children:[e.jsxs(I.Button,{variant:i==="outline"&&y.length>0?"secondary":i==="ghost"?"ghost":i,size:s,...t?{chevron:!0}:{},disabled:l,onClick:()=>!l&&h(q=>!q),...d!==void 0&&{leftIcon:d},children:[t||void 0,y.length>0&&e.jsx(se,{variant:"accent",size:s==="xs"?"sm":s,children:y.length})]}),u&&J.createPortal(e.jsxs("div",{ref:E,role:"listbox","aria-multiselectable":!0,"aria-label":t,tabIndex:-1,onKeyDown:P,style:{position:"fixed",top:(S==null?void 0:S.top)??-9999,left:(S==null?void 0:S.left)??-9999,zIndex:1e3,minWidth:180,background:"color-mix(in srgb, var(--lucent-surface-overlay) 85%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",border:"1px solid color-mix(in srgb, var(--lucent-accent-default) 15%, var(--lucent-border-default))",borderRadius:"var(--lucent-radius-lg)",boxShadow:"0 0 24px -4px color-mix(in srgb, var(--lucent-accent-default) 12%, transparent), var(--lucent-shadow-md)",padding:D,maxHeight:"min(320px, calc(100vh - 32px))",overflowY:"auto",animation:x==="exiting"?`lucent-filter-ms-out ${je}ms var(--lucent-easing-default) forwards`:`lucent-filter-ms-in ${je}ms var(--lucent-easing-decelerate)`,transformOrigin:(S==null?void 0:S.transformOrigin)??"top left",outline:"none",pointerEvents:x==="exiting"?"none":"auto",fontFamily:"var(--lucent-font-family-base)"},children:[r.map((q,N)=>{const H=y.includes(q.value),A=v===N;return e.jsxs("div",{role:"option","aria-selected":H,"aria-disabled":q.disabled,onClick:()=>!q.disabled&&R(q.value),onMouseEnter:()=>z(N),style:{display:"flex",alignItems:"center",gap:"var(--lucent-space-2)",padding:`var(--lucent-space-2) ${D}`,borderRadius:"var(--lucent-radius-md)",cursor:q.disabled?"not-allowed":"pointer",background:A?"var(--lucent-surface-secondary)":"transparent",opacity:q.disabled?.5:1,transition:"background var(--lucent-duration-fast) var(--lucent-easing-default)"},children:[e.jsx(be,{checked:H,onChange:()=>{},disabled:q.disabled,style:{pointerEvents:"none"}}),q.swatch?e.jsx(se,{size:s==="xs"?"sm":s,swatch:q.swatch,children:q.label}):e.jsx(I.Text,{size:W,children:q.label})]},q.value)}),e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)"}}),e.jsx("div",{onClick:y.length>0?j:void 0,style:{display:"flex",alignItems:"center",padding:`var(--lucent-space-2) ${D}`,borderRadius:"var(--lucent-radius-md)",cursor:y.length>0?"pointer":"default",opacity:y.length>0?1:.5},children:e.jsx(I.Text,{size:W,color:y.length>0?"secondary":"disabled",children:"Clear all"})})]}),document.body)]})}function So({label:t,options:r,value:n,defaultValue:o,onChange:a,variant:i="secondary",size:s="sm",disabled:l=!1,icon:d,style:p}){var x;const m=n!==void 0,[f,w]=c.useState(o),y=m?n:f,g=(x=r.find(k=>k.value===y))==null?void 0:x.label,h=y!==void 0,u=k=>{m||w(k),a==null||a(k)},b=()=>{m||w(void 0),a==null||a(void 0)};return e.jsxs(Le,{trigger:e.jsx(I.Button,{variant:i==="outline"&&h?"secondary":i,size:s,chevron:!0,disabled:l,...d!==void 0&&{leftIcon:d},children:g??t}),size:s,...p!==void 0&&{style:p},children:[r.map(k=>e.jsx(me,{selected:y===k.value,...k.disabled!==void 0&&{disabled:k.disabled},onSelect:()=>u(k.value),children:k.label},k.value)),h&&e.jsxs(e.Fragment,{children:[e.jsx(it,{}),e.jsx(me,{onSelect:b,children:e.jsx(I.Text,{size:s==="lg"?"md":"sm",color:"secondary",children:"Clear"})})]})]})}const To=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6.5",cy:"6.5",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});function Co({value:t,defaultValue:r="",onChange:n,placeholder:o="Search…",variant:a="secondary",size:i="sm",width:s=260,disabled:l=!1,style:d}){const p=t!==void 0,[m,f]=c.useState(r),w=p?t:m,[y,g]=c.useState(!!w),h=c.useRef(null);c.useEffect(()=>{y&&requestAnimationFrame(()=>{var k;return(k=h.current)==null?void 0:k.focus()})},[y]);const u=k=>{const S=k.target.value;p||f(S),n==null||n(S)},b=()=>{w||g(!1)},x=()=>{l||g(!0)};return y?e.jsx(I.Input,{ref:h,placeholder:o,size:i,value:w,onChange:u,onBlur:b,disabled:l,style:{width:s,...d}}):e.jsx(I.Button,{variant:a,size:i,disabled:l,onClick:x,"aria-label":"Search",leftIcon:e.jsx(To,{}),style:d})}function Io(t,r){if(!t)return r;const n=o=>o.toLocaleDateString();return`${n(t.start)} → ${n(t.end)}`}function jo({label:t="Date range",value:r,defaultValue:n,onChange:o,variant:a="secondary",size:i="sm",min:s,max:l,disabled:d=!1,style:p}){const m=r!==void 0;return e.jsx(pt,{size:i,...r!==void 0&&{value:r},...n!==void 0&&{defaultValue:n},...o!==void 0&&{onChange:o},...s!==void 0&&{min:s},...l!==void 0&&{max:l},disabled:d,trigger:e.jsx(I.Button,{variant:a==="outline"&&m?"secondary":a,size:i,chevron:!0,disabled:d,children:Io(r,t)}),...p!==void 0&&{style:p}})}const Mo={sm:{circle:24,checkIcon:12,connector:2,labelSize:"var(--lucent-font-size-xs)",descSize:"var(--lucent-font-size-xs)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-2)"},md:{circle:32,checkIcon:14,connector:2,labelSize:"var(--lucent-font-size-sm)",descSize:"var(--lucent-font-size-xs)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-3)"},lg:{circle:40,checkIcon:18,connector:3,labelSize:"var(--lucent-font-size-md)",descSize:"var(--lucent-font-size-sm)",prefixSize:"var(--lucent-font-size-xs)",gap:"var(--lucent-space-3)"}};function zo(t){return typeof t=="string"?{label:t}:t}function Eo({size:t}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Re(t,r){return t<r?"completed":t===r?"current":"pending"}const Ao={completed:"Completed",current:"In Progress",pending:"Pending"},qo={completed:"success",current:"accent",pending:"neutral"},tt="lucent-stepper-keyframes";function Do(){if(typeof document>"u"||document.getElementById(tt))return;const t=document.createElement("style");t.id=tt,t.textContent="@keyframes lucent-stepper-check{0%{transform:scale(0)}60%{transform:scale(1.2)}100%{transform:scale(1)}}",document.head.appendChild(t)}function bt({index:t,state:r,step:n,cfg:o}){const a=r!=="pending";return e.jsx("div",{"aria-current":r==="current"?"step":void 0,style:{width:o.circle,height:o.circle,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:o.labelSize,fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)",background:a?"var(--lucent-accent-default)":"color-mix(in srgb, var(--lucent-text-secondary) 12%, var(--lucent-surface))",color:a?"var(--lucent-accent-fg)":"var(--lucent-text-secondary)",transition:"background var(--lucent-duration-base) var(--lucent-easing-default), color var(--lucent-duration-base) var(--lucent-easing-default)",flexShrink:0},children:n.icon?n.icon:r==="completed"?e.jsx("span",{style:{display:"flex",animation:"lucent-stepper-check 300ms cubic-bezier(0.34, 1.56, 0.64, 1)"},children:e.jsx(Eo,{size:o.checkIcon})}):t+1})}function yt({state:t}){return e.jsx(se,{variant:qo[t],size:"sm",borderless:!0,children:Ao[t]})}function Ro({step:t,state:r,index:n,cfg:o,numbered:a,showStatus:i}){return e.jsxs(e.Fragment,{children:[a&&e.jsxs("span",{style:{fontSize:o.prefixSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",textTransform:"uppercase",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:["Step ",n+1]}),e.jsx("span",{style:{fontSize:o.labelSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:r==="current"?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",color:r!=="pending"?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",transition:"color var(--lucent-duration-base) var(--lucent-easing-default)"},children:t.label}),t.description&&e.jsx("span",{style:{fontSize:o.descSize,fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)"},children:t.description}),i&&e.jsx(yt,{state:r})]})}function Bo({steps:t,current:r,cfg:n,numbered:o,showStatus:a}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:n.gap},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx("div",{style:{position:"absolute",left:n.circle/2,right:n.circle/2,top:n.circle/2-n.connector/2,height:n.connector,borderRadius:n.connector/2,background:"var(--lucent-border-default)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",borderRadius:n.connector/2,background:"var(--lucent-accent-default)",width:t.length>1?`${r/(t.length-1)*100}%`:"0%",transition:"width 300ms var(--lucent-easing-default)"}})}),t.map((i,s)=>e.jsx("div",{style:{flex:1,display:"flex",justifyContent:s===0?"flex-start":s===t.length-1?"flex-end":"center",position:"relative",zIndex:1},children:e.jsx(bt,{index:s,state:Re(s,r),step:i,cfg:n})},i.label))]}),e.jsx("div",{style:{display:"flex"},children:t.map((i,s)=>{const l=Re(s,r),d=s===t.length-1,p=s===0?"flex-start":d?"flex-end":"center",m=s===0?"left":d?"right":"center";return e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:p,gap:"2px",textAlign:m},children:e.jsx(Ro,{step:i,state:l,index:s,cfg:n,numbered:o,showStatus:a})},i.label)})})]})}function Po({steps:t,current:r,cfg:n,numbered:o,showStatus:a}){return e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:t.map((i,s)=>{const l=Re(s,r),d=s===t.length-1;return e.jsxs("div",{style:{display:"flex",gap:n.gap},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[e.jsx(bt,{index:s,state:l,step:i,cfg:n}),!d&&e.jsx("div",{style:{width:n.connector,flex:1,minHeight:24,borderRadius:n.connector/2,background:s<r?"var(--lucent-accent-default)":"var(--lucent-border-default)",transition:"background var(--lucent-duration-base) var(--lucent-easing-default)",margin:"4px 0"}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px",paddingTop:(n.circle-18)/2,paddingBottom:d?0:"var(--lucent-space-4)"},children:[o&&e.jsxs("span",{style:{fontSize:n.prefixSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:"var(--lucent-font-weight-medium)",color:"var(--lucent-text-secondary)",textTransform:"uppercase",letterSpacing:"var(--lucent-letter-spacing-wide)"},children:["Step ",s+1]}),e.jsx("span",{style:{fontSize:n.labelSize,fontFamily:"var(--lucent-font-family-base)",fontWeight:l==="current"?"var(--lucent-font-weight-semibold)":"var(--lucent-font-weight-regular)",color:l!=="pending"?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",transition:"color var(--lucent-duration-base) var(--lucent-easing-default)"},children:i.label}),i.description&&e.jsx("span",{style:{fontSize:n.descSize,fontFamily:"var(--lucent-font-family-base)",color:"var(--lucent-text-secondary)"},children:i.description}),a&&e.jsx(yt,{state:l})]})]},i.label)})})}function Lo({steps:t,current:r,size:n="md",orientation:o="horizontal",numbered:a=!1,showStatus:i=!1,style:s}){c.useEffect(Do,[]);const l=Mo[n],d=t.map(zo),p=o==="vertical"?Po:Bo;return e.jsx("div",{role:"group","aria-label":"Progress steps",style:{fontFamily:"var(--lucent-font-family-base)",...s},children:e.jsx(p,{steps:d,current:r,cfg:l,numbered:a,showStatus:i})})}const Fo={id:"stepper",name:"Stepper",tier:"molecule",domain:"neutral",specVersion:"1.0",description:"A step indicator for multi-step flows — onboarding, wizards, checkout. Supports horizontal and vertical orientations with animated transitions.",designIntent:'Use Stepper to visualise progress through a sequence of discrete steps. Steps can be simple strings or objects with label, description, and custom icon. Completed steps show an animated checkmark (spring scale 0→1.2→1), the current step is highlighted with accent, and future steps are subdued. In horizontal mode the connector track runs behind all circles as a continuous bar; the filled portion animates smoothly between steps. First/last labels align left/right; middle labels center under their circles. Enable numbered to show "STEP N" prefixes and showStatus for Completed/In Progress/Pending Chip badges (success/accent/neutral variants). The vertical orientation suits sidebar layouts and forms with longer descriptive steps. Unlike Progress, Stepper is for discrete named stages, not continuous percentages.',props:[{name:"steps",type:"array",required:!0,description:"Step definitions. Each element is either a string (used as label) or an object { label: string, description?: string, icon?: ReactNode }. Custom icons override the default number/checkmark in the circle."},{name:"current",type:"number",required:!0,description:"Zero-based index of the active step. Steps before this index show as completed; steps after show as pending."},{name:"size",type:"enum",required:!1,default:"md",description:"Controls circle diameter (sm=24, md=32, lg=40), checkmark size, connector thickness, and label font size.",enumValues:["sm","md","lg"]},{name:"orientation",type:"enum",required:!1,default:"horizontal",description:"Layout direction. Horizontal shows circles in a row with a connector track behind them; vertical stacks them with a connector column on the left.",enumValues:["horizontal","vertical"]},{name:"numbered",type:"boolean",required:!1,default:"false",description:'Show uppercase "STEP N" prefix above each step label.'},{name:"showStatus",type:"boolean",required:!1,default:"false",description:'Show a Chip badge below each label — "Completed" (success), "In Progress" (accent), or "Pending" (neutral).'},{name:"style",type:"object",required:!1,description:"Inline style overrides for the root container."}],usageExamples:[{title:"Basic horizontal",code:"<Stepper steps={['Profile', 'Preferences', 'Confirm']} current={1} />",description:"Minimal stepper — string labels, no extras."},{title:"Numbered with status badges",code:`<Stepper
519
519
  steps={['Basic Details', 'Company Details', 'Subscription', 'Payment']}
520
520
  current={2}
521
521
  numbered
@@ -641,6 +641,6 @@ const myTheme = createTheme({
641
641
  <App />
642
642
  </main>
643
643
  </div>
644
- </LucentProvider>`}],compositionGraph:[]},Wo={accentDefault:"#e9c96b",accentHover:"#ddb84e",accentSubtle:"#fef9ec"};function Oo(t,r="light"){const n=r==="light";return{accentDefault:t,accentHover:C.adjustLightness(t,n?.05:-.07),accentSubtle:C.adjustLightness(t,n?.85:-.6),accentBorder:C.adjustLightness(t,n?-.15:.15),accentFg:C.getAccentFg(t)}}function Y(t,r){return{field:t,message:r}}function xt(t){const r=[];if(typeof t!="object"||t===null)return{valid:!1,errors:[Y("manifest","Must be a non-null object")]};const n=t,o=["id","name","description","designIntent","specVersion"];for(const i of o)(typeof n[i]!="string"||n[i].trim()==="")&&r.push(Y(i,"Must be a non-empty string"));typeof n.id=="string"&&!/^[a-z][a-z0-9-]*$/.test(n.id)&&r.push(Y("id",'Must be kebab-case (e.g. "button", "form-field")'));const a=["atom","molecule","block","flow","overlay","provider"];return a.includes(n.tier)||r.push(Y("tier",`Must be one of: ${a.join(", ")}`)),(typeof n.domain!="string"||n.domain.trim()==="")&&r.push(Y("domain","Must be a non-empty string")),Array.isArray(n.props)?n.props.forEach((i,l)=>{const s=i,d=`props[${l}]`;(typeof s.name!="string"||s.name==="")&&r.push(Y(`${d}.name`,"Must be a non-empty string")),(typeof s.type!="string"||s.type==="")&&r.push(Y(`${d}.type`,"Must be a non-empty string")),typeof s.required!="boolean"&&r.push(Y(`${d}.required`,"Must be a boolean")),(typeof s.description!="string"||s.description==="")&&r.push(Y(`${d}.description`,"Must be a non-empty string"))}):r.push(Y("props","Must be an array")),Array.isArray(n.usageExamples)?n.usageExamples.length===0?r.push(Y("usageExamples","Must have at least one example")):n.usageExamples.forEach((i,l)=>{const s=i,d=`usageExamples[${l}]`;(typeof s.title!="string"||s.title==="")&&r.push(Y(`${d}.title`,"Must be a non-empty string")),(typeof s.code!="string"||s.code==="")&&r.push(Y(`${d}.code`,"Must be a non-empty string"))}):r.push(Y("usageExamples","Must be an array")),Array.isArray(n.compositionGraph)||r.push(Y("compositionGraph","Must be an array (empty array is fine for atoms)")),typeof n.specVersion=="string"&&!/^\d+\.\d+$/.test(n.specVersion)&&r.push(Y("specVersion",'Must be "MAJOR.MINOR" format, e.g. "0.1"')),{valid:r.length===0,errors:r}}function Vo(t){const r=xt(t);if(!r.valid){const n=r.errors.map(o=>` ${o.field}: ${o.message}`).join(`
644
+ </LucentProvider>`}],compositionGraph:[]},Wo={accentDefault:"#e9c96b",accentHover:"#ddb84e",accentSubtle:"#fef9ec"};function Oo(t,r="light"){const n=r==="light";return{accentDefault:t,accentHover:I.adjustLightness(t,n?.05:-.07),accentSubtle:I.adjustLightness(t,n?.85:-.6),accentBorder:I.adjustLightness(t,n?-.15:.15),accentFg:I.getAccentFg(t)}}function Y(t,r){return{field:t,message:r}}function xt(t){const r=[];if(typeof t!="object"||t===null)return{valid:!1,errors:[Y("manifest","Must be a non-null object")]};const n=t,o=["id","name","description","designIntent","specVersion"];for(const i of o)(typeof n[i]!="string"||n[i].trim()==="")&&r.push(Y(i,"Must be a non-empty string"));typeof n.id=="string"&&!/^[a-z][a-z0-9-]*$/.test(n.id)&&r.push(Y("id",'Must be kebab-case (e.g. "button", "form-field")'));const a=["atom","molecule","block","flow","overlay","provider"];return a.includes(n.tier)||r.push(Y("tier",`Must be one of: ${a.join(", ")}`)),(typeof n.domain!="string"||n.domain.trim()==="")&&r.push(Y("domain","Must be a non-empty string")),Array.isArray(n.props)?n.props.forEach((i,s)=>{const l=i,d=`props[${s}]`;(typeof l.name!="string"||l.name==="")&&r.push(Y(`${d}.name`,"Must be a non-empty string")),(typeof l.type!="string"||l.type==="")&&r.push(Y(`${d}.type`,"Must be a non-empty string")),typeof l.required!="boolean"&&r.push(Y(`${d}.required`,"Must be a boolean")),(typeof l.description!="string"||l.description==="")&&r.push(Y(`${d}.description`,"Must be a non-empty string"))}):r.push(Y("props","Must be an array")),Array.isArray(n.usageExamples)?n.usageExamples.length===0?r.push(Y("usageExamples","Must have at least one example")):n.usageExamples.forEach((i,s)=>{const l=i,d=`usageExamples[${s}]`;(typeof l.title!="string"||l.title==="")&&r.push(Y(`${d}.title`,"Must be a non-empty string")),(typeof l.code!="string"||l.code==="")&&r.push(Y(`${d}.code`,"Must be a non-empty string"))}):r.push(Y("usageExamples","Must be an array")),Array.isArray(n.compositionGraph)||r.push(Y("compositionGraph","Must be an array (empty array is fine for atoms)")),typeof n.specVersion=="string"&&!/^\d+\.\d+$/.test(n.specVersion)&&r.push(Y("specVersion",'Must be "MAJOR.MINOR" format, e.g. "0.1"')),{valid:r.length===0,errors:r}}function Vo(t){const r=xt(t);if(!r.valid){const n=r.errors.map(o=>` ${o.field}: ${o.message}`).join(`
645
645
  `);throw new Error(`Invalid ComponentManifest:
646
- ${n}`)}}function Ho(t){if(typeof t!="object"||t===null)return!1;const r=t;return typeof r.name=="string"&&typeof r.type=="string"&&typeof r.required=="boolean"&&typeof r.description=="string"}const Go="1.0",Uo="0.1.0";exports.Badge=C.Badge;exports.Button=C.Button;exports.ColorPicker=C.ColorPicker;exports.ColorSwatch=C.ColorSwatch;exports.Input=C.Input;exports.LucentProvider=C.LucentProvider;exports.SegmentedControl=C.SegmentedControl;exports.Select=C.Select;exports.Slider=C.Slider;exports.Tabs=C.Tabs;exports.Text=C.Text;exports.Toggle=C.Toggle;exports.bentoPreset=C.bentoPreset;exports.bloomPreset=C.bloomPreset;exports.brandPalette=C.brandPalette;exports.brutalistPreset=C.brutalistPreset;exports.brutalistShadow=C.brutalistShadow;exports.compactDensity=C.compactDensity;exports.createTheme=C.createTheme;exports.darkTokens=C.darkTokens;exports.defaultDensity=C.defaultDensity;exports.defaultPalette=C.defaultPalette;exports.deriveDarkFromLight=C.deriveDarkFromLight;exports.deriveTokens=C.deriveTokens;exports.elevatedShadow=C.elevatedShadow;exports.emeraldPalette=C.emeraldPalette;exports.enterprisePreset=C.enterprisePreset;exports.flatShadow=C.flatShadow;exports.getAccentFg=C.getAccentFg;exports.getContrastText=C.getContrastText;exports.glowShadow=C.glowShadow;exports.indigoPalette=C.indigoPalette;exports.lightTokens=C.lightTokens;exports.liquidGlassPreset=C.liquidGlassPreset;exports.liquidGlassShadow=C.liquidGlassShadow;exports.makeLibraryCSS=C.makeLibraryCSS;exports.minimalPreset=C.minimalPreset;exports.modernPreset=C.modernPreset;exports.naturalShadow=C.naturalShadow;exports.neumorphicShadow=C.neumorphicShadow;exports.oceanPalette=C.oceanPalette;exports.pillShape=C.pillShape;exports.playfulPreset=C.playfulPreset;exports.resolvePreset=C.resolvePreset;exports.rosePalette=C.rosePalette;exports.roundedShape=C.roundedShape;exports.sharpShape=C.sharpShape;exports.softUIPreset=C.softUIPreset;exports.spaciousDensity=C.spaciousDensity;exports.subtleShadow=C.subtleShadow;exports.terminalPreset=C.terminalPreset;exports.useLucent=C.useLucent;exports.Alert=Pr;exports.AlertManifest=Lr;exports.Avatar=Bt;exports.AvatarManifest=Pt;exports.BadgeManifest=jt;exports.Breadcrumb=Hr;exports.ButtonGroup=ct;exports.ButtonGroupManifest=or;exports.ButtonManifest=wt;exports.CHIP_MANIFEST=At;exports.COLOR_PICKER_MANIFEST=Mn;exports.COLOR_SWATCH_MANIFEST=zn;exports.COMMAND_PALETTE_MANIFEST=ia;exports.Card=Ir;exports.CardBleed=jr;exports.CardManifest=Mr;exports.CardPaddingContext=ye;exports.Checkbox=be;exports.CheckboxManifest=Gt;exports.Chip=se;exports.CodeBlock=yn;exports.CodeBlockManifest=xn;exports.Collapsible=_r;exports.CommandPalette=oa;exports.DATA_TABLE_MANIFEST=na;exports.DATE_PICKER_MANIFEST=Ma;exports.DATE_RANGE_PICKER_MANIFEST=Ra;exports.DataTable=Zr;exports.DatePicker=ja;exports.DateRangePicker=pt;exports.Divider=$t;exports.DividerManifest=Wt;exports.EmptyState=Fr;exports.EmptyStateManifest=Nr;exports.FILE_UPLOAD_MANIFEST=Fa;exports.FileUpload=La;exports.FilterDateRange=jo;exports.FilterMultiSelect=ko;exports.FilterSearch=Co;exports.FilterSelect=So;exports.FormField=ir;exports.FormFieldManifest=sr;exports.Icon=un;exports.IconManifest=pn;exports.InputManifest=kt;exports.LUCENT_UI_VERSION=Uo;exports.LucentProviderManifest=$o;exports.MANIFEST_SPEC_VERSION=Go;exports.MULTI_SELECT_MANIFEST=pa;exports.Menu=Le;exports.MenuGroup=Kn;exports.MenuItem=me;exports.MenuManifest=Xn;exports.MenuSeparator=it;exports.MultiSelect=ua;exports.NavLink=hn;exports.NavMenu=le;exports.NavMenuGroup=gt;exports.NavMenuItem=mt;exports.NavMenuSeparator=vt;exports.NavMenuSub=Fe;exports.PageLayout=Xr;exports.Progress=On;exports.ProgressManifest=Vn;exports.Radio=Xt;exports.RadioGroup=ot;exports.RadioGroupUncontrolled=Jt;exports.RadioManifest=Zt;exports.Row=Ln;exports.RowManifest=Fn;exports.SEGMENTED_CONTROL_MANIFEST=En;exports.SearchInput=fr;exports.SearchInputManifest=hr;exports.SelectManifest=en;exports.Skeleton=Or;exports.SkeletonManifest=Vr;exports.SliderManifest=mn;exports.Spinner=rt;exports.SpinnerManifest=Nt;exports.SplitButton=lt;exports.SplitButtonManifest=ar;exports.Stack=Dn;exports.StackManifest=Rn;exports.Stepper=Lo;exports.StepperManifest=Fo;exports.TIMELINE_MANIFEST=Oa;exports.Table=ne;exports.TableManifest=jn;exports.Tag=rn;exports.TagManifest=an;exports.TextManifest=fn;exports.Textarea=nt;exports.TextareaManifest=It;exports.ThemeAnchorsSpec=No;exports.Timeline=Wa;exports.ToastManifest=fo;exports.ToastProvider=po;exports.ToggleManifest=Qt;exports.Tooltip=ln;exports.TooltipManifest=cn;exports.accentTokens=Oo;exports.assertManifest=Vo;exports.brandTokens=Wo;exports.isValidPropDescriptor=Ho;exports.useToast=Va;exports.validateManifest=xt;
646
+ ${n}`)}}function Ho(t){if(typeof t!="object"||t===null)return!1;const r=t;return typeof r.name=="string"&&typeof r.type=="string"&&typeof r.required=="boolean"&&typeof r.description=="string"}const Go="1.0",Uo="0.1.0";exports.Badge=I.Badge;exports.Button=I.Button;exports.ColorPicker=I.ColorPicker;exports.ColorSwatch=I.ColorSwatch;exports.Input=I.Input;exports.LucentProvider=I.LucentProvider;exports.SegmentedControl=I.SegmentedControl;exports.Select=I.Select;exports.Slider=I.Slider;exports.Tabs=I.Tabs;exports.Text=I.Text;exports.Toggle=I.Toggle;exports.bentoPreset=I.bentoPreset;exports.bloomPreset=I.bloomPreset;exports.brandPalette=I.brandPalette;exports.brutalistPreset=I.brutalistPreset;exports.brutalistShadow=I.brutalistShadow;exports.compactDensity=I.compactDensity;exports.createTheme=I.createTheme;exports.darkTokens=I.darkTokens;exports.defaultDensity=I.defaultDensity;exports.defaultPalette=I.defaultPalette;exports.deriveDarkFromLight=I.deriveDarkFromLight;exports.deriveTokens=I.deriveTokens;exports.elevatedShadow=I.elevatedShadow;exports.emeraldPalette=I.emeraldPalette;exports.enterprisePreset=I.enterprisePreset;exports.flatShadow=I.flatShadow;exports.getAccentFg=I.getAccentFg;exports.getContrastText=I.getContrastText;exports.glowShadow=I.glowShadow;exports.indigoPalette=I.indigoPalette;exports.lightTokens=I.lightTokens;exports.liquidGlassPreset=I.liquidGlassPreset;exports.liquidGlassShadow=I.liquidGlassShadow;exports.makeLibraryCSS=I.makeLibraryCSS;exports.minimalPreset=I.minimalPreset;exports.modernPreset=I.modernPreset;exports.naturalShadow=I.naturalShadow;exports.neumorphicShadow=I.neumorphicShadow;exports.oceanPalette=I.oceanPalette;exports.pillShape=I.pillShape;exports.playfulPreset=I.playfulPreset;exports.resolvePreset=I.resolvePreset;exports.rosePalette=I.rosePalette;exports.roundedShape=I.roundedShape;exports.sharpShape=I.sharpShape;exports.softUIPreset=I.softUIPreset;exports.spaciousDensity=I.spaciousDensity;exports.subtleShadow=I.subtleShadow;exports.terminalPreset=I.terminalPreset;exports.useLucent=I.useLucent;exports.Alert=Pr;exports.AlertManifest=Lr;exports.Avatar=Bt;exports.AvatarManifest=Pt;exports.BadgeManifest=jt;exports.Breadcrumb=Hr;exports.ButtonGroup=ct;exports.ButtonGroupManifest=or;exports.ButtonManifest=wt;exports.CHIP_MANIFEST=At;exports.COLOR_PICKER_MANIFEST=Mn;exports.COLOR_SWATCH_MANIFEST=zn;exports.COMMAND_PALETTE_MANIFEST=ia;exports.Card=Ir;exports.CardBleed=jr;exports.CardManifest=Mr;exports.CardPaddingContext=ye;exports.Checkbox=be;exports.CheckboxManifest=Gt;exports.Chip=se;exports.CodeBlock=yn;exports.CodeBlockManifest=xn;exports.Collapsible=_r;exports.CommandPalette=oa;exports.DATA_TABLE_MANIFEST=na;exports.DATE_PICKER_MANIFEST=Ma;exports.DATE_RANGE_PICKER_MANIFEST=Ra;exports.DataTable=Zr;exports.DatePicker=ja;exports.DateRangePicker=pt;exports.Divider=$t;exports.DividerManifest=Wt;exports.EmptyState=Fr;exports.EmptyStateManifest=Nr;exports.FILE_UPLOAD_MANIFEST=Fa;exports.FileUpload=La;exports.FilterDateRange=jo;exports.FilterMultiSelect=ko;exports.FilterSearch=Co;exports.FilterSelect=So;exports.FormField=ir;exports.FormFieldManifest=sr;exports.Icon=un;exports.IconManifest=pn;exports.InputManifest=kt;exports.LUCENT_UI_VERSION=Uo;exports.LucentProviderManifest=$o;exports.MANIFEST_SPEC_VERSION=Go;exports.MULTI_SELECT_MANIFEST=pa;exports.Menu=Le;exports.MenuGroup=Kn;exports.MenuItem=me;exports.MenuManifest=Xn;exports.MenuSeparator=it;exports.MultiSelect=ua;exports.NavLink=hn;exports.NavMenu=le;exports.NavMenuGroup=gt;exports.NavMenuItem=mt;exports.NavMenuSeparator=vt;exports.NavMenuSub=Fe;exports.PageLayout=Xr;exports.Progress=On;exports.ProgressManifest=Vn;exports.Radio=Xt;exports.RadioGroup=ot;exports.RadioGroupUncontrolled=Jt;exports.RadioManifest=Zt;exports.Row=Ln;exports.RowManifest=Fn;exports.SEGMENTED_CONTROL_MANIFEST=En;exports.SearchInput=fr;exports.SearchInputManifest=hr;exports.SelectManifest=en;exports.Skeleton=Or;exports.SkeletonManifest=Vr;exports.SliderManifest=mn;exports.Spinner=rt;exports.SpinnerManifest=Nt;exports.SplitButton=lt;exports.SplitButtonManifest=ar;exports.Stack=Dn;exports.StackManifest=Rn;exports.Stepper=Lo;exports.StepperManifest=Fo;exports.TIMELINE_MANIFEST=Oa;exports.Table=ne;exports.TableManifest=jn;exports.Tag=rn;exports.TagManifest=an;exports.TextManifest=fn;exports.Textarea=nt;exports.TextareaManifest=It;exports.ThemeAnchorsSpec=No;exports.Timeline=Wa;exports.ToastManifest=fo;exports.ToastProvider=po;exports.ToggleManifest=Qt;exports.Tooltip=ln;exports.TooltipManifest=cn;exports.accentTokens=Oo;exports.assertManifest=Vo;exports.brandTokens=Wo;exports.isValidPropDescriptor=Ho;exports.useToast=Va;exports.validateManifest=xt;