lucent-ui 0.39.0 → 0.39.1

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"),I=require("./LucentProvider-CzEDW5SL.cjs"),c=require("react"),J=require("react-dom"),It={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. Ignored when `href` is set.",enumValues:["button","submit","reset"]},{name:"href",type:"string",required:!1,description:'When set, renders the Button as an `<a href={href}>` instead of a native `<button>`. Preserves native anchor affordances (middle-click, cmd/ctrl-click, right-click "copy link address", open in new tab) that an onClick handler cannot. Use for `mailto:` / `tel:` quick actions, external links styled as buttons, or in-app routes where users legitimately expect anchor semantics. When combined with `disabled`, the anchor renders with `aria-disabled="true"` and its `href` is stripped so navigation is neutralised.'},{name:"target",type:"string",required:!1,description:'Forwarded to the rendered `<a>` when `href` is set (e.g. `"_blank"` to open in a new tab). Ignored when rendering as a button.'},{name:"rel",type:"string",required:!1,description:'Forwarded to the rendered `<a>` when `href` is set (e.g. `"noopener noreferrer"` for external links). Ignored when rendering as a button.'}],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."},{title:"Mailto quick action",code:'<Button variant="ghost" size="sm" href="mailto:foo@example.com" leftIcon={<MailIcon />} aria-label="Email" />',description:'Renders as <a href="mailto:..."> so middle-click, cmd/ctrl-click, and right-click "copy link" all work.'},{title:"External link as button",code:'<Button variant="primary" href="https://example.com" target="_blank" rel="noopener noreferrer" rightIcon={<ExternalIcon />}>View docs</Button>',description:"Use href + target + rel for external links that should look like a primary call-to-action."},{title:"Disabled link",code:'<Button variant="outline" href="/settings" disabled>Settings</Button>',description:'When disabled, the anchor is rendered with aria-disabled="true" and its href is stripped.'}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["aria-disabled","aria-busy"],keyboardInteractions:["Enter — activates the button","Space — activates the button"]}},jt={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"]}},Mt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},zt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Et={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},ot=c.forwardRef(({label:t,helperText:r,errorText:n,autoResize:o=!1,maxLength:a,showCount:i=!1,size:l="md",id:s,value:d,onChange:p,disabled:h,style:f,...w},y)=>{const g=c.useRef(null),m=y??g,u=s??`lucent-textarea-${Math.random().toString(36).slice(2,7)}`,b=!!n,x=!!h,k=typeof d=="string"?d.length:0;c.useEffect(()=>{if(!o)return;const C=m.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[d,o,m]);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:zt[l],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:m,id:u,maxLength:a,value:d,onChange:p,disabled:h,"aria-invalid":b,"aria-describedby":b?`${u}-error`:r?`${u}-helper`:void 0,style:{width:"100%",minHeight:"100px",padding:Et[l],fontSize:Mt[l],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}`:""]})]})]})});ot.displayName="Textarea";const At={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"]}},qt={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."}},Dt={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)"}},Rt={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)"}},Bt=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),I=require("./LucentProvider-CzEDW5SL.cjs"),c=require("react"),J=require("react-dom"),It={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. Ignored when `href` is set.",enumValues:["button","submit","reset"]},{name:"href",type:"string",required:!1,description:'When set, renders the Button as an `<a href={href}>` instead of a native `<button>`. Preserves native anchor affordances (middle-click, cmd/ctrl-click, right-click "copy link address", open in new tab) that an onClick handler cannot. Use for `mailto:` / `tel:` quick actions, external links styled as buttons, or in-app routes where users legitimately expect anchor semantics. When combined with `disabled`, the anchor renders with `aria-disabled="true"` and its `href` is stripped so navigation is neutralised.'},{name:"target",type:"string",required:!1,description:'Forwarded to the rendered `<a>` when `href` is set (e.g. `"_blank"` to open in a new tab). Ignored when rendering as a button.'},{name:"rel",type:"string",required:!1,description:'Forwarded to the rendered `<a>` when `href` is set (e.g. `"noopener noreferrer"` for external links). Ignored when rendering as a button.'}],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."},{title:"Mailto quick action",code:'<Button variant="ghost" size="sm" href="mailto:foo@example.com" leftIcon={<MailIcon />} aria-label="Email" />',description:'Renders as <a href="mailto:..."> so middle-click, cmd/ctrl-click, and right-click "copy link" all work.'},{title:"External link as button",code:'<Button variant="primary" href="https://example.com" target="_blank" rel="noopener noreferrer" rightIcon={<ExternalIcon />}>View docs</Button>',description:"Use href + target + rel for external links that should look like a primary call-to-action."},{title:"Disabled link",code:'<Button variant="outline" href="/settings" disabled>Settings</Button>',description:'When disabled, the anchor is rendered with aria-disabled="true" and its href is stripped.'}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["aria-disabled","aria-busy"],keyboardInteractions:["Enter — activates the button","Space — activates the button"]}},jt={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"]}},Mt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},zt={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Et={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},ot=c.forwardRef(({label:t,helperText:r,errorText:n,autoResize:o=!1,maxLength:a,showCount:i=!1,size:l="md",id:s,value:d,onChange:p,disabled:h,style:f,...w},y)=>{const g=c.useRef(null),m=y??g,u=s??`lucent-textarea-${Math.random().toString(36).slice(2,7)}`,b=!!n,x=!!h,k=typeof d=="string"?d.length:0;c.useEffect(()=>{if(!o)return;const C=m.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[d,o,m]);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:zt[l],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:m,id:u,maxLength:a,value:d,onChange:p,disabled:h,"aria-invalid":b,"aria-describedby":b?`${u}-error`:r?`${u}-helper`:void 0,style:{width:"100%",minHeight:"100px",padding:Et[l],fontSize:Mt[l],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}`:""]})]})]})});ot.displayName="Textarea";const At={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"]}},qt={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."}},Dt={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)"}},Bt={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)"}},Rt=`
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:p=!1,ghost:h=!1,disabled:f=!1,style:w}){const y=Dt[r],g=Rt[n],[m,u]=c.useState(!1),b=s&&d,x=s&&!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:h?m&&k?S:"transparent":m&&k?y.hoverBg:y.bg,color:y.color,border:h||p?"1px solid transparent":`1px solid ${m&&k?y.hoverBorder:y.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:f?.5:1,transform:m&&k?"translateY(-1px)":"none",boxShadow:m&&k&&!h?`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:Bt}),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: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 Pt={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"]}},Lt={xs:24,sm:32,md:40,lg:56,xl:80},Ft={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 Nt(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 $t({src:t,alt:r,size:n="md",initials:o,style:a,...i}){const l=Lt[n],s=Nt(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:Ft[n],fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)"},children:s})}const Wt={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>.'}},Ot={xs:12,sm:16,md:24,lg:36},Vt={xs:2.5,sm:2.5,md:2,lg:2};function it({size:t="md",label:r="Loading…",color:n}){const o=Ot[t],a=Vt[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 Ht={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 st({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 Gt={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"]}},Ut={sm:14,md:16,lg:20},_t={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)"},Yt=`
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:p=!1,ghost:h=!1,disabled:f=!1,style:w}){const y=Dt[r],g=Bt[n],[m,u]=c.useState(!1),b=s&&d,x=s&&!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:h?m&&k?S:"transparent":m&&k?y.hoverBg:y.bg,color:y.color,border:h||p?"1px solid transparent":`1px solid ${m&&k?y.hoverBorder:y.border}`,whiteSpace:"nowrap",boxSizing:"border-box",opacity:f?.5:1,transform:m&&k?"translateY(-1px)":"none",boxShadow:m&&k&&!h?`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:Rt}),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: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 Pt={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"]}},Lt={xs:24,sm:32,md:40,lg:56,xl:80},Ft={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 Nt(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 $t({src:t,alt:r,size:n="md",initials:o,style:a,...i}){const l=Lt[n],s=Nt(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:Ft[n],fontWeight:"var(--lucent-font-weight-semibold)",fontFamily:"var(--lucent-font-family-base)"},children:s})}const Wt={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>.'}},Ot={xs:12,sm:16,md:24,lg:36},Vt={xs:2.5,sm:2.5,md:2,lg:2};function it({size:t="md",label:r="Loading…",color:n}){const o=Ot[t],a=Vt[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 Ht={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 st({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 Gt={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"]}},Ut={sm:14,md:16,lg:20},_t={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)"},Yt=`
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:p,style:h,...f},w)=>{const y=c.useRef(null),g=d??`lucent-checkbox-${Math.random().toString(36).slice(2,7)}`,m=Ut[r],u=i!==void 0,[b,x]=c.useState(l??!1),k=u?!!i:b,S=c.useRef(k),[C,v]=c.useState(0);c.useEffect(()=>{!s&&S.current!==k&&(S.current=k,v(j=>j+1))},[k,s]);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=s?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",F={width:m,height:m,borderRadius:"4px",border:`1.5px solid ${s?"transparent":k||n?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:s?"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: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?{}:h},children:[e.jsx("input",{ref:z,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"},...f}),e.jsxs("span",{"aria-hidden":!0,style:F,children:[k&&!n&&e.jsx("svg",{width:m-4,height:m-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:m-4,height:m-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:s?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Yt}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{}:{minHeight:_t[r]},padding:a?"var(--lucent-space-3)":"0 var(--lucent-space-3)",display:"flex",alignItems:a?"flex-start":"center",background:k&&!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",...h},onClick:j=>{var P;s||j.target===j.currentTarget&&((P=y.current)==null||P.click())},children:R}):R]})});be.displayName="Checkbox";const Kt={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"]}},Xt=`
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:p,style:h,...f},w)=>{const y=c.useRef(null),g=d??`lucent-checkbox-${Math.random().toString(36).slice(2,7)}`,m=Ut[r],u=i!==void 0,[b,x]=c.useState(l??!1),k=u?!!i:b,S=c.useRef(k),[C,v]=c.useState(0);c.useEffect(()=>{!s&&S.current!==k&&(S.current=k,v(j=>j+1))},[k,s]);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=s?"var(--lucent-text-disabled)":"var(--lucent-accent-fg)",F={width:m,height:m,borderRadius:"4px",border:`1.5px solid ${s?"transparent":k||n?"var(--lucent-accent-default)":"var(--lucent-border-strong)"}`,background:s?"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},B=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?{}:h},children:[e.jsx("input",{ref:z,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"},...f}),e.jsxs("span",{"aria-hidden":!0,style:F,children:[k&&!n&&e.jsx("svg",{width:m-4,height:m-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:m-4,height:m-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:s?"var(--lucent-text-disabled)":"var(--lucent-text-secondary)",marginTop:"2px"},children:a})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Yt}),o?e.jsx("div",{style:{border:"1px solid var(--lucent-border-strong)",borderRadius:"var(--lucent-radius-lg)",...a?{}:{minHeight:_t[r]},padding:a?"var(--lucent-space-3)":"0 var(--lucent-space-3)",display:"flex",alignItems:a?"flex-start":"center",background:k&&!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",...h},onClick:j=>{var P;s||j.target===j.currentTarget&&((P=y.current)==null||P.click())},children:B}):B]})});be.displayName="Checkbox";const Kt={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"]}},Xt=`
18
18
  @keyframes lucent-radio-pop {
19
19
  0% { transform: scale(1); }
20
20
  35% { transform: scale(0.82); }
@@ -100,7 +100,7 @@
100
100
  presets={['#111827', '#3b82f6', '#8b5cf6', '#ec4899', '#ef4444', '#f97316', '#22c55e']}
101
101
  />`},{title:"No presets",code:'<ColorPicker value={color} onChange={setColor} presets={[]} label="Custom color" />'},{title:"Disabled",code:'<ColorPicker value="#6b7280" disabled label="Theme color" />'}],compositionGraph:[],accessibility:{role:"button (trigger) + dialog (popover)",ariaAttributes:["aria-expanded","aria-haspopup","aria-label"],keyboardInteractions:["Enter / Space — opens the color picker popover","Escape / click outside — closes the popover","Tab — moves through format tabs and input fields within the popover"]}},Dn={id:"color-swatch",name:"ColorSwatch",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A circular color swatch that can be static or interactive.",designIntent:"ColorSwatch is the smallest unit of color representation in the system. Use it wherever a color needs to be shown at a glance — palette pickers, token lists, or inline color indicators. The selected state shows an accent-colored ring to indicate the active choice.",props:[{name:"color",type:"string",required:!0,description:"CSS color value to display."},{name:"size",type:"'sm' | 'md' | 'lg'",required:!1,default:"'md'",description:"Swatch diameter: sm=16px, md=22px, lg=28px."},{name:"selected",type:"boolean",required:!1,default:"false",description:"Shows an accent ring when true."},{name:"onClick",type:"function",required:!1,description:"Click handler. Omit for a non-interactive display swatch."},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Dims the swatch and prevents interaction."},{name:"title",type:"string",required:!1,description:"Tooltip text. Defaults to the color value."},{name:"style",type:"CSSProperties",required:!1,description:"Inline styles applied to the swatch button."}],usageExamples:[{title:"Static palette",code:`['#ef4444', '#f97316', '#22c55e'].map(c => (
102
102
  <ColorSwatch key={c} color={c} />
103
- ))`},{title:"Selectable swatch",code:`<ColorSwatch color="#3b82f6" selected={active === '#3b82f6'} onClick={() => setActive('#3b82f6')} />`}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["title (tooltip)"],keyboardInteractions:["Enter / Space — triggers onClick"]}},Rn={id:"segmented-control",name:"SegmentedControl",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A pill-group selector where exactly one option is always active, with a sliding indicator.",designIntent:"Use SegmentedControl for mutually exclusive view switches or mode selectors that have 2–5 options and where all options should be visible simultaneously (unlike Select). Common uses: view mode (Grid / List / Table), time range (Day / Week / Month), format picker (Hex / RGB / HSL). Keep labels short (1–2 words) so the control stays compact. For more than 5 options or dynamic option lists, prefer Select.",props:[{name:"options",type:"SegmentedOption[]",required:!0,description:"Array of { value, label, disabled? }. 2–5 options recommended."},{name:"value",type:"string",required:!1,description:"Controlled selected value. Pair with onChange."},{name:"defaultValue",type:"string",required:!1,description:"Initial value for uncontrolled usage. Defaults to the first option."},{name:"onChange",type:"function",required:!1,description:"Called with the newly selected value."},{name:"size",type:"enum",required:!1,default:"md",description:"Height and font size of the control.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables all options."},{name:"fullWidth",type:"boolean",required:!1,default:"false",description:"Stretches the control to fill its container, distributing options equally."}],usageExamples:[{title:"Controlled",code:`const [view, setView] = useState('grid');
103
+ ))`},{title:"Selectable swatch",code:`<ColorSwatch color="#3b82f6" selected={active === '#3b82f6'} onClick={() => setActive('#3b82f6')} />`}],compositionGraph:[],accessibility:{role:"button",ariaAttributes:["title (tooltip)"],keyboardInteractions:["Enter / Space — triggers onClick"]}},Bn={id:"segmented-control",name:"SegmentedControl",tier:"atom",domain:"neutral",specVersion:"0.1",description:"A pill-group selector where exactly one option is always active, with a sliding indicator.",designIntent:"Use SegmentedControl for mutually exclusive view switches or mode selectors that have 2–5 options and where all options should be visible simultaneously (unlike Select). Common uses: view mode (Grid / List / Table), time range (Day / Week / Month), format picker (Hex / RGB / HSL). Keep labels short (1–2 words) so the control stays compact. For more than 5 options or dynamic option lists, prefer Select.",props:[{name:"options",type:"SegmentedOption[]",required:!0,description:"Array of { value, label, disabled? }. 2–5 options recommended."},{name:"value",type:"string",required:!1,description:"Controlled selected value. Pair with onChange."},{name:"defaultValue",type:"string",required:!1,description:"Initial value for uncontrolled usage. Defaults to the first option."},{name:"onChange",type:"function",required:!1,description:"Called with the newly selected value."},{name:"size",type:"enum",required:!1,default:"md",description:"Height and font size of the control.",enumValues:["sm","md","lg"]},{name:"disabled",type:"boolean",required:!1,default:"false",description:"Disables all options."},{name:"fullWidth",type:"boolean",required:!1,default:"false",description:"Stretches the control to fill its container, distributing options equally."}],usageExamples:[{title:"Controlled",code:`const [view, setView] = useState('grid');
104
104
  <SegmentedControl
105
105
  value={view}
106
106
  onChange={setView}
@@ -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"]}},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 ze({gap:t="4",align:r="stretch",justify:n="start",as:o="div",wrap:a=!1,children:i,style:l,...s}){const d=o==="ul"||o==="ol",p={display:"flex",flexDirection:"column",gap:`var(--lucent-space-${t})`,alignItems:Bn[r],justifyContent:Pn[n],...a&&{flexWrap:"wrap"},...d&&{listStyle:"none",margin:0,padding:0},...l},h=o;return e.jsx(h,{style:p,...s,children:i})}const Ln={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, ul/ol for lists, section/header/footer/main/aside/article for landmarks). When rendering as ul/ol, list-style/margin/padding are auto-reset; consumers pass <li> children.",enumValues:["div","section","nav","header","footer","main","aside","article","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"]}},Rn={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 ze({gap:t="4",align:r="stretch",justify:n="start",as:o="div",wrap:a=!1,children:i,style:l,...s}){const d=o==="ul"||o==="ol",p={display:"flex",flexDirection:"column",gap:`var(--lucent-space-${t})`,alignItems:Rn[r],justifyContent:Pn[n],...a&&{flexWrap:"wrap"},...d&&{listStyle:"none",margin:0,padding:0},...l},h=o;return e.jsx(h,{style:p,...s,children:i})}const Ln={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, ul/ol for lists, section/header/footer/main/aside/article for landmarks). When rendering as ul/ol, list-style/margin/padding are auto-reset; consumers pass <li> children.",enumValues:["div","section","nav","header","footer","main","aside","article","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>
@@ -184,7 +184,7 @@
184
184
  from { opacity: 1; transform: scale(1) translateY(0); }
185
185
  to { opacity: 0; transform: scale(0.97) translateY(-2px); }
186
186
  }
187
- `,Le={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},_n={sm:"sm",md:"md",lg:"lg"},Yn={sm:"xs",md:"sm",lg:"md"},Kn={sm:12,md:14,lg:16},Fe=c.createContext(null),de=4;function Xn(t,r,n){const o=r.offsetWidth,a=r.offsetHeight,i=window.innerWidth,l=window.innerHeight;let s=0,d=0,p=n;const h={top:t.top-a-de,bottom:t.bottom+de,left:t.left-o-de,right:t.right+de};p.startsWith("bottom")?(s=h.bottom,s+a>l&&h.top>=0&&(s=h.top,p=p.replace("bottom","top"))):p.startsWith("top")?(s=h.top,s<0&&h.bottom+a<=l&&(s=h.bottom,p=p.replace("top","bottom"))):p==="left"?(s=t.top+t.height/2-a/2,d=h.left,d<0&&h.right+o<=i&&(d=h.right,p="right")):p==="right"&&(s=t.top+t.height/2-a/2,d=h.right,d+o>i&&h.left>=0&&(d=h.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),s+a>l&&(s=l-a-8),s<0&&(s=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:s,left:d,transformOrigin:f}}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(Fe),p=c.useRef(-1);p.current===-1&&d&&(p.current=d.getItemIndex(),d.registerItem(p.current,a));const h=d?d.activeIndex===p.current:!1,f=(d==null?void 0:d.size)??"md",w=Le[f],y=_n[f],g=Kn[f],m=()=>{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":l,"aria-disabled":a||void 0,"data-active":h||void 0,tabIndex:-1,onClick:m,onMouseEnter:u,style:{display:"flex",alignItems:"center",gap:w,padding:w,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))":h?"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(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}),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 dt({style:t}){return e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)",...t}})}function Jn({label:t,children:r,style:n}){const o=c.useContext(Fe),a=(o==null?void 0:o.size)??"md",i=Le[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:Yn[a],color:"secondary",weight:"medium",children:t})}),r]})}function Ne({trigger:t,children:r,placement:n="bottom-start",size:o="md",open:a,onOpenChange:i,portalContainer:l,style:s}){const d=a!==void 0,[p,h]=c.useState(!1),f=d?a:p,[w,y]=c.useState(!1),[g,m]=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=Un,document.head.appendChild(A),k.current=!0}c.useEffect(()=>{if(f)v.current=0,z.current.clear(),y(!0),m("entering");else if(w){m("exiting");const A=setTimeout(()=>{y(!1),m("idle")},we);return()=>clearTimeout(A)}},[f]);const F=c.useCallback(A=>{d||h(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(Xn($,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(Fe.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:Le[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 Zn={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>}>
187
+ `,Le={sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},_n={sm:"sm",md:"md",lg:"lg"},Yn={sm:"xs",md:"sm",lg:"md"},Kn={sm:12,md:14,lg:16},Fe=c.createContext(null),de=4;function Xn(t,r,n){const o=r.offsetWidth,a=r.offsetHeight,i=window.innerWidth,l=window.innerHeight;let s=0,d=0,p=n;const h={top:t.top-a-de,bottom:t.bottom+de,left:t.left-o-de,right:t.right+de};p.startsWith("bottom")?(s=h.bottom,s+a>l&&h.top>=0&&(s=h.top,p=p.replace("bottom","top"))):p.startsWith("top")?(s=h.top,s<0&&h.bottom+a<=l&&(s=h.bottom,p=p.replace("top","bottom"))):p==="left"?(s=t.top+t.height/2-a/2,d=h.left,d<0&&h.right+o<=i&&(d=h.right,p="right")):p==="right"&&(s=t.top+t.height/2-a/2,d=h.right,d+o>i&&h.left>=0&&(d=h.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),s+a>l&&(s=l-a-8),s<0&&(s=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:s,left:d,transformOrigin:f}}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(Fe),p=c.useRef(-1);p.current===-1&&d&&(p.current=d.getItemIndex(),d.registerItem(p.current,a));const h=d?d.activeIndex===p.current:!1,f=(d==null?void 0:d.size)??"md",w=Le[f],y=_n[f],g=Kn[f],m=()=>{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":l,"aria-disabled":a||void 0,"data-active":h||void 0,tabIndex:-1,onClick:m,onMouseEnter:u,style:{display:"flex",alignItems:"center",gap:w,padding:w,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))":h?"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(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}),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 dt({style:t}){return e.jsx("div",{role:"separator",style:{height:1,margin:"var(--lucent-space-1) 0",background:"var(--lucent-border-subtle)",...t}})}function Jn({label:t,children:r,style:n}){const o=c.useContext(Fe),a=(o==null?void 0:o.size)??"md",i=Le[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:Yn[a],color:"secondary",weight:"medium",children:t})}),r]})}function Ne({trigger:t,children:r,placement:n="bottom-start",size:o="md",open:a,onOpenChange:i,portalContainer:l,style:s}){const d=a!==void 0,[p,h]=c.useState(!1),f=d?a:p,[w,y]=c.useState(!1),[g,m]=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=Un,document.head.appendChild(A),k.current=!0}c.useEffect(()=>{if(f)v.current=0,z.current.clear(),y(!0),m("entering");else if(w){m("exiting");const A=setTimeout(()=>{y(!1),m("idle")},we);return()=>clearTimeout(A)}},[f]);const F=c.useCallback(A=>{d||h(A),i==null||i(A)},[d,i]),B=c.useCallback(()=>{const A=x.current;A&&(A.querySelector("button, [tabindex]")??A).focus()},[]),j=c.useCallback(()=>{F(!1),B()},[F,B]);c.useLayoutEffect(()=>{if(!w||g!=="entering"||!u.current)return;const A=requestAnimationFrame(()=>{const R=b.current,M=u.current;if(!R||!M)return;const $=M.getBoundingClientRect();C(Xn($,R,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()},R=requestAnimationFrame(()=>{document.addEventListener("mousedown",A)});return()=>{cancelAnimationFrame(R),document.removeEventListener("mousedown",A)}},[f,j]),c.useEffect(()=>{if(!f)return;let A=!1;const R=setTimeout(()=>{A=!0},50),M=()=>{A&&j()};return window.addEventListener("scroll",M,{passive:!0,capture:!0}),()=>{clearTimeout(R),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,R)=>A-R),[]),D=c.useCallback(A=>{if(!f)return;const R=P();if(R.length!==0)switch(A.key){case"Escape":A.preventDefault(),j();break;case"ArrowDown":{A.preventDefault(),E(M=>{const $=R.indexOf(M);return $<R.length-1?R[$+1]:R[0]});break}case"ArrowUp":{A.preventDefault(),E(M=>{const $=R.indexOf(M);return $>0?R[$-1]:R[R.length-1]});break}case"Home":{A.preventDefault(),E(R[0]);break}case"End":{A.preventDefault(),E(R[R.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 R=A.querySelector('[data-active="true"]');R==null||R.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 R=P();R.length>0&&E(R[R.length-1])},0)))},N={activeIndex:T,setActiveIndex:E,registerItem:(A,R)=>{z.current.set(A,{disabled:R})},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(Fe.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:Le[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 Zn={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>}>
188
188
  <MenuItem onSelect={() => console.log('edit')}>Edit</MenuItem>
189
189
  <MenuItem onSelect={() => console.log('duplicate')}>Duplicate</MenuItem>
190
190
  <MenuSeparator />
@@ -239,7 +239,7 @@
239
239
  <Input id="pw" type="password" />
240
240
  </FormField>`},{title:"Wrapping a Select",code:`<FormField label="Country" htmlFor="country">
241
241
  <Select id="country" options={countryOptions} />
242
- </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.'}},Ge={sm:14,md:18,lg:20},dr={sm:"sm",md:"md",lg:"md"},ur={sm:"var(--lucent-space-1)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-2)"},pr=({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"})]}),hr=({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"})}),fr=()=>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 mr({value:t,onChange:r,mode:n="search",placeholder:o,size:a="md",label:i,helperText:l,errorText:s,results:d=[],onResultSelect:p,isLoading:h=!1,disabled:f=!1,id:w,style:y}){const g=o??(n==="filter"?"Filter…":"Search…"),[m,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"&&m&&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=h?e.jsx(it,{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(fr,{})}):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(hr,{size:Ge[a]}):e.jsx(pr,{size:Ge[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: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:ur[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:dr[a],children:D.label})},D.id))}),document.body)]})}const gr={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('');
242
+ </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.'}},Ge={sm:14,md:18,lg:20},dr={sm:"sm",md:"md",lg:"md"},ur={sm:"var(--lucent-space-1)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-2)"},pr=({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"})]}),hr=({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"})}),fr=()=>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 mr({value:t,onChange:r,mode:n="search",placeholder:o,size:a="md",label:i,helperText:l,errorText:s,results:d=[],onResultSelect:p,isLoading:h=!1,disabled:f=!1,id:w,style:y}){const g=o??(n==="filter"?"Filter…":"Search…"),[m,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"&&m&&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)},B=()=>{k.current=setTimeout(()=>u(!1),150)},j=()=>{k.current&&clearTimeout(k.current),u(!0)},P=h?e.jsx(it,{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(fr,{})}):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(hr,{size:Ge[a]}):e.jsx(pr,{size:Ge[a]}),rightElement:P??void 0,onFocus:j,onBlur:B,...i!==void 0&&{label:i},...l!==void 0&&{helperText:l},...s!==void 0&&{errorText:s}}),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:ur[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:dr[a],children:D.label})},D.id))}),document.body)]})}const gr={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('');
243
243
  const [results, setResults] = useState([]);
244
244
 
245
245
  <SearchInput
@@ -247,7 +247,7 @@ const [results, setResults] = useState([]);
247
247
  onChange={(v) => { setQuery(v); setResults(filter(v)); }}
248
248
  results={results}
249
249
  onResultSelect={(r) => console.log(r)}
250
- />`},{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"}),vr={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)"},br={none:"var(--lucent-radius-none)",sm:"var(--lucent-radius-sm)",md:"var(--lucent-radius-md)",lg:"var(--lucent-radius-lg)"},yr={success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"},xr={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}},wr=["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(", "),kr="0 4px 14px -2px var(--lucent-accent-subtle)",Sr="0 4px 14px -2px color-mix(in srgb, var(--lucent-text-primary) 12%, transparent)",Tr="0 0 0 3px var(--lucent-accent-subtle)",Cr="0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default)",Ir="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 jr(t,r,n){return!r||n?t.background:"var(--lucent-accent-subtle)"}function Mr({variant:t="outline",header:r,footer:n,children:o,padding:a="md",shadow:i,radius:l="lg",style:s,onClick:d,href:p,target:h,rel:f,disabled:w,status:y,selected:g,hoverable:m,media:u}){const b=xr[t],x=t==="combo",k=i??(x?"md":b.shadowDefault),{py:S,px:C}=vr[a],v=`${S} ${C}`,z=br[l],T=p!=null,E=d!=null||T,F=E||(m??!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?Ir:void 0,M=jr(b,g??!1,R),$=y!=null?`inset 3px 0 0 ${yr[y]}`:void 0;let V;x?V=ee(B,$):F&&!R?N?V=ee(Cr,B,$):W?V=ee(Tr,B,$):P?V=ee(E?kr:Sr,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:wr},...E&&!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:p,...h!==void 0&&{target:h},...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 zr({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 Er={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 `navigation`, `bgBase`, or `bgSubtle` on a Card — those tokens are reserved for the page chrome and content area.\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">
250
+ />`},{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"}),vr={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)"},br={none:"var(--lucent-radius-none)",sm:"var(--lucent-radius-sm)",md:"var(--lucent-radius-md)",lg:"var(--lucent-radius-lg)"},yr={success:"var(--lucent-success-default)",warning:"var(--lucent-warning-default)",danger:"var(--lucent-danger-default)",info:"var(--lucent-info-default)"},xr={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}},wr=["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(", "),kr="0 4px 14px -2px var(--lucent-accent-subtle)",Sr="0 4px 14px -2px color-mix(in srgb, var(--lucent-text-primary) 12%, transparent)",Tr="0 0 0 3px var(--lucent-accent-subtle)",Cr="0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default)",Ir="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 jr(t,r,n){return!r||n?t.background:"var(--lucent-accent-subtle)"}function Mr({variant:t="outline",header:r,footer:n,children:o,padding:a="md",shadow:i,radius:l="lg",style:s,onClick:d,href:p,target:h,rel:f,disabled:w,status:y,selected:g,hoverable:m,media:u}){const b=xr[t],x=t==="combo",k=i??(x?"md":b.shadowDefault),{py:S,px:C}=vr[a],v=`${S} ${C}`,z=br[l],T=p!=null,E=d!=null||T,F=E||(m??!1),B=(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)&&!B,R=A?Ir:void 0,M=jr(b,g??!1,B),$=y!=null?`inset 3px 0 0 ${yr[y]}`:void 0;let V;x?V=ee(R,$):F&&!B?N?V=ee(Cr,R,$):W?V=ee(Tr,R,$):P?V=ee(E?kr:Sr,ue[k],R,$):V=ee(ue[k],R,$):V=ee(ue[k],R,$);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&&!B&&N&&{transform:"translateY(1px)"},...F&&!B&&P&&!N&&{transform:"translateY(-1px)"},...F&&{cursor:B?"not-allowed":"pointer",transition:wr},...E&&!T&&{padding:0,font:"inherit",textAlign:"inherit",width:"100%",background:M},...T&&{textDecoration:"none",color:"inherit"},...B&&{opacity:.6,pointerEvents:"none"},...s},G=F&&!B?{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:B?void 0:p,...h!==void 0&&{target:h},...f!==void 0&&{rel:f}},...!T&&E&&{type:"button",...B&&{disabled:!0}},...d!==void 0&&!B&&{onClick:d},...E&&g!==void 0&&{"aria-pressed":g},...T&&B&&{"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)`,...r==null&&{marginTop:`calc(${S} / 3)`},...n==null&&{marginBottom:`calc(${S} / 3)`}}:{}},children:o})}),n!=null&&e.jsx("div",{style:{padding:v,...b.dividers?{borderTop:"1px solid var(--lucent-border-default)"}:{}},children:n})]})}function zr({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 Er={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 `navigation`, `bgBase`, or `bgSubtle` on a Card — those tokens are reserved for the page chrome and content area.\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">
251
251
  <Text>Content sits directly on the page background.</Text>
252
252
  </Card>`},{title:"Outline — bordered card (default)",code:`<Card
253
253
  header={<Text weight="semibold">Card title</Text>}
@@ -303,7 +303,7 @@ const [results, setResults] = useState([]);
303
303
  <Text size="sm" color="secondary">Two-tone: flat trigger on filled surface, content in elevated body.</Text>
304
304
  </Card>
305
305
  </Collapsible>
306
- </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."}},Ar={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"}},qr=()=>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"})]}),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 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Rr=()=>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"})]}),Br=()=>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"})]}),Pr={info:e.jsx(qr,{}),success:e.jsx(Dr,{}),warning:e.jsx(Rr,{}),danger:e.jsx(Br,{})},Lr=()=>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({variant:t="info",title:r,children:n,onDismiss:o,icon:a,style:i}){const l=Ar[t],s=a??Pr[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(I.Text,{as:"span",size:"sm",weight:"semibold",color:l.textColor,lineHeight:"tight",children:r}),n&&e.jsx(I.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(Lr,{})})]})}const Nr={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)}>
306
+ </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."}},Ar={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"}},qr=()=>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"})]}),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 8L7 10L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Br=()=>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"})]}),Rr=()=>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"})]}),Pr={info:e.jsx(qr,{}),success:e.jsx(Dr,{}),warning:e.jsx(Br,{}),danger:e.jsx(Rr,{})},Lr=()=>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({variant:t="info",title:r,children:n,onDismiss:o,icon:a,style:i}){const l=Ar[t],s=a??Pr[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(I.Text,{as:"span",size:"sm",weight:"semibold",color:l.textColor,lineHeight:"tight",children:r}),n&&e.jsx(I.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(Lr,{})})]})}const Nr={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)}>
307
307
  Check your card details and try again.
308
308
  </Alert>`},{title:"Success confirmation",code:`<Alert variant="success" title="Order placed!">
309
309
  You'll receive a confirmation email shortly.
@@ -339,7 +339,7 @@ const [results, setResults] = useState([]);
339
339
  [data-lucent-collapsible-trigger]:focus-visible {
340
340
  box-shadow: 0 0 0 2px var(--lucent-surface), 0 0 0 4px var(--lucent-accent-default) !important;
341
341
  }
342
- `;let Ke=!1;function _r(){if(Ke||typeof document>"u")return;const t=document.createElement("style");t.setAttribute("data-lucent-collapsible",""),t.textContent=Ur,document.head.appendChild(t),Ke=!0}function Yr({trigger:t,children:r,defaultOpen:n=!1,open:o,onOpenChange:a,padded:i=!0,disabled:l=!1,style:s}){const d=c.useContext(ye),p=d.px!=="0"||d.py!=="0",h=o!==void 0,[f,w]=c.useState(n),y=h?o:f,g=c.useRef(null),m=c.useRef(!1),u=c.useRef();c.useEffect(_r,[]),c.useEffect(()=>{m.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=Ye,clearTimeout(u.current),u.current=setTimeout(()=>{x.style.height="auto",x.style.overflow="visible",x.style.transition=""},mt+20)}else m.current&&(clearTimeout(u.current),x.style.overflow="hidden",x.style.transition="",x.style.height=`${x.scrollHeight}px`,x.getBoundingClientRect(),x.style.transition=Ye,x.style.height="0px")},[y]),c.useEffect(()=>{const x=g.current;x&&!y&&!m.current&&(x.style.height="0px")},[]),c.useEffect(()=>()=>clearTimeout(u.current),[]);const b=()=>{if(l)return;const x=!y;h||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})`},...s},children:[e.jsxs("button",{"data-lucent-collapsible-trigger":!0,onClick:b,disabled:l,"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:l?"not-allowed":"pointer",textAlign:"left",outline:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit",opacity:l?.5:1,transition:`background ${Ae} ${te}`},children:[e.jsx("span",{style:{flex:1},children:t}),e.jsx(Kr,{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 ${_e}ms ${te}, transform ${_e}ms ${te}`},children:r})})]})}function Kr({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 ${Ae} ${te}, color ${Ae} ${te}`},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}const oe="lucent-pl-no-scrollbar",Xr=`.${oe}{scrollbar-width:none}.${oe}::-webkit-scrollbar{display:none}`;function pe(t){return typeof t=="number"?`${t}px`:t}function Jr({children:t,header:r,sidebar:n,sidebarWidth:o=240,headerHeight:a=48,sidebarCollapsed:i=!1,rightSidebar:l,rightSidebarWidth:s=240,rightSidebarCollapsed:d=!1,footer:p,footerHeight:h=28,chromeBackground:f="navigation",mainStyle:w,style:y}){const g=pe(a),m=pe(o),u=pe(s),b=pe(h),k={navigation:"var(--lucent-navigation)",bgBase:"var(--lucent-bg-base)",bgSubtle:"var(--lucent-bg-subtle)",surface:"var(--lucent-surface)",surfaceSecondary:"var(--lucent-surface-secondary)"}[f]??"var(--lucent-navigation)";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:Xr}),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:m,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: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-bg-base)",...w},children:t}),l!=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:l})]}),p!=null&&e.jsx("div",{style:{flexShrink:0,height:b,zIndex:10,background:k},children:p})]})}function Zr({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 Xe({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 Qr({columns:t,rows:r,pageSize:n=10,page:o,onPageChange:a,onFilterChange:i,emptyState:l,style:s}){const[d,p]=c.useState(null),[h,f]=c.useState(0),[w,y]=c.useState(null),[g,m]=c.useState({}),u=o!==void 0,b=u?o:h,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],m(D),u||f(0),a==null||a(0),i==null||i(D)},F=()=>{m({}),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)",...s},children:[x&&e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsx(ea,{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)",background:"var(--lucent-surface)"},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(Zr,{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:l??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(Xe,{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(Xe,{dir:"right"})})]})]})]})}function ea({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(p=>String(p[s.key]??"")))).sort();return e.jsx(ta,{label:s.header,values:d,value:n[s.key]??[],onChange:p=>o(s.key,p)},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 ta({label:t,values:r,value:n,onChange:o}){const[a,i]=c.useState(!1),[l,s]=c.useState(!1),[d,p]=c.useState(""),h=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=>{h.current&&!h.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]),m=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:h,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 ${w?"var(--lucent-accent-default)":l?"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,m,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(na,{label:u,isSelected:n.includes(u),onClick:()=>g(u)},u))})]})]})}function na({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 ra={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. The table wrapper paints var(--lucent-surface) as its background so the component always sits on a solid panel, regardless of parent page color; header tints and row hover are translucent color-mix overlays on top of that surface.',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
342
+ `;let Ke=!1;function _r(){if(Ke||typeof document>"u")return;const t=document.createElement("style");t.setAttribute("data-lucent-collapsible",""),t.textContent=Ur,document.head.appendChild(t),Ke=!0}function Yr({trigger:t,children:r,defaultOpen:n=!1,open:o,onOpenChange:a,padded:i=!0,disabled:l=!1,style:s}){const d=c.useContext(ye),p=d.px!=="0"||d.py!=="0",h=o!==void 0,[f,w]=c.useState(n),y=h?o:f,g=c.useRef(null),m=c.useRef(!1),u=c.useRef();c.useEffect(_r,[]),c.useEffect(()=>{m.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=Ye,clearTimeout(u.current),u.current=setTimeout(()=>{x.style.height="auto",x.style.overflow="visible",x.style.transition=""},mt+20)}else m.current&&(clearTimeout(u.current),x.style.overflow="hidden",x.style.transition="",x.style.height=`${x.scrollHeight}px`,x.getBoundingClientRect(),x.style.transition=Ye,x.style.height="0px")},[y]),c.useEffect(()=>{const x=g.current;x&&!y&&!m.current&&(x.style.height="0px")},[]),c.useEffect(()=>()=>clearTimeout(u.current),[]);const b=()=>{if(l)return;const x=!y;h||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})`},...s},children:[e.jsxs("button",{"data-lucent-collapsible-trigger":!0,onClick:b,disabled:l,"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:l?"not-allowed":"pointer",textAlign:"left",outline:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit",opacity:l?.5:1,transition:`background ${Ae} ${te}`},children:[e.jsx("span",{style:{flex:1},children:t}),e.jsx(Kr,{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 ${_e}ms ${te}, transform ${_e}ms ${te}`},children:r})})]})}function Kr({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 ${Ae} ${te}, color ${Ae} ${te}`},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}const oe="lucent-pl-no-scrollbar",Xr=`.${oe}{scrollbar-width:none}.${oe}::-webkit-scrollbar{display:none}`;function pe(t){return typeof t=="number"?`${t}px`:t}function Jr({children:t,header:r,sidebar:n,sidebarWidth:o=240,headerHeight:a=48,sidebarCollapsed:i=!1,rightSidebar:l,rightSidebarWidth:s=240,rightSidebarCollapsed:d=!1,footer:p,footerHeight:h=28,chromeBackground:f="navigation",mainStyle:w,style:y}){const g=pe(a),m=pe(o),u=pe(s),b=pe(h),k={navigation:"var(--lucent-navigation)",bgBase:"var(--lucent-bg-base)",bgSubtle:"var(--lucent-bg-subtle)",surface:"var(--lucent-surface)",surfaceSecondary:"var(--lucent-surface-secondary)"}[f]??"var(--lucent-navigation)";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:Xr}),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:m,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: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-bg-base)",...w},children:t}),l!=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:l})]}),p!=null&&e.jsx("div",{style:{flexShrink:0,height:b,zIndex:10,background:k},children:p})]})}function Zr({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 Xe({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 Qr({columns:t,rows:r,pageSize:n=10,page:o,onPageChange:a,onFilterChange:i,emptyState:l,style:s}){const[d,p]=c.useState(null),[h,f]=c.useState(0),[w,y]=c.useState(null),[g,m]=c.useState({}),u=o!==void 0,b=u?o:h,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],m(D),u||f(0),a==null||a(0),i==null||i(D)},F=()=>{m({}),u||f(0),a==null||a(0),i==null||i({})},B=[];if(v<=7)for(let j=0;j<v;j++)B.push(j);else{B.push(0),b>2&&B.push("…");for(let j=Math.max(1,b-1);j<=Math.min(v-2,b+1);j++)B.push(j);b<v-3&&B.push("…"),B.push(v-1)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--lucent-space-3)",...s},children:[x&&e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsx(ea,{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)",background:"var(--lucent-surface)"},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(Zr,{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:l??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(Xe,{dir:"left"})}),B.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(Xe,{dir:"right"})})]})]})]})}function ea({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(p=>String(p[s.key]??"")))).sort();return e.jsx(ta,{label:s.header,values:d,value:n[s.key]??[],onChange:p=>o(s.key,p)},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 ta({label:t,values:r,value:n,onChange:o}){const[a,i]=c.useState(!1),[l,s]=c.useState(!1),[d,p]=c.useState(""),h=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=>{h.current&&!h.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]),m=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:h,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 ${w?"var(--lucent-accent-default)":l?"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,m,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(na,{label:u,isSelected:n.includes(u),onClick:()=>g(u)},u))})]})]})}function na({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 ra={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. The table wrapper paints var(--lucent-surface) as its background so the component always sits on a solid panel, regardless of parent page color; header tints and row hover are translucent color-mix overlays on top of that surface.',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
343
343
  columns={[
344
344
  { key: 'name', header: 'Name', sortable: true },
345
345
  { key: 'role', header: 'Role', sortable: true },
@@ -366,7 +366,7 @@ const [results, setResults] = useState([]);
366
366
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
367
367
  to { opacity: 1; transform: scale(1) translateY(0); }
368
368
  }
369
- `;function oa(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 ia({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),p=l?o:s,[h,f]=c.useState(""),[w,y]=c.useState(0),g=c.useRef(null),m=c.useRef(null),u=c.useRef(!1);if(!u.current){const T=document.createElement("style");T.textContent=aa,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=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=h?t.filter(T=>oa(T,h)):t,k=x.filter(T=>!T.disabled);c.useEffect(()=>{const T=m.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:h,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:m,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 "',h,'"']})}):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 sa={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
369
+ `;function oa(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 ia({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),p=l?o:s,[h,f]=c.useState(""),[w,y]=c.useState(0),g=c.useRef(null),m=c.useRef(null),u=c.useRef(!1);if(!u.current){const T=document.createElement("style");T.textContent=aa,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=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=h?t.filter(T=>oa(T,h)):t,k=x.filter(T=>!T.disabled);c.useEffect(()=>{const T=m.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:h,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:m,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 "',h,'"']})}):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(B=>{const j=B.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(B),onMouseEnter:()=>{if(!j){const D=k.indexOf(B);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:[B.icon&&e.jsx("span",{style:{flexShrink:0,color:"var(--lucent-text-secondary)",display:"flex"},children:B.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(I.Text,{size:"sm",weight:"medium",truncate:!0,children:B.label}),B.description&&e.jsx(I.Text,{size:"xs",color:"secondary",truncate:!0,children:B.description})]})]},B.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 sa={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
370
370
  commands={[
371
371
  { id: 'new', label: 'New document', icon: <PlusIcon />, onSelect: () => router.push('/new') },
372
372
  { id: 'settings', label: 'Settings', description: 'Open app settings', onSelect: () => router.push('/settings') },
@@ -381,7 +381,7 @@ const [results, setResults] = useState([]);
381
381
  onOpenChange={setOpen}
382
382
  shortcutKey="p"
383
383
  />
384
- </>`}],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.'}},la={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)"},ca={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-lg)"},da={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)"},he={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)"},Je={sm:"sm",md:"md",lg:"lg"},ua={sm:"sm",md:"md",lg:"lg"};function pa({options:t,value:r,defaultValue:n=[],onChange:o,placeholder:a="Select…",disabled:i=!1,max:l,size:s="md",label:d,helperText:p,errorText:h,style:f}){const w=r!==void 0,[y,g]=c.useState(n),m=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,m,x]);const W=L=>{const G=m.includes(L)?m.filter(U=>U!==L):l!==void 0&&m.length>=l?m:[...m,L];w||g(G),o==null||o(G)},q=L=>{const G=m.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===""&&m.length>0&&q(m[m.length-1])},A=l!==void 0&&m.length>=l,B=!!h,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[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=E.current)==null||L.focus())},style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:he[s],minHeight:la[s],boxSizing:"border-box",padding:da[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:[m.map(L=>{const G=t.find(U=>U.value===L);return G?e.jsx(se,{size:ua[s],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:m.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:ca[s],color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",cursor:i?"not-allowed":"text",padding:m.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:he[s]},children:[N.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-2)"},children:e.jsx(I.Text,{color:"secondary",size:Je[s],children:"No options"})}):N.map((L,G)=>{const U=m.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:he[s],padding:he[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(I.Text,{size:Je[s],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: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:h}),!B&&p&&e.jsx("span",{id:`${V}-helper`,style:{fontSize:Se[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p})]})}const ha={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
384
+ </>`}],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.'}},la={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)"},ca={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-lg)"},da={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)"},he={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)"},Je={sm:"sm",md:"md",lg:"lg"},ua={sm:"sm",md:"md",lg:"lg"};function pa({options:t,value:r,defaultValue:n=[],onChange:o,placeholder:a="Select…",disabled:i=!1,max:l,size:s="md",label:d,helperText:p,errorText:h,style:f}){const w=r!==void 0,[y,g]=c.useState(n),m=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),B=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=B.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,m,x]);const W=L=>{const G=m.includes(L)?m.filter(U=>U!==L):l!==void 0&&m.length>=l?m:[...m,L];w||g(G),o==null||o(G)},q=L=>{const G=m.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===""&&m.length>0&&q(m[m.length-1])},A=l!==void 0&&m.length>=l,R=!!h,M=i?"var(--lucent-border-default)":R?"var(--lucent-danger-default)":v?"var(--lucent-accent-border)":"var(--lucent-border-default)",$=v?`0 0 0 3px ${R?"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[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=E.current)==null||L.focus())},style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:he[s],minHeight:la[s],boxSizing:"border-box",padding:da[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:[m.map(L=>{const G=t.find(U=>U.value===L);return G?e.jsx(se,{size:ua[s],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:m.length===0?a:"","aria-autocomplete":"list","aria-controls":D,"aria-expanded":u,"aria-describedby":R?`${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:ca[s],color:i?"var(--lucent-text-disabled)":"var(--lucent-text-primary)",cursor:i?"not-allowed":"text",padding:m.length===0?"2px 0 2px var(--lucent-space-1)":"2px 0"}})]}),u&&!i&&J.createPortal(e.jsxs("div",{ref:B,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:he[s]},children:[N.length===0?e.jsx("div",{style:{padding:"var(--lucent-space-2)"},children:e.jsx(I.Text,{color:"secondary",size:Je[s],children:"No options"})}):N.map((L,G)=>{const U=m.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:he[s],padding:he[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(I.Text,{size:Je[s],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:s==="lg"?"sm":"xs",color:"secondary",children:["Max ",l," selected"]})})]}),document.body)]}),R&&e.jsx("span",{id:`${V}-error`,role:"alert",style:{fontSize:Se[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:h}),!R&&p&&e.jsx("span",{id:`${V}-helper`,style:{fontSize:Se[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p})]})}const ha={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
385
385
  options={[
386
386
  { value: 'react', label: 'React' },
387
387
  { value: 'vue', label: 'Vue' },
@@ -395,14 +395,14 @@ const [results, setResults] = useState([]);
395
395
  onChange={setTags}
396
396
  max={3}
397
397
  placeholder="Up to 3 tags"
398
- />`}],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 ma(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 Ze(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())>new Date(r.getFullYear(),r.getMonth(),r.getDate())}const ga=["January","February","March","April","May","June","July","August","September","October","November","December"],va=["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 ba={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)"},ya={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)"},xa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},wa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},ka={sm:28,md:32,lg:38},Sa={sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ta={sm:"xs",md:"sm",lg:"md"},Ca={sm:"xs",md:"xs",lg:"sm"},Ia={sm:24,md:28,lg:32},ja={sm:14,md:16,lg:18},gt={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-5)"},qe={sm:220,md:260,lg:300};function Qe({dir:t,onClick:r,disabled:n,size:o="md"}){const[a,i]=c.useState(!1),l=Ia[o],s=ja[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 De({year:t,month:r,selected:n,today:o,min:a,max:i,onSelect:l,onPrevMonth:s,onNextMonth:d,highlightRange:p,onDayHover:h,size:f="md"}){const w=fa(t,r),y=ma(t,r),[g,m]=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(Qe,{dir:"prev",onClick:s,size:f}),e.jsxs(I.Text,{weight:"medium",size:Ta[f],children:[ga[r]," ",t]}),e.jsx(Qe,{dir:"next",onClick:d,size:f})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:"var(--lucent-space-1)"},children:va.map(b=>e.jsx("div",{style:{textAlign:"center"},children:e.jsx(I.Text,{size:Ca[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?Ze(k,i):!1);let z=!1;return p!=null&&p.start&&(p!=null&&p.end)&&(z=!ve(k,p.start)&&!Ze(k,p.end)),e.jsx("button",{type:"button",disabled:v,onClick:()=>!v&&l(k),onMouseEnter:()=>{m(b),h==null||h(k)},onMouseLeave:()=>{m(null),h==null||h(null)},"aria-label":ie(k),"aria-pressed":S,style:{display:"flex",alignItems:"center",justifyContent:"center",height:ka[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:Sa[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 Ma({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date",disabled:a=!1,min:i,max:l,size:s="md",label:d,helperText:p,errorText:h,style:f}){const w=t!==void 0,[y,g]=c.useState(r),m=w?t:y,u=!!h,b=a,x=`lucent-datepicker-${Math.random().toString(36).slice(2,7)}`,k=new Date,[S,C]=c.useState((m??k).getFullYear()),[v,z]=c.useState((m??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[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: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:wa[s],width:"100%",height:ba[s],boxSizing:"border-box",padding:`0 ${xa[s]}`,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:m?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:ya[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:m?ie(m):o})]}),u&&e.jsx("span",{role:"alert",style:{fontSize:Te[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:h}),!u&&p&&e.jsx("span",{style:{fontSize:Te[s],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:gt[s],minWidth:qe[s]},children:e.jsx(De,{year:S,month:v,...m!==void 0&&{selected:m},today:k,...i!==void 0&&{min:i},...l!==void 0&&{max:l},onSelect:q,onPrevMonth:N,onNextMonth:H,size:s})}),document.body)]})}const za={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>();
398
+ />`}],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 ma(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 Ze(t,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate())>new Date(r.getFullYear(),r.getMonth(),r.getDate())}const ga=["January","February","March","April","May","June","July","August","September","October","November","December"],va=["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 ba={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)"},ya={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)"},xa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},wa={sm:"var(--lucent-space-2)",md:"calc((var(--lucent-space-2) + var(--lucent-space-3)) / 2)",lg:"var(--lucent-space-3)"},ka={sm:28,md:32,lg:38},Sa={sm:"var(--lucent-font-size-xs)",md:"var(--lucent-font-size-sm)",lg:"var(--lucent-font-size-md)"},Ta={sm:"xs",md:"sm",lg:"md"},Ca={sm:"xs",md:"xs",lg:"sm"},Ia={sm:24,md:28,lg:32},ja={sm:14,md:16,lg:18},gt={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-5)"},qe={sm:220,md:260,lg:300};function Qe({dir:t,onClick:r,disabled:n,size:o="md"}){const[a,i]=c.useState(!1),l=Ia[o],s=ja[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 De({year:t,month:r,selected:n,today:o,min:a,max:i,onSelect:l,onPrevMonth:s,onNextMonth:d,highlightRange:p,onDayHover:h,size:f="md"}){const w=fa(t,r),y=ma(t,r),[g,m]=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(Qe,{dir:"prev",onClick:s,size:f}),e.jsxs(I.Text,{weight:"medium",size:Ta[f],children:[ga[r]," ",t]}),e.jsx(Qe,{dir:"next",onClick:d,size:f})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:"var(--lucent-space-1)"},children:va.map(b=>e.jsx("div",{style:{textAlign:"center"},children:e.jsx(I.Text,{size:Ca[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?Ze(k,i):!1);let z=!1;return p!=null&&p.start&&(p!=null&&p.end)&&(z=!ve(k,p.start)&&!Ze(k,p.end)),e.jsx("button",{type:"button",disabled:v,onClick:()=>!v&&l(k),onMouseEnter:()=>{m(b),h==null||h(k)},onMouseLeave:()=>{m(null),h==null||h(null)},"aria-label":ie(k),"aria-pressed":S,style:{display:"flex",alignItems:"center",justifyContent:"center",height:ka[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:Sa[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 Ma({value:t,defaultValue:r,onChange:n,placeholder:o="Pick a date",disabled:a=!1,min:i,max:l,size:s="md",label:d,helperText:p,errorText:h,style:f}){const w=t!==void 0,[y,g]=c.useState(r),m=w?t:y,u=!!h,b=a,x=`lucent-datepicker-${Math.random().toString(36).slice(2,7)}`,k=new Date,[S,C]=c.useState((m??k).getFullYear()),[v,z]=c.useState((m??k).getMonth()),[T,E]=c.useState(!1),[F,B]=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)",R=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[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:x,disabled:a,onClick:()=>!a&&E(M=>!M),onFocus:()=>B(!0),onBlur:()=>B(!1),"aria-haspopup":"dialog","aria-expanded":T,"aria-invalid":u,style:{display:"flex",alignItems:"center",gap:wa[s],width:"100%",height:ba[s],boxSizing:"border-box",padding:`0 ${xa[s]}`,borderRadius:"var(--lucent-radius-lg)",border:`1px solid ${A}`,boxShadow:R,background:b?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"var(--lucent-surface)",color:m?"var(--lucent-text-primary)":"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)",fontSize:ya[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:m?ie(m):o})]}),u&&e.jsx("span",{role:"alert",style:{fontSize:Te[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:h}),!u&&p&&e.jsx("span",{style:{fontSize:Te[s],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:gt[s],minWidth:qe[s]},children:e.jsx(De,{year:S,month:v,...m!==void 0&&{selected:m},today:k,...i!==void 0&&{min:i},...l!==void 0&&{max:l},onSelect:q,onPrevMonth:N,onNextMonth:H,size:s})}),document.body)]})}const za={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>();
399
399
  <DatePicker
400
400
  value={date}
401
401
  onChange={setDate}
402
402
  min={new Date()}
403
403
  placeholder="Select a future date"
404
- />`}],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.'}},Ea={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)"},Aa={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},qa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},Da={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 Ra(t,r){return t?ge(t.start,t.end)?ie(t.start):`${ie(t.start)} → ${ie(t.end)}`:r}function vt({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:p,errorText:h,trigger:f,style:w}){const y=t!==void 0,[g,m]=c.useState(r),u=y?t:g,b=!!h,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||m(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[s],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:Da[s],width:"100%",height:Ea[s],boxSizing:"border-box",padding:`0 ${qa[s]}`,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:Aa[s],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:Ra(u,o)})]}),b&&e.jsx("span",{role:"alert",style:{fontSize:Ce[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:h}),!b&&p&&e.jsx("span",{style:{fontSize:Ce[s],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:gt[s],display:"flex",gap:"var(--lucent-space-6)"},children:[e.jsx("div",{style:{minWidth:qe[s]},children:e.jsx(De,{year:E,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:z},size:s})}),e.jsx("div",{style:{width:1,background:"var(--lucent-border-subtle)",flexShrink:0}}),e.jsx("div",{style:{minWidth:qe[s]},children:e.jsx(De,{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:z},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(I.Text,{size:"xs",color:"secondary",children:"Now pick the end date"})})]})}const Ba={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>();
405
- <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 Re(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Pa(){return Math.random().toString(36).slice(2)}function La({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:Re(t.file.size)}),a!==void 0&&!i&&e.jsx("div",{style:{marginTop:4,height:3,borderRadius:"var(--lucent-radius-full)",background:"color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",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?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"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 Fa({accept:t,multiple:r=!1,maxSize:n,value:o,onChange:a,onError:i,disabled:l=!1,style:s}){const d=o!==void 0,[p,h]=c.useState([]),f=d?o:p,[w,y]=c.useState(!1),[g,m]=c.useState(!1),u=c.useRef(null),b=c.useCallback(C=>{if(!C||l)return;const v=[];for(const T of Array.from(C)){if(n&&T.size>n){i==null||i(`"${T.name}" exceeds the ${Re(n)} limit.`);continue}if(!r&&f.length+v.length>=1)break;v.push({id:Pa(),file:T})}if(v.length===0)return;const z=r?[...f,...v]:v;d||h(z),a==null||a(z)},[l,f,d,n,r,a,i]),x=C=>{const v=f.filter(z=>z.id!==C);d||h(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)",...s},children:[e.jsxs("div",{role:"button",tabIndex:l?-1:0,"aria-label":"Upload files","aria-disabled":l,onClick:()=>{var C;return!l&&((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:()=>m(!0),onBlur:()=>m(!1),onDragOver:C=>{C.preventDefault(),l||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 ${l?"color-mix(in srgb, var(--lucent-text-primary) 15%, transparent)":w||g?"var(--lucent-accent-default)":"color-mix(in srgb, var(--lucent-text-primary) 20%, transparent)"}`,background:w?"var(--lucent-accent-subtle)":"color-mix(in srgb, var(--lucent-text-primary) 4%, transparent)",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)":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:l?"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: ${Re(n)}`].filter(Boolean).join(" · ")})]}),e.jsx("input",{ref:u,type:"file",accept:t,multiple:r,disabled:l,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(La,{item:C,onRemove:x},C.id))})]})}const Na={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. Its idle background and border are translucent color-mix overlays on top of var(--lucent-text-primary) (not hard-coded surface tokens), so the drop zone always reads as a visible step against whatever parent background it sits on — in any theme, in any palette. 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
404
+ />`}],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.'}},Ea={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)"},Aa={sm:"var(--lucent-font-size-sm)",md:"var(--lucent-font-size-md)",lg:"var(--lucent-font-size-md)"},qa={sm:"var(--lucent-space-3)",md:"var(--lucent-space-4)",lg:"var(--lucent-space-4)"},Da={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 Ba(t,r){return t?ge(t.start,t.end)?ie(t.start):`${ie(t.start)} → ${ie(t.end)}`:r}function vt({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:p,errorText:h,trigger:f,style:w}){const y=t!==void 0,[g,m]=c.useState(r),u=y?t:g,b=!!h,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()),[B,j]=c.useState(((u==null?void 0:u.start)??T).getMonth()),P=B===11?0:B+1,D=B===11?E+1:E,[W,q]=c.useState(!1),[N,H]=c.useState(!1),A=c.useRef(null),R=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=R.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||m(re),n==null||n(re),C(null),q(!1)}},L=()=>{B===0?(j(11),F(O=>O-1)):j(O=>O-1)},G=()=>{B===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[s],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:Da[s],width:"100%",height:Ea[s],boxSizing:"border-box",padding:`0 ${qa[s]}`,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:Aa[s],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:Ba(u,o)})]}),b&&e.jsx("span",{role:"alert",style:{fontSize:Ce[s],color:"var(--lucent-danger-text)",fontFamily:"var(--lucent-font-family-base)"},children:h}),!b&&p&&e.jsx("span",{style:{fontSize:Ce[s],color:"var(--lucent-text-secondary)",fontFamily:"var(--lucent-font-family-base)"},children:p}),W&&J.createPortal(e.jsxs("div",{ref:R,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:gt[s],display:"flex",gap:"var(--lucent-space-6)"},children:[e.jsx("div",{style:{minWidth:qe[s]},children:e.jsx(De,{year:E,month:B,...(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:z},size:s})}),e.jsx("div",{style:{width:1,background:"var(--lucent-border-subtle)",flexShrink:0}}),e.jsx("div",{style:{minWidth:qe[s]},children:e.jsx(De,{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:z},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(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>();
405
+ <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 Be(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Pa(){return Math.random().toString(36).slice(2)}function La({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:Be(t.file.size)}),a!==void 0&&!i&&e.jsx("div",{style:{marginTop:4,height:3,borderRadius:"var(--lucent-radius-full)",background:"color-mix(in srgb, var(--lucent-text-primary) 8%, transparent)",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?"color-mix(in srgb, var(--lucent-text-primary) 6%, transparent)":"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 Fa({accept:t,multiple:r=!1,maxSize:n,value:o,onChange:a,onError:i,disabled:l=!1,style:s}){const d=o!==void 0,[p,h]=c.useState([]),f=d?o:p,[w,y]=c.useState(!1),[g,m]=c.useState(!1),u=c.useRef(null),b=c.useCallback(C=>{if(!C||l)return;const v=[];for(const T of Array.from(C)){if(n&&T.size>n){i==null||i(`"${T.name}" exceeds the ${Be(n)} limit.`);continue}if(!r&&f.length+v.length>=1)break;v.push({id:Pa(),file:T})}if(v.length===0)return;const z=r?[...f,...v]:v;d||h(z),a==null||a(z)},[l,f,d,n,r,a,i]),x=C=>{const v=f.filter(z=>z.id!==C);d||h(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)",...s},children:[e.jsxs("div",{role:"button",tabIndex:l?-1:0,"aria-label":"Upload files","aria-disabled":l,onClick:()=>{var C;return!l&&((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:()=>m(!0),onBlur:()=>m(!1),onDragOver:C=>{C.preventDefault(),l||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 ${l?"color-mix(in srgb, var(--lucent-text-primary) 15%, transparent)":w||g?"var(--lucent-accent-default)":"color-mix(in srgb, var(--lucent-text-primary) 20%, transparent)"}`,background:w?"var(--lucent-accent-subtle)":"color-mix(in srgb, var(--lucent-text-primary) 4%, transparent)",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)":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:l?"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: ${Be(n)}`].filter(Boolean).join(" · ")})]}),e.jsx("input",{ref:u,type:"file",accept:t,multiple:r,disabled:l,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(La,{item:C,onRemove:x},C.id))})]})}const Na={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. Its idle background and border are translucent color-mix overlays on top of var(--lucent-text-primary) (not hard-coded surface tokens), so the drop zone always reads as a visible step against whatever parent background it sits on — in any theme, in any palette. 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
406
406
  multiple
407
407
  accept="image/*,.pdf"
408
408
  maxSize={5 * 1024 * 1024}
@@ -520,7 +520,7 @@ dismiss(id);`},{title:"Custom icon",description:"Override the built-in variant i
520
520
  background: color-mix(in srgb, var(--lucent-text-primary) 5%, transparent) !important;
521
521
  color: var(--lucent-text-primary) !important;
522
522
  }
523
- `,fe="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 m=document.createElement("style");m.textContent=mo,document.head.appendChild(m),s.current=!0}const d=xe[o],p=c.useRef(null),h=c.useRef(null),f=c.useRef(!1),w=c.useRef(0),y=c.useCallback(()=>{const m=p.current,u=h.current;if(!m||!u)return;const b=m.querySelector('[data-active="true"]'),x=m.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=m.getBoundingClientRect(),v=k.getBoundingClientRect();f.current?u.style.transition=[`top 150ms ${fe}`,`left 150ms ${fe}`,`width 150ms ${fe}`,`height 150ms ${fe}`,"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 m=p.current;if(!m)return;const u=new MutationObserver(g);return u.observe(m,{attributes:!0,attributeFilter:["data-active","data-active-parent","aria-hidden"],subtree:!0}),()=>u.disconnect()},[g]),c.useEffect(()=>{const m=p.current;if(!m)return;const u=new ResizeObserver(g);return u.observe(m),()=>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":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:h,"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 xt({children:t,href:r,isActive:n=!1,icon:o,badge:a,disabled:i=!1,onClick:l,as:s,style:d}){const{orientation:p,depth:h,inverse:f,size:w,parentHasIcon:y,requestMeasure:g}=c.useContext(X),m=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===$e?u=S:b.push(S);if(u)return e.jsx(go,{subMenu:u,orientation:p,depth:h,inverse:f,size:w,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 k=s??"a";return e.jsxs(k,{"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:m.gap,padding:p==="vertical"?`${m.paddingY} ${m.paddingX} ${m.paddingY} ${o!=null||y?"var(--lucent-space-2)":"var(--lucent-space-4)"}`:`${m.paddingY} ${m.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:m.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:m.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 go({children:t,icon:r,badge:n,isActive:o=!1,disabled:a=!1,onClick:i,style:l,subMenu:s,orientation:d,depth:p,inverse:h,size:f}){const{hasIcons:w,requestMeasure:y}=c.useContext(X),g=xe[f],[m,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=vo(s),T=o&&!z,E=!T&&!m&&z,F=o||z;c.useEffect(()=>{y()},[m,o,z,y]),c.useEffect(()=>{if(d!=="vertical")return;const M=b.current;if(M)if(m){const $=M.scrollHeight;k($);const V=setTimeout(()=>{k(void 0)},130);return()=>clearTimeout(V)}else k(M.scrollHeight),M.getBoundingClientRect(),k(0)},[m,d]),c.useEffect(()=>{if(d!=="horizontal"||!m)return;const M=$=>{S.current&&!S.current.contains($.target)&&q()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d,m]),c.useLayoutEffect(()=>{if(d!=="horizontal"||!m)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,m]);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"?m?q():W():u(!m))},H=M=>{a||(d==="vertical"?(M.key==="ArrowRight"&&!m&&(M.preventDefault(),u(!0)),M.key==="ArrowLeft"&&m&&(M.preventDefault(),u(!1))):(M.key==="ArrowDown"&&!m&&(M.preventDefault(),W()),M.key==="ArrowUp"&&m&&(M.preventDefault(),q())),(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),N()),M.key==="Escape"&&m&&(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":m,"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:h,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:s})})]}):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":m,"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?h?"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",...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":!m,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:h,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:m?"lucent-navmenu-open 200ms var(--lucent-easing-default) forwards":void 0},children:s})})})]})}function vo(t){return Be(t)}function Be(t){if(t==null)return!1;if(Array.isArray(t))return t.some(Be);if(typeof t=="object"&&"props"in t){const r=t;if(r.props.isActive)return!0;if(r.props.children)return Be(r.props.children)}return!1}function $e({children:t}){return e.jsx(e.Fragment,{children:t})}function wt({children:t,label:r,defaultOpen:n=!0,open:o,onOpenChange:a,collapsible:i,style:l}){const{orientation:s,inverse:d,size:p,hasIcons:h}=c.useContext(X),f=xe[p],w=i??r!=null,y=h?"var(--lucent-space-2)":"var(--lucent-space-4)";if(s==="horizontal")return e.jsx(e.Fragment,{children:t});const g=o!==void 0,[m,u]=c.useState(n),b=g?o:m,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)",...l},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(bo,{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,...l},children:t})}function kt({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 bo({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=xt;le.Group=wt;le.Sub=$e;le.Separator=kt;const je=120,yo=`
523
+ `,fe="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 m=document.createElement("style");m.textContent=mo,document.head.appendChild(m),s.current=!0}const d=xe[o],p=c.useRef(null),h=c.useRef(null),f=c.useRef(!1),w=c.useRef(0),y=c.useCallback(()=>{const m=p.current,u=h.current;if(!m||!u)return;const b=m.querySelector('[data-active="true"]'),x=m.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=m.getBoundingClientRect(),v=k.getBoundingClientRect();f.current?u.style.transition=[`top 150ms ${fe}`,`left 150ms ${fe}`,`width 150ms ${fe}`,`height 150ms ${fe}`,"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 m=p.current;if(!m)return;const u=new MutationObserver(g);return u.observe(m,{attributes:!0,attributeFilter:["data-active","data-active-parent","aria-hidden"],subtree:!0}),()=>u.disconnect()},[g]),c.useEffect(()=>{const m=p.current;if(!m)return;const u=new ResizeObserver(g);return u.observe(m),()=>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":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:h,"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 xt({children:t,href:r,isActive:n=!1,icon:o,badge:a,disabled:i=!1,onClick:l,as:s,style:d}){const{orientation:p,depth:h,inverse:f,size:w,parentHasIcon:y,requestMeasure:g}=c.useContext(X),m=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===$e?u=S:b.push(S);if(u)return e.jsx(go,{subMenu:u,orientation:p,depth:h,inverse:f,size:w,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 k=s??"a";return e.jsxs(k,{"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:m.gap,padding:p==="vertical"?`${m.paddingY} ${m.paddingX} ${m.paddingY} ${o!=null||y?"var(--lucent-space-2)":"var(--lucent-space-4)"}`:`${m.paddingY} ${m.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:m.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:m.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 go({children:t,icon:r,badge:n,isActive:o=!1,disabled:a=!1,onClick:i,style:l,subMenu:s,orientation:d,depth:p,inverse:h,size:f}){const{hasIcons:w,requestMeasure:y}=c.useContext(X),g=xe[f],[m,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=vo(s),T=o&&!z,E=!T&&!m&&z,F=o||z;c.useEffect(()=>{y()},[m,o,z,y]),c.useEffect(()=>{if(d!=="vertical")return;const M=b.current;if(M)if(m){const $=M.scrollHeight;k($);const V=setTimeout(()=>{k(void 0)},130);return()=>clearTimeout(V)}else k(M.scrollHeight),M.getBoundingClientRect(),k(0)},[m,d]),c.useEffect(()=>{if(d!=="horizontal"||!m)return;const M=$=>{S.current&&!S.current.contains($.target)&&q()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d,m]),c.useLayoutEffect(()=>{if(d!=="horizontal"||!m)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,m]);const[B,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"?m?q():W():u(!m))},H=M=>{a||(d==="vertical"?(M.key==="ArrowRight"&&!m&&(M.preventDefault(),u(!0)),M.key==="ArrowLeft"&&m&&(M.preventDefault(),u(!1))):(M.key==="ArrowDown"&&!m&&(M.preventDefault(),W()),M.key==="ArrowUp"&&m&&(M.preventDefault(),q())),(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),N()),M.key==="Escape"&&m&&(M.preventDefault(),d==="horizontal"?q():u(!1)))},A=()=>{d==="horizontal"&&!a&&(clearTimeout(v.current),W())},R=()=>{d==="horizontal"&&(v.current=setTimeout(()=>q(),150))};return d==="horizontal"?e.jsxs("div",{ref:S,style:{position:"relative"},onMouseEnter:A,onMouseLeave:R,children:[e.jsxs("button",{"data-lucent-navitem":"","data-hint":F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":m,"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:h,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:B==="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":E||void 0,"data-hint":!T&&!E&&F||void 0,onClick:M=>{N(),i==null||i(M)},onKeyDown:H,"aria-expanded":m,"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?h?"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",...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":!m,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:h,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:m?"lucent-navmenu-open 200ms var(--lucent-easing-default) forwards":void 0},children:s})})})]})}function vo(t){return Re(t)}function Re(t){if(t==null)return!1;if(Array.isArray(t))return t.some(Re);if(typeof t=="object"&&"props"in t){const r=t;if(r.props.isActive)return!0;if(r.props.children)return Re(r.props.children)}return!1}function $e({children:t}){return e.jsx(e.Fragment,{children:t})}function wt({children:t,label:r,defaultOpen:n=!0,open:o,onOpenChange:a,collapsible:i,style:l}){const{orientation:s,inverse:d,size:p,hasIcons:h}=c.useContext(X),f=xe[p],w=i??r!=null,y=h?"var(--lucent-space-2)":"var(--lucent-space-4)";if(s==="horizontal")return e.jsx(e.Fragment,{children:t});const g=o!==void 0,[m,u]=c.useState(n),b=g?o:m,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)",...l},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(bo,{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,...l},children:t})}function kt({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 bo({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=xt;le.Group=wt;le.Sub=$e;le.Separator=kt;const je=120,yo=`
524
524
  @keyframes lucent-filter-ms-in {
525
525
  from { opacity: 0; transform: scale(0.97) translateY(-2px); }
526
526
  to { opacity: 1; transform: scale(1) translateY(0); }
@@ -529,7 +529,7 @@ dismiss(id);`},{title:"Custom icon",description:"Override the built-in variant i
529
529
  from { opacity: 1; transform: scale(1) translateY(0); }
530
530
  to { opacity: 0; transform: scale(0.97) translateY(-2px); }
531
531
  }
532
- `;let nt=!1;const xo={xs:"var(--lucent-space-1)",sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},wo={xs:"sm",sm:"sm",md:"md",lg:"lg"},Me=4;function ko(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 So({label:t,options:r,value:n,defaultValue:o=[],onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:p}){const h=n!==void 0,[f,w]=c.useState(o),y=h?n:f,[g,m]=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(!nt&&typeof document<"u"){const q=document.createElement("style");q.textContent=yo,document.head.appendChild(q),nt=!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(ko(H.getBoundingClientRect(),N))});return()=>cancelAnimationFrame(q)},[u,x]);const F=c.useCallback(()=>m(!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];h||w(N),a==null||a(N)},j=()=>{h||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=xo[l],W=wo[l];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:l,...t?{chevron:!0}:{},disabled:s,onClick:()=>!s&&m(q=>!q),...d!==void 0&&{leftIcon:d},children:[t||void 0,y.length>0&&e.jsx(se,{variant:"accent",size:l==="xs"?"sm":l,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:l==="xs"?"sm":l,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 To({label:t,options:r,value:n,defaultValue:o,onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:p}){var x;const h=n!==void 0,[f,w]=c.useState(o),y=h?n:f,g=(x=r.find(k=>k.value===y))==null?void 0:x.label,m=y!==void 0,u=k=>{h||w(k),a==null||a(k)},b=()=>{h||w(void 0),a==null||a(void 0)};return e.jsxs(Ne,{trigger:e.jsx(I.Button,{variant:i==="outline"&&m?"secondary":i,size:l,chevron:!0,disabled:s,...d!==void 0&&{leftIcon:d},children:g??t}),size:l,...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)),m&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsx(me,{onSelect:b,children:e.jsx(I.Text,{size:l==="lg"?"md":"sm",color:"secondary",children:"Clear"})})]})]})}const Co=()=>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 Io({value:t,defaultValue:r="",onChange:n,placeholder:o="Search…",variant:a="secondary",size:i="sm",width:l=260,disabled:s=!1,style:d}){const p=t!==void 0,[h,f]=c.useState(r),w=p?t:h,[y,g]=c.useState(!!w),m=c.useRef(null);c.useEffect(()=>{y&&requestAnimationFrame(()=>{var k;return(k=m.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=()=>{s||g(!0)};return y?e.jsx(I.Input,{ref:m,placeholder:o,size:i,value:w,onChange:u,onBlur:b,disabled:s,style:{width:l,...d}}):e.jsx(I.Button,{variant:a,size:i,disabled:s,onClick:x,"aria-label":"Search",leftIcon:e.jsx(Co,{}),style:d})}function jo(t,r){if(!t)return r;const n=o=>o.toLocaleDateString();return`${n(t.start)} → ${n(t.end)}`}function Mo({label:t="Date range",value:r,defaultValue:n,onChange:o,variant:a="secondary",size:i="sm",min:l,max:s,disabled:d=!1,style:p}){const h=r!==void 0;return e.jsx(vt,{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(I.Button,{variant:a==="outline"&&h?"secondary":a,size:i,chevron:!0,disabled:d,children:jo(r,t)}),...p!==void 0&&{style:p}})}const zo={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 Eo(t){return typeof t=="string"?{label:t}:t}function Ao({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 Pe(t,r){return t<r?"completed":t===r?"current":"pending"}const qo={completed:"Completed",current:"In Progress",pending:"Pending"},Do={completed:"success",current:"accent",pending:"neutral"},rt="lucent-stepper-keyframes";function Ro(){if(typeof document>"u"||document.getElementById(rt))return;const t=document.createElement("style");t.id=rt,t.textContent="@keyframes lucent-stepper-check{0%{transform:scale(0)}60%{transform:scale(1.2)}100%{transform:scale(1)}}",document.head.appendChild(t)}function St({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(Ao,{size:o.checkIcon})}):t+1})}function Tt({state:t}){return e.jsx(se,{variant:Do[t],size:"sm",borderless:!0,children:qo[t]})}function Bo({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(Tt,{state:r})]})}function Po({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(St,{index:l,state:Pe(l,r),step:i,cfg:n})},i.label))]}),e.jsx("div",{style:{display:"flex"},children:t.map((i,l)=>{const s=Pe(l,r),d=l===t.length-1,p=l===0?"flex-start":d?"flex-end":"center",h=l===0?"left":d?"right":"center";return e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:p,gap:"2px",textAlign:h},children:e.jsx(Bo,{step:i,state:s,index:l,cfg:n,numbered:o,showStatus:a})},i.label)})})]})}function Lo({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=Pe(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(St,{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(Tt,{state:s})]})]},i.label)})})}function Fo({steps:t,current:r,size:n="md",orientation:o="horizontal",numbered:a=!1,showStatus:i=!1,style:l}){c.useEffect(Ro,[]);const s=zo[n],d=t.map(Eo),p=o==="vertical"?Lo:Po;return e.jsx("div",{role:"group","aria-label":"Progress steps",style:{fontFamily:"var(--lucent-font-family-base)",...l},children:e.jsx(p,{steps:d,current:r,cfg:s,numbered:a,showStatus:i})})}const No={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
532
+ `;let nt=!1;const xo={xs:"var(--lucent-space-1)",sm:"var(--lucent-space-2)",md:"var(--lucent-space-2)",lg:"var(--lucent-space-3)"},wo={xs:"sm",sm:"sm",md:"md",lg:"lg"},Me=4;function ko(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 So({label:t,options:r,value:n,defaultValue:o=[],onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:p}){const h=n!==void 0,[f,w]=c.useState(o),y=h?n:f,[g,m]=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(!nt&&typeof document<"u"){const q=document.createElement("style");q.textContent=yo,document.head.appendChild(q),nt=!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(ko(H.getBoundingClientRect(),N))});return()=>cancelAnimationFrame(q)},[u,x]);const F=c.useCallback(()=>m(!1),[]);c.useEffect(()=>{if(!g)return;const q=H=>{var R,M;const A=H.target;(R=T.current)!=null&&R.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 B=q=>{const N=y.includes(q)?y.filter(H=>H!==q):[...y,q];h||w(N),a==null||a(N)},j=()=>{h||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&&B(N.value)}},D=xo[l],W=wo[l];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:l,...t?{chevron:!0}:{},disabled:s,onClick:()=>!s&&m(q=>!q),...d!==void 0&&{leftIcon:d},children:[t||void 0,y.length>0&&e.jsx(se,{variant:"accent",size:l==="xs"?"sm":l,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&&B(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:l==="xs"?"sm":l,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 To({label:t,options:r,value:n,defaultValue:o,onChange:a,variant:i="secondary",size:l="sm",disabled:s=!1,icon:d,style:p}){var x;const h=n!==void 0,[f,w]=c.useState(o),y=h?n:f,g=(x=r.find(k=>k.value===y))==null?void 0:x.label,m=y!==void 0,u=k=>{h||w(k),a==null||a(k)},b=()=>{h||w(void 0),a==null||a(void 0)};return e.jsxs(Ne,{trigger:e.jsx(I.Button,{variant:i==="outline"&&m?"secondary":i,size:l,chevron:!0,disabled:s,...d!==void 0&&{leftIcon:d},children:g??t}),size:l,...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)),m&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{}),e.jsx(me,{onSelect:b,children:e.jsx(I.Text,{size:l==="lg"?"md":"sm",color:"secondary",children:"Clear"})})]})]})}const Co=()=>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 Io({value:t,defaultValue:r="",onChange:n,placeholder:o="Search…",variant:a="secondary",size:i="sm",width:l=260,disabled:s=!1,style:d}){const p=t!==void 0,[h,f]=c.useState(r),w=p?t:h,[y,g]=c.useState(!!w),m=c.useRef(null);c.useEffect(()=>{y&&requestAnimationFrame(()=>{var k;return(k=m.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=()=>{s||g(!0)};return y?e.jsx(I.Input,{ref:m,placeholder:o,size:i,value:w,onChange:u,onBlur:b,disabled:s,style:{width:l,...d}}):e.jsx(I.Button,{variant:a,size:i,disabled:s,onClick:x,"aria-label":"Search",leftIcon:e.jsx(Co,{}),style:d})}function jo(t,r){if(!t)return r;const n=o=>o.toLocaleDateString();return`${n(t.start)} → ${n(t.end)}`}function Mo({label:t="Date range",value:r,defaultValue:n,onChange:o,variant:a="secondary",size:i="sm",min:l,max:s,disabled:d=!1,style:p}){const h=r!==void 0;return e.jsx(vt,{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(I.Button,{variant:a==="outline"&&h?"secondary":a,size:i,chevron:!0,disabled:d,children:jo(r,t)}),...p!==void 0&&{style:p}})}const zo={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 Eo(t){return typeof t=="string"?{label:t}:t}function Ao({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 Pe(t,r){return t<r?"completed":t===r?"current":"pending"}const qo={completed:"Completed",current:"In Progress",pending:"Pending"},Do={completed:"success",current:"accent",pending:"neutral"},rt="lucent-stepper-keyframes";function Bo(){if(typeof document>"u"||document.getElementById(rt))return;const t=document.createElement("style");t.id=rt,t.textContent="@keyframes lucent-stepper-check{0%{transform:scale(0)}60%{transform:scale(1.2)}100%{transform:scale(1)}}",document.head.appendChild(t)}function St({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(Ao,{size:o.checkIcon})}):t+1})}function Tt({state:t}){return e.jsx(se,{variant:Do[t],size:"sm",borderless:!0,children:qo[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(Tt,{state:r})]})}function Po({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(St,{index:l,state:Pe(l,r),step:i,cfg:n})},i.label))]}),e.jsx("div",{style:{display:"flex"},children:t.map((i,l)=>{const s=Pe(l,r),d=l===t.length-1,p=l===0?"flex-start":d?"flex-end":"center",h=l===0?"left":d?"right":"center";return e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:p,gap:"2px",textAlign:h},children:e.jsx(Ro,{step:i,state:s,index:l,cfg:n,numbered:o,showStatus:a})},i.label)})})]})}function Lo({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=Pe(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(St,{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(Tt,{state:s})]})]},i.label)})})}function Fo({steps:t,current:r,size:n="md",orientation:o="horizontal",numbered:a=!1,showStatus:i=!1,style:l}){c.useEffect(Bo,[]);const s=zo[n],d=t.map(Eo),p=o==="vertical"?Lo:Po;return e.jsx("div",{role:"group","aria-label":"Progress steps",style:{fontFamily:"var(--lucent-font-family-base)",...l},children:e.jsx(p,{steps:d,current:r,cfg:s,numbered:a,showStatus:i})})}const No={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
533
533
  steps={['Basic Details', 'Company Details', 'Subscription', 'Payment']}
534
534
  current={2}
535
535
  numbered
@@ -691,4 +691,4 @@ const myTheme = createTheme({
691
691
  </div>
692
692
  </LucentProvider>`}],compositionGraph:[]},Ho={accentDefault:"#e9c96b",accentHover:"#ddb84e",accentSubtle:"#fef9ec"};function Go(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 Ct(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 Uo(t){const r=Ct(t);if(!r.valid){const n=r.errors.map(o=>` ${o.field}: ${o.message}`).join(`
693
693
  `);throw new Error(`Invalid ComponentManifest:
694
- ${n}`)}}function _o(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 Yo="1.0",Ko="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=Fr;exports.AlertManifest=Nr;exports.Avatar=$t;exports.AvatarManifest=Wt;exports.BadgeManifest=qt;exports.Breadcrumb=ft;exports.ButtonGroup=ht;exports.ButtonGroupManifest=sr;exports.ButtonManifest=It;exports.CHIP_MANIFEST=Pt;exports.COLOR_PICKER_MANIFEST=qn;exports.COLOR_SWATCH_MANIFEST=Dn;exports.COMMAND_PALETTE_MANIFEST=sa;exports.Card=Mr;exports.CardBleed=zr;exports.CardManifest=Er;exports.CardPaddingContext=ye;exports.Checkbox=be;exports.CheckboxManifest=Kt;exports.Chip=se;exports.CodeBlock=Sn;exports.CodeBlockManifest=Tn;exports.Collapsible=Yr;exports.CommandPalette=ia;exports.DATA_TABLE_MANIFEST=ra;exports.DATE_PICKER_MANIFEST=za;exports.DATE_RANGE_PICKER_MANIFEST=Ba;exports.DataTable=Qr;exports.DatePicker=Ma;exports.DateRangePicker=vt;exports.Divider=st;exports.DividerManifest=Gt;exports.EmptyState=$r;exports.EmptyStateManifest=Wr;exports.FILE_UPLOAD_MANIFEST=Na;exports.FileUpload=Fa;exports.FilterDateRange=Mo;exports.FilterMultiSelect=So;exports.FilterSearch=Io;exports.FilterSelect=To;exports.FormField=lr;exports.FormFieldManifest=cr;exports.Icon=mn;exports.IconManifest=gn;exports.InputManifest=jt;exports.LUCENT_UI_VERSION=Ko;exports.LucentProviderManifest=Vo;exports.MANIFEST_SPEC_VERSION=Yo;exports.MULTI_SELECT_MANIFEST=ha;exports.Menu=Ne;exports.MenuGroup=Jn;exports.MenuItem=me;exports.MenuManifest=Zn;exports.MenuSeparator=dt;exports.MultiSelect=pa;exports.NavLink=bn;exports.NavMenu=le;exports.NavMenuGroup=wt;exports.NavMenuItem=xt;exports.NavMenuSeparator=kt;exports.NavMenuSub=$e;exports.PageHeader=$o;exports.PageHeaderManifest=Wo;exports.PageLayout=Jr;exports.Progress=Hn;exports.ProgressManifest=Gn;exports.Radio=en;exports.RadioGroup=ct;exports.RadioGroupUncontrolled=tn;exports.RadioManifest=nn;exports.Row=Ee;exports.RowManifest=$n;exports.SEGMENTED_CONTROL_MANIFEST=Rn;exports.SearchInput=mr;exports.SearchInputManifest=gr;exports.SelectManifest=an;exports.Skeleton=Hr;exports.SkeletonManifest=Gr;exports.SliderManifest=yn;exports.Spinner=it;exports.SpinnerManifest=Ht;exports.SplitButton=pt;exports.SplitButtonManifest=ir;exports.Stack=ze;exports.StackManifest=Ln;exports.Stepper=Fo;exports.StepperManifest=No;exports.TIMELINE_MANIFEST=Va;exports.Table=ne;exports.TableManifest=An;exports.Tag=ln;exports.TagManifest=cn;exports.TextManifest=vn;exports.Textarea=ot;exports.TextareaManifest=At;exports.ThemeAnchorsSpec=Oo;exports.Timeline=Oa;exports.ToastManifest=fo;exports.ToastProvider=ho;exports.ToggleManifest=rn;exports.Tooltip=pn;exports.TooltipManifest=hn;exports.accentTokens=Go;exports.assertManifest=Uo;exports.brandTokens=Ho;exports.isValidPropDescriptor=_o;exports.useToast=Ha;exports.validateManifest=Ct;
694
+ ${n}`)}}function _o(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 Yo="1.0",Ko="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=Fr;exports.AlertManifest=Nr;exports.Avatar=$t;exports.AvatarManifest=Wt;exports.BadgeManifest=qt;exports.Breadcrumb=ft;exports.ButtonGroup=ht;exports.ButtonGroupManifest=sr;exports.ButtonManifest=It;exports.CHIP_MANIFEST=Pt;exports.COLOR_PICKER_MANIFEST=qn;exports.COLOR_SWATCH_MANIFEST=Dn;exports.COMMAND_PALETTE_MANIFEST=sa;exports.Card=Mr;exports.CardBleed=zr;exports.CardManifest=Er;exports.CardPaddingContext=ye;exports.Checkbox=be;exports.CheckboxManifest=Kt;exports.Chip=se;exports.CodeBlock=Sn;exports.CodeBlockManifest=Tn;exports.Collapsible=Yr;exports.CommandPalette=ia;exports.DATA_TABLE_MANIFEST=ra;exports.DATE_PICKER_MANIFEST=za;exports.DATE_RANGE_PICKER_MANIFEST=Ra;exports.DataTable=Qr;exports.DatePicker=Ma;exports.DateRangePicker=vt;exports.Divider=st;exports.DividerManifest=Gt;exports.EmptyState=$r;exports.EmptyStateManifest=Wr;exports.FILE_UPLOAD_MANIFEST=Na;exports.FileUpload=Fa;exports.FilterDateRange=Mo;exports.FilterMultiSelect=So;exports.FilterSearch=Io;exports.FilterSelect=To;exports.FormField=lr;exports.FormFieldManifest=cr;exports.Icon=mn;exports.IconManifest=gn;exports.InputManifest=jt;exports.LUCENT_UI_VERSION=Ko;exports.LucentProviderManifest=Vo;exports.MANIFEST_SPEC_VERSION=Yo;exports.MULTI_SELECT_MANIFEST=ha;exports.Menu=Ne;exports.MenuGroup=Jn;exports.MenuItem=me;exports.MenuManifest=Zn;exports.MenuSeparator=dt;exports.MultiSelect=pa;exports.NavLink=bn;exports.NavMenu=le;exports.NavMenuGroup=wt;exports.NavMenuItem=xt;exports.NavMenuSeparator=kt;exports.NavMenuSub=$e;exports.PageHeader=$o;exports.PageHeaderManifest=Wo;exports.PageLayout=Jr;exports.Progress=Hn;exports.ProgressManifest=Gn;exports.Radio=en;exports.RadioGroup=ct;exports.RadioGroupUncontrolled=tn;exports.RadioManifest=nn;exports.Row=Ee;exports.RowManifest=$n;exports.SEGMENTED_CONTROL_MANIFEST=Bn;exports.SearchInput=mr;exports.SearchInputManifest=gr;exports.SelectManifest=an;exports.Skeleton=Hr;exports.SkeletonManifest=Gr;exports.SliderManifest=yn;exports.Spinner=it;exports.SpinnerManifest=Ht;exports.SplitButton=pt;exports.SplitButtonManifest=ir;exports.Stack=ze;exports.StackManifest=Ln;exports.Stepper=Fo;exports.StepperManifest=No;exports.TIMELINE_MANIFEST=Va;exports.Table=ne;exports.TableManifest=An;exports.Tag=ln;exports.TagManifest=cn;exports.TextManifest=vn;exports.Textarea=ot;exports.TextareaManifest=At;exports.ThemeAnchorsSpec=Oo;exports.Timeline=Oa;exports.ToastManifest=fo;exports.ToastProvider=ho;exports.ToggleManifest=rn;exports.Tooltip=pn;exports.TooltipManifest=hn;exports.accentTokens=Go;exports.assertManifest=Uo;exports.brandTokens=Ho;exports.isValidPropDescriptor=_o;exports.useToast=Ha;exports.validateManifest=Ct;