@kb.ui/react 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +79 -66
  2. package/dist/components/ConfirmAction/ConfirmAction.d.ts +42 -0
  3. package/dist/components/Dashboard/Dashboard.d.ts +17 -0
  4. package/dist/components/Form/Form.d.ts +19 -0
  5. package/dist/components/FormSection/FormSection.d.ts +26 -0
  6. package/dist/components/Gallery/Gallery.d.ts +26 -0
  7. package/dist/components/PageHeader/PageHeader.d.ts +27 -0
  8. package/dist/components/Panel/Panel.d.ts +3 -1
  9. package/dist/components/Settings/Settings.d.ts +11 -0
  10. package/dist/components/Skeleton/Skeleton.d.ts +8 -6
  11. package/dist/components/Stack/Stack.d.ts +15 -0
  12. package/dist/components/StatsRow/StatsRow.d.ts +33 -0
  13. package/dist/components/SupportingPane/SupportingPane.d.ts +15 -0
  14. package/dist/index.d.ts +10 -0
  15. package/dist/index.js +718 -333
  16. package/dist/index.js.map +1 -1
  17. package/dist/styles.css +1 -1
  18. package/docs/components/Accordion.md +9 -9
  19. package/docs/components/Avatar.md +4 -4
  20. package/docs/components/Badge.md +4 -4
  21. package/docs/components/Button.md +8 -8
  22. package/docs/components/Callout.md +3 -3
  23. package/docs/components/Card.md +4 -4
  24. package/docs/components/Checkbox.md +5 -5
  25. package/docs/components/Code.md +2 -2
  26. package/docs/components/CodeBlock.md +7 -7
  27. package/docs/components/Collection.md +5 -5
  28. package/docs/components/CollectionList.md +6 -6
  29. package/docs/components/CollectionRow.md +11 -11
  30. package/docs/components/Combobox.md +3 -3
  31. package/docs/components/ConfirmAction.md +100 -0
  32. package/docs/components/Container.md +2 -2
  33. package/docs/components/CopyableText.md +9 -9
  34. package/docs/components/Dashboard.md +81 -0
  35. package/docs/components/DescriptionList.md +3 -3
  36. package/docs/components/Dialog.md +7 -7
  37. package/docs/components/Disclosure.md +4 -4
  38. package/docs/components/EmptyState.md +1 -1
  39. package/docs/components/ErrorSummary.md +5 -3
  40. package/docs/components/Fieldset.md +6 -6
  41. package/docs/components/FileInput.md +5 -5
  42. package/docs/components/Form.md +67 -0
  43. package/docs/components/FormActions.md +3 -3
  44. package/docs/components/FormSection.md +57 -0
  45. package/docs/components/Gallery.md +84 -0
  46. package/docs/components/Grid.md +13 -13
  47. package/docs/components/Heading.md +3 -3
  48. package/docs/components/Image.md +3 -3
  49. package/docs/components/Inline.md +3 -3
  50. package/docs/components/Input.md +3 -3
  51. package/docs/components/Link.md +2 -2
  52. package/docs/components/Menu.md +5 -5
  53. package/docs/components/MultiSelect.md +2 -2
  54. package/docs/components/NumberField.md +5 -5
  55. package/docs/components/PageHeader.md +68 -0
  56. package/docs/components/Panel.md +11 -3
  57. package/docs/components/Popover.md +9 -9
  58. package/docs/components/Progress.md +1 -1
  59. package/docs/components/RadioGroup.md +3 -3
  60. package/docs/components/ScrollArea.md +1 -1
  61. package/docs/components/Select.md +2 -2
  62. package/docs/components/Separator.md +3 -3
  63. package/docs/components/Settings.md +57 -0
  64. package/docs/components/Skeleton.md +56 -16
  65. package/docs/components/Spinner.md +9 -4
  66. package/docs/components/Split.md +4 -4
  67. package/docs/components/Stack.md +54 -0
  68. package/docs/components/Stat.md +1 -1
  69. package/docs/components/StatsRow.md +80 -0
  70. package/docs/components/Status.md +7 -6
  71. package/docs/components/SupportingPane.md +59 -0
  72. package/docs/components/Switch.md +5 -5
  73. package/docs/components/Table.md +12 -12
  74. package/docs/components/Tabs.md +10 -10
  75. package/docs/components/Text.md +2 -2
  76. package/docs/components/Textarea.md +4 -4
  77. package/docs/components/Thumbnail.md +7 -7
  78. package/docs/components/Toast.md +9 -9
  79. package/docs/components/Toolbar.md +4 -4
  80. package/docs/components/Tooltip.md +3 -3
  81. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Base","Base","_Fragment","BaseInput","Base","defaultRemoveLabel","Base","Base","Base","_Fragment","Base","_Fragment","Base","Separator","Base","Base","Base","BaseGroup","Base","_Fragment","BaseTabs","cx","Base","_Fragment","Base","Base","Accordion$1","Fragment$1","Button$1","Input$1","Select$1","Combobox$1","Dialog$1","Menu$1","Separator$1","NumberField$1","Popover$1","Progress$1","RadioGroup$1","ScrollArea$1","Tabs$1","Toast$1","Toolbar$1","Tooltip$1","CollapsiblePanel","exiting","state","nativeProps","useRender","render","props","isValidElement","cloneElement","kb","out","clsx","name","className","key","value","attrs","resolveInvalid","hasAria","ariaInvalid","invalid","hasError","AccordionRoot","AccordionItem","AccordionHeader","AccordionTrigger","AccordionPanel","Accordion","Image","ImageFrame","hasSource","src","srcSet","setState","useState","intrinsicRatio","width","height","classNames","alt","ratio","style","fallback","position","image","onLoad","event","onError","Avatar","words","letters","word","decorative","initials","Badge","preserveCase","Button","Callout","live","icon","title","actions","Card","createElement","as","Checkbox","providedId","callerAriaInvalid","generated","useId","id","input","useRef","useImperativeHandle","ref","useLayoutEffect","indeterminate","error","described","description","theme","property","checked","readOnly","controlClassName","disabled","onCheckedChange","visuallyHidden","label","useClipboard","feedback","setFeedback","epoch","busy","timer","copy","request","onCopyError","duration","feedbackDuration","onCopy","LANGUAGE_LABELS","formatCodeLanguage","language","TS_KEYWORDS","TS_BUILTIN_TYPES","TS_EXPR_KEYWORDS","TS_TYPE_LEAD_KEYWORDS","CSS_KEYWORDS","SHELL_KEYWORDS","isIdentStart","ch","isIdentChar","scanQuotedString","quote","code","start","allowMultiline","findMatchingBrace","depth","i","openPos","nl","end","tokenizeTsx","tokens","lastWord","prevNonSpaceChar","jsxDepth","push","baseOffset","kind","closeBrace","exprEnd","close","segStart","cursor","c","expr","tagMatch","selfClosing","attrMatch","numMatch","len","identMatch","afterSlice","isCall","isObjKey","opMatch","op","tokenizeCss","braceDepth","inAtRuleHeader","m","propMatch","restAfterColon","nextSemi","nextBrace","fnMatch","varMatch","restToBrace","nextOpenBrace","pseudoMatch","selMatch","wordMatch","tokenizeHtml","isClose","tagStart","tokenizeJson","isKey","kwMatch","tokenizeShell","expectCommand","flagMatch","tokenizeCode","renderLineTokens","lineText","lineEnd","lineStart","nodes","tokStart","tokEnd","Code","collapsedProp","viewportId","uncontrolledCollapsed","setUncontrolledCollapsed","defaultCollapsed","rawCode","children","clipboard","copyState","expandedHeight","setExpandedHeight","preRef","resolvedMinLines","minLines","resolvedCollapsedLines","collapsedLines","collapsible","element","measure","next","observer","hasBlockProps","copyable","lineNumbers","highlightLines","maxHeight","isMultilineString","block","isCollapsed","showCopy","languageLabel","hasMeta","hasActions","showHeader","resolvedTokens","lines","highlightSet","extraLineCount","blockStyle","handleToggleCollapse","onCollapsedChange","resolvedCopyLabel","copyLabel","copyingLabel","copiedLabel","copyErrorLabel","copyAnnouncement","successMessage","errorMessage","offset","lineNumber","startLine","idx","isHighlighted","Fragment","extraOffset","CodeBlock","Input","Field","startContent","endContent","Select","callerDescription","root","trigger","popup","interaction","pointerFocus","setPointerFocus","empty","options","inactive","help","item","onValueChange","details","container","popupClassName","active","option","positiveInteger","collectionPageCount","pageSize","totalItems","useCollection","internal","setInternal","derive","requested","keys","disabledKeys","items","getKey","isItemDisabled","processed","matches","compare","sort","a","b","pageCount","pageItems","selectableKeys","selected","selectedOnPage","context","latest","index","change","current","patch","removed","keysToRemove","CollectionPagination","count","page","sizes","pageSizes","size","onPageSizeChange","onPageChange","CollectionBulkActions","pending","setPending","failed","setFailed","selectedKeys","lock","selection","success","onSuccess","run","action","snapshot","onPendingChange","onClear","CollectionRoot","blocked","loading","collection","columns","column","mode","slot","part","filters","filter","toolbar","selectable","bulkActions","sortable","direction","getItemLabel","Collection","CollectionList","hasSlotContent","CollectionRow","aside","metadata","leading","defaultRemoveLabel$1","chipAriaReset","MultiSelect","forwardRef","ariaDescribedBy","rest","uid","rootRef","inputId","labelId","descId","errId","isInvalid","hasDescription","describedBy","useMemo","o","optionMap","selectedValues","v","selectedOptions","onOpenChange","removeLabel","clearLabel","toggleLabel","emptyMessage","Combobox","_","SingleCombobox","validValue","Container","gutter","LinkComponentContext","createContext","LinkProvider","component","useLinkComponent","useContext","LinkRoot","Anchor","Link","highlightRanges","terms","highlight","ranges","term","webLinks","links","match","href","last","opener","url","link","CODE_LANGUAGES","detectCopyableLanguage","source","fence","renderCopyableContent","highlights","text","range","from","to","tokenStart","tokenEnd","begin","finish","codeRanges","CopyableText","valueId","codeLanguage","format","disclosure","setDisclosure","expanded","truncate","buttonLabel","linkify","collapseLabel","expandLabel","DescriptionListRoot","DescriptionListItem","DescriptionListTerm","DescriptionListDetail","DescriptionList","DialogRoot","DialogTrigger","DialogClose","DialogTitle","DialogDescription","DialogActions","DialogHeader","DialogBody","DialogFooter","DialogContent","hasTitle","heading","layout","Dialog","DisclosureRoot","Collapsible","DisclosureTrigger","DisclosurePanel","Disclosure","headingTags","EmptyState","HeadingTag","headingLevel","eyebrow","footer","FOCUSABLE_CHILD_SELECTOR","focusTargetByHref","rawId","targetId","doc","focusTarget","ErrorSummary","ariaLabelledBy","reactId","baseId","titleId","descriptionId","labelledBy","seenKeys","baseKey","occurrence","itemKey","onItemSelect","Fieldset","errorId","legend","defaultRemoveLabel","defaultRemovedMessage","defaultSelectionMessage","FileInput","removeButtons","announcement","setAnnouncement","inputRef","triggerRef","removedMessage","onBlurCapture","control","files","onFiles","selectionMessage","triggerClassName","chooseLabel","listClassName","itemClassName","renderItem","node","onRemove","FormActions","Grid","minItemWidth","Heading","level","Inline","PointerFocus","MenuRoot","useEffect","keyboard","open","MenuTrigger","MenuContent","MenuItem","MenuSeparator","Menu","NumberField","inputProps","step","groupClassName","decrementLabel","inputClassName","incrementLabel","NestedContext","CollapsibleContext","DirectionContext","paneBefore","handle","PanelRoot","content","rail","defaultOpen","PanelHeader","PanelToolbar","PanelBody","merged","jsx","PanelFooter","PanelWell","PanelToggle","PanelGroup","PanelHandle","row","clamp","max","min","inner","setInner","defaultSize","controls","setControls","dragging","setDragging","restore","fallbackId","target","commit","onSizeChange","handleKeyDown","handlePointerDown","onPointerDown","handlePointerMove","group","length","endDrag","onPointerUp","onPointerCancel","Panel","PopoverRoot","PopoverTrigger","PopoverClose","PopoverTitle","PopoverDescription","PopoverHeader","PopoverBody","PopoverFooter","PopoverContent","positionerProps","Popover","Progress","valueText","formatted","EntryContext","RadioOptions","track","setSelection","segmented","resize","observeItems","changes","RadioControl","entry","update","remove","eligible","customTabIndex","tabIndex","RadioGroupRoot","focused","inside","setInside","markFocused","useCallback","entries","setEntries","previous","data","onFocusCapture","selectionMotion","selectionTone","appearance","RadioGroupItem","Radio","controlProps","RadioGroup","ScrollArea","vars","Separator","orientation","toDimension","Skeleton","variant","inlineSize","blockSize","isAnimated","animated","animation","rootStyle","lineStyle","lineIndices","DOT_CX","BAR_X","Spinner","showLabel","cxPos","xPos","Split","trackClassName","Children","child","Stat","Status","Switch","offColor","onColor","resolvedOffTone","offTone","resolvedOnTone","onTone","tone","controlId","descriptions","offIcon","onIcon","TableRoot","stickyHeader","revealTableFocus","table","viewport","candidate","bounds","left","top","focusedEdge","cell","visibleLeft","visibleRight","pinnedCells","cellBounds","head","visibleTop","visibleBottom","targetBounds","TableScrollContainer","onFocus","TableCaption","TableHead","TableBody","TableFoot","TableRow","TableColumnHeader","ariaSort","sortDirection","onSortChange","sortDisabled","TableRowHeader","TableCell","TableRowActions","Table","TabsStyleContext","TabsIndicator","TabsList","hasExplicitIndicator","showIndicator","TabsTab","badge","TabsPanel","TabsRoot","Tabs","Text","Textarea","onChange","Thumbnail","captionId","hasCaption","caption","imageProps","createToastManager","useToastManager","ToastContent","ToastTitle","ToastDescription","ToastAction","ToastClose","toastTone","type","ToastRoot","toast","closeLabel","ToastViewport","toasts","renderToast","placement","Toast","ToolbarRoot","ToolbarGroup","ToolbarButton","ToolbarSeparator","Toolbar","Tooltip"],"sources":["../src/utils/CollapsiblePanel.tsx","../src/utils/kb.ts","../src/components/Accordion/Accordion.tsx","../src/components/Image/Image.tsx","../src/components/Avatar/Avatar.tsx","../src/components/Badge/Badge.tsx","../src/components/Button/Button.tsx","../src/components/Callout/Callout.tsx","../src/components/Card/Card.tsx","../src/components/Checkbox/Checkbox.tsx","../src/utils/useClipboard.ts","../src/components/Code/tokenize.ts","../src/components/Code/Code.tsx","../src/components/CodeBlock/CodeBlock.tsx","../src/components/Input/Input.tsx","../src/components/Select/Select.tsx","../src/components/Collection/useCollection.ts","../src/components/Collection/Collection.tsx","../src/components/CollectionList/CollectionList.tsx","../src/components/CollectionRow/CollectionRow.tsx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/Combobox/Combobox.tsx","../src/components/Container/Container.tsx","../src/components/Link/Link.tsx","../src/components/CopyableText/content.tsx","../src/components/CopyableText/CopyableText.tsx","../src/components/DescriptionList/DescriptionList.tsx","../src/components/Dialog/Dialog.tsx","../src/components/Disclosure/Disclosure.tsx","../src/components/EmptyState/EmptyState.tsx","../src/components/ErrorSummary/ErrorSummary.tsx","../src/components/Fieldset/Fieldset.tsx","../src/components/FileInput/FileInput.tsx","../src/components/FormActions/FormActions.tsx","../src/components/Grid/Grid.tsx","../src/components/Heading/Heading.tsx","../src/components/Inline/Inline.tsx","../src/components/Menu/Menu.tsx","../src/components/NumberField/NumberField.tsx","../src/components/Panel/Panel.tsx","../src/components/Popover/Popover.tsx","../src/components/Progress/Progress.tsx","../src/components/RadioGroup/RadioGroup.tsx","../src/components/ScrollArea/ScrollArea.tsx","../src/components/Separator/Separator.tsx","../src/components/Skeleton/Skeleton.tsx","../src/components/Spinner/Spinner.tsx","../src/components/Split/Split.tsx","../src/components/Stat/Stat.tsx","../src/components/Status/Status.tsx","../src/components/Switch/Switch.tsx","../src/components/Table/Table.tsx","../src/components/Tabs/Tabs.tsx","../src/components/Text/Text.tsx","../src/components/Textarea/Textarea.tsx","../src/components/Thumbnail/Thumbnail.tsx","../src/components/Toast/Toast.tsx","../src/components/Toolbar/Toolbar.tsx","../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cloneElement, isValidElement } from \"react\";\n\ntype CollapsiblePanelProps<State> = {\n nativeProps: useRender.ElementProps<\"div\">;\n state: State;\n render?: useRender.RenderProp<State> | undefined;\n};\n\nexport function CollapsiblePanel<State extends { open: boolean }>({\n nativeProps,\n state,\n render,\n}: CollapsiblePanelProps<State>) {\n const exiting = !state.open && !nativeProps.hidden;\n return useRender({\n props: {\n ...nativeProps,\n // Block focus during exit; settled hidden-until-found content stays searchable.\n inert: exiting || nativeProps.inert,\n },\n render:\n typeof render === \"function\"\n ? (props) => render(props, state)\n : exiting && isValidElement<{ inert?: boolean }>(render)\n ? cloneElement(render, { inert: true })\n : render,\n });\n}\n","import { clsx } from \"clsx\";\n\nexport type KbAttrs = Record<string, string | boolean | undefined>;\n// Extra classes per inner part, applied after kbui's own class.\nexport type ClassNames<Slot extends string> = Partial<Record<Slot, string>>;\nexport type KbProps = { className: string } & Record<`data-${string}`, string>;\nexport type AriaInvalid = boolean | \"false\" | \"true\" | \"grammar\" | \"spelling\" | undefined;\n\n// false/undefined vanish so data-disabled=\"false\" can never leak into the DOM.\nexport function kb(name: string, attrs: KbAttrs = {}, className?: string): KbProps {\n const out: KbProps = { className: clsx(`kb-${name}`, className) };\n for (const [key, value] of Object.entries(attrs)) {\n if (value === undefined || value === false) continue;\n out[`data-${key}`] = value === true ? \"\" : value;\n }\n return out;\n}\n\n// Preserves caller aria-invalid tokens (e.g. \"grammar\") while syncing wrapper data-invalid.\nexport function resolveInvalid(\n hasError: boolean,\n ariaInvalid?: AriaInvalid,\n): { invalid: boolean; ariaInvalid: AriaInvalid } {\n const hasAria = ariaInvalid !== undefined && ariaInvalid !== false && ariaInvalid !== \"false\";\n const invalid = hasError || hasAria;\n return { invalid, ariaInvalid: hasAria ? ariaInvalid : invalid ? true : ariaInvalid };\n}\n","import { Accordion as Base } from \"@base-ui/react/accordion\";\nimport { CollapsiblePanel } from \"../../utils/CollapsiblePanel\";\nimport { kb } from \"../../utils/kb\";\n\nexport type AccordionProps<Value = string> = Omit<Base.Root.Props<Value>, \"className\"> & {\n /** Plain class string on root. */\n className?: string | undefined;\n};\nexport type AccordionItemProps = Omit<Base.Item.Props, \"className\"> & {\n /** Plain class string on item. */\n className?: string | undefined;\n};\nexport type AccordionHeaderProps = Omit<Base.Header.Props, \"className\"> & {\n /** Plain class string on heading; use render to set heading rank. */\n className?: string | undefined;\n};\nexport type AccordionTriggerProps = Omit<Base.Trigger.Props, \"className\"> & {\n /** Plain class string on trigger. */\n className?: string | undefined;\n};\nexport type AccordionPanelProps = Omit<Base.Panel.Props, \"className\"> & {\n /** Plain class string on panel. */\n className?: string | undefined;\n};\n\nfunction AccordionRoot<Value = string>({ className, ...props }: AccordionProps<Value>) {\n return <Base.Root {...props} {...kb(\"accordion\", {}, className)} />;\n}\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return <Base.Item {...props} {...kb(\"accordion-item\", {}, className)} />;\n}\nfunction AccordionHeader({ className, ...props }: AccordionHeaderProps) {\n return <Base.Header {...props} {...kb(\"accordion-header\", {}, className)} />;\n}\nfunction AccordionTrigger({ className, ...props }: AccordionTriggerProps) {\n return <Base.Trigger {...props} {...kb(\"accordion-trigger\", {}, className)} />;\n}\nfunction AccordionPanel({ className, children, render, ...props }: AccordionPanelProps) {\n return (\n <Base.Panel\n {...props}\n {...kb(\"accordion-panel\", {}, className)}\n render={(nativeProps, state) => (\n <CollapsiblePanel nativeProps={nativeProps} state={state} render={render} />\n )}\n >\n <div className=\"kb-accordion-panel-content\">{children}</div>\n </Base.Panel>\n );\n}\n\nexport const Accordion = Object.assign(AccordionRoot, {\n Item: AccordionItem,\n Header: AccordionHeader,\n Trigger: AccordionTrigger,\n Panel: AccordionPanel,\n});\n","import { type ComponentProps, type CSSProperties, type ReactNode, useState } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ImageRatio = \"square\" | \"landscape\" | \"portrait\" | \"wide\" | \"auto\";\ntype SourceProps = Pick<\n ComponentProps<\"img\">,\n | \"src\"\n | \"srcSet\"\n | \"sizes\"\n | \"width\"\n | \"height\"\n | \"loading\"\n | \"decoding\"\n | \"crossOrigin\"\n | \"referrerPolicy\"\n | \"fetchPriority\"\n | \"onLoad\"\n | \"onError\"\n>;\nexport type ImageProps = Omit<ComponentProps<\"span\">, \"children\" | \"onLoad\" | \"onError\"> &\n SourceProps & {\n /** Image alternative; empty string marks decorative media. */\n alt: string;\n /** Reserved frame ratio; auto uses width/height, then landscape. */\n ratio?: ImageRatio | undefined;\n /** Crop to fill frame or keep entire image visible. */\n fit?: \"cover\" | \"contain\" | undefined;\n /** Focal point within image frame. */\n position?: CSSProperties[\"objectPosition\"] | undefined;\n /** Non-interactive visual shown while missing, loading or failed. */\n fallback?: ReactNode | undefined;\n /** Extra classes for frame, image and fallback. */\n classNames?: ClassNames<\"root\" | \"image\" | \"fallback\"> | undefined;\n };\n\nexport function Image(props: ImageProps) {\n // New request gets fresh state; late events cannot overwrite another source.\n return <ImageFrame key={JSON.stringify([props.src, props.srcSet, props.sizes])} {...props} />;\n}\n\nfunction ImageFrame({\n src,\n srcSet,\n sizes,\n width,\n height,\n loading,\n decoding = \"async\",\n crossOrigin,\n referrerPolicy,\n fetchPriority,\n onLoad,\n onError,\n alt,\n ratio = \"landscape\",\n fit = \"cover\",\n position,\n fallback,\n className,\n classNames,\n style,\n ...props\n}: ImageProps) {\n const hasSource = Boolean(src?.trim() || srcSet?.trim());\n const [state, setState] = useState<\"loading\" | \"loaded\" | \"error\">(\"loading\");\n const intrinsicRatio =\n Number(width) > 0 && Number(height) > 0 ? `${width} / ${height}` : undefined;\n return (\n <span\n {...props}\n {...kb(\n \"image\",\n { ratio, fit, state: hasSource ? state : \"empty\" },\n classNames?.root ?? className,\n )}\n role=\"img\"\n aria-label={props[\"aria-label\"] ?? (alt || undefined)}\n aria-hidden={alt ? props[\"aria-hidden\"] : true}\n style={{\n ...(ratio === \"auto\" && intrinsicRatio ? { aspectRatio: intrinsicRatio } : {}),\n ...style,\n }}\n >\n <span {...kb(\"image-fallback\", {}, classNames?.fallback)} aria-hidden=\"true\">\n {fallback ?? (\n <svg\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n aria-hidden=\"true\"\n >\n <rect x=\"4\" y=\"5\" width=\"24\" height=\"22\" rx=\"3\" />\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" />\n <path d=\"m5 23 7-7 5 5 4-4 6 6\" />\n </svg>\n )}\n </span>\n {hasSource && (\n <img\n {...kb(\"image-image\", {}, classNames?.image)}\n src={src?.trim() || undefined}\n srcSet={srcSet?.trim() || undefined}\n sizes={sizes}\n width={width}\n height={height}\n loading={loading}\n decoding={decoding}\n crossOrigin={crossOrigin}\n referrerPolicy={referrerPolicy}\n fetchPriority={fetchPriority}\n alt=\"\"\n aria-hidden=\"true\"\n style={{ objectPosition: position }}\n ref={(image) => {\n if (image?.complete && image.naturalWidth > 0) setState(\"loaded\");\n }}\n onLoad={(event) => {\n setState(\"loaded\");\n onLoad?.(event);\n }}\n onError={(event) => {\n setState(\"error\");\n onError?.(event);\n }}\n />\n )}\n </span>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Image, type ImageProps } from \"../Image/Image\";\n\nexport type AvatarShape = \"circle\" | \"square\" | \"rounded\" | \"hexagon\" | \"diamond\";\n\nexport type AvatarProps = Omit<ComponentProps<\"span\">, \"children\" | \"onLoad\" | \"onError\"> &\n Pick<ImageProps, \"src\" | \"srcSet\" | \"sizes\" | \"loading\" | \"onLoad\" | \"onError\"> & {\n /** Full identity; remains accessible when photo fails. */\n name: string;\n /** Caller-owned initials; defaults to first and last name initials. */\n initials?: string | undefined;\n /** Hide duplicate identity beside visible text. */\n decorative?: boolean | undefined;\n /** Fixed identity dimensions. */\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | undefined;\n /** Identity silhouette; photo and initials remain upright. */\n shape?: AvatarShape | undefined;\n /** Extra classes for root, media and initials. */\n classNames?: ClassNames<\"root\" | \"media\" | \"initials\"> | undefined;\n };\n\nexport function Avatar({\n name,\n initials,\n decorative = false,\n size = \"md\",\n shape = \"circle\",\n src,\n srcSet,\n sizes,\n loading,\n onLoad,\n onError,\n className,\n classNames,\n ...props\n}: AvatarProps) {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const letters = [words[0], ...(words.length > 1 ? [words.at(-1)] : [])]\n .map((word) => Array.from(word ?? \"\")[0] ?? \"\")\n .join(\"\")\n .toLocaleUpperCase();\n return (\n <span\n {...props}\n {...kb(\"avatar\", { size, shape }, classNames?.root ?? className)}\n role=\"img\"\n aria-label={\n decorative ? undefined : (props[\"aria-label\"] ?? (name.trim() || \"Unknown person\"))\n }\n aria-hidden={decorative ? true : props[\"aria-hidden\"]}\n >\n <Image\n {...kb(\"avatar-media\", {}, classNames?.media)}\n src={src}\n srcSet={srcSet}\n sizes={sizes}\n loading={loading}\n onLoad={onLoad}\n onError={onError}\n alt=\"\"\n ratio=\"square\"\n fallback={\n <span {...kb(\"avatar-initials\", {}, classNames?.initials)}>\n {initials?.trim() || letters || \"?\"}\n </span>\n }\n />\n </span>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type BadgeTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type BadgeAppearance = \"chip\" | \"plain\";\n\n/** Static metadata label; use Status for a state that changes. */\nexport type BadgeProps = ComponentProps<\"span\"> & {\n /** Ink and tint. */\n tone?: BadgeTone;\n /** Chip draws a tinted ring; plain is inline text. */\n appearance?: BadgeAppearance;\n /** Small uppercase monospace, for identifiers and roles. */\n mono?: boolean;\n /** Keep the text's case and spacing, for case-sensitive values such as branches and paths. */\n preserveCase?: boolean;\n};\n\nexport function Badge({\n tone = \"neutral\",\n appearance = \"chip\",\n mono = false,\n preserveCase = false,\n className,\n ...props\n}: BadgeProps) {\n return (\n <span\n {...props}\n {...kb(\"badge\", { tone, appearance, mono, \"preserve-case\": preserveCase }, className)}\n />\n );\n}\n","import { Button as Base } from \"@base-ui/react/button\";\nimport { kb } from \"../../utils/kb\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\n\ntype ButtonBaseProps = Omit<Base.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Action emphasis: primary main, secondary supporting, ghost quiet, danger destructive. */\n variant?: ButtonVariant;\n};\n\n/** Navigation use: pass render={<a href/>} nativeButton={false} role=\"link\". Icon size needs aria-label. */\nexport type ButtonProps = ButtonBaseProps &\n (\n | {\n /** Height and padding scale; icon is a square for a lone icon. */\n size?: Exclude<ButtonSize, \"icon\">;\n }\n | { size: \"icon\"; \"aria-label\": string }\n );\n\nexport function Button({ variant = \"primary\", size = \"md\", className, ...props }: ButtonProps) {\n return <Base {...props} {...kb(\"button\", { variant, size }, className)} />;\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type CalloutTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\n/** Inline message with optional actions; text carries the meaning, tone only reinforces it. */\nexport type CalloutProps = Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Ink of the edge, tint and icon. */\n tone?: CalloutTone;\n /** Short heading line. */\n title?: ReactNode;\n /** Caller-provided decorative icon. */\n icon?: ReactNode;\n /** Buttons that resolve the message. */\n actions?: ReactNode;\n /** Announce changes: adds role=\"status\" and nothing else. */\n live?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"icon\" | \"content\" | \"title\" | \"body\" | \"actions\">;\n};\n\nexport function Callout({\n classNames,\n tone = \"neutral\",\n title,\n icon,\n actions,\n live = false,\n className,\n children,\n ...props\n}: CalloutProps) {\n return (\n <div {...props} {...(live ? { role: \"status\" } : {})} {...kb(\"callout\", { tone }, className)}>\n {icon != null ? (\n <span className={clsx(\"kb-callout-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <div className={clsx(\"kb-callout-content\", classNames?.content)}>\n {title != null ? (\n <div className={clsx(\"kb-callout-title\", classNames?.title)}>{title}</div>\n ) : null}\n <div className={clsx(\"kb-callout-body\", classNames?.body)}>{children}</div>\n {actions != null ? (\n <div className={clsx(\"kb-callout-actions\", classNames?.actions)}>{actions}</div>\n ) : null}\n </div>\n </div>\n );\n}\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\ntype Container = \"article\" | \"div\" | \"li\";\nexport type CardProps<T extends Container = \"article\"> = ComponentProps<T> & {\n /** Semantic container; links and controls stay caller-owned. */\n as?: T;\n /** Outlined surface or unstyled list content. */\n appearance?: \"outlined\" | \"plain\";\n};\n\nexport function Card<T extends Container = \"article\">({\n as,\n appearance = \"outlined\",\n className,\n ...props\n}: CardProps<T>) {\n return createElement(as ?? \"article\", { ...props, ...kb(\"card\", { appearance }, className) });\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useId, useImperativeHandle, useLayoutEffect, useRef } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type CheckboxProps = Omit<\n ComponentProps<\"input\">,\n \"type\" | \"checked\" | \"defaultChecked\" | \"onChange\" | \"size\"\n> & {\n /** Visible accessible label. */\n label: string;\n /** Controlled checked state. */\n checked: boolean;\n /** Receives next checked state; mixed resolves to checked. */\n onCheckedChange: (checked: boolean) => void;\n /** Announce a mixed aggregate selection. */\n indeterminate?: boolean;\n /** Hide label text visually. */\n visuallyHidden?: boolean;\n /** Helper text associated with the input. */\n description?: string;\n /** Visible error; marks the input invalid. */\n error?: string;\n /** Class on the native input slot. */\n controlClassName?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"control\" | \"label\" | \"mark\" | \"tick\" | \"mixed\" | \"description\" | \"error\"\n >;\n};\nexport function Checkbox({\n classNames,\n label,\n checked,\n onCheckedChange,\n indeterminate = false,\n visuallyHidden,\n description,\n error,\n disabled,\n readOnly,\n className,\n controlClassName,\n id: providedId,\n ref,\n style,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: CheckboxProps) {\n const generated = useId();\n const id = providedId ?? generated;\n const input = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => input.current as HTMLInputElement);\n useLayoutEffect(() => {\n if (input.current) input.current.indeterminate = indeterminate;\n });\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n props[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n const theme = Object.fromEntries(\n Object.entries(style ?? {}).filter(([property]) => property.startsWith(\"--\")),\n );\n return (\n <div {...kb(\"checkbox\", { disabled, invalid }, className)} style={theme}>\n <input\n {...props}\n style={style}\n id={id}\n ref={input}\n type=\"checkbox\"\n checked={checked}\n aria-checked={indeterminate ? \"mixed\" : checked}\n disabled={disabled}\n readOnly={readOnly}\n aria-readonly={readOnly || undefined}\n aria-invalid={ariaInvalid}\n aria-describedby={described}\n className={clsx(\"kb-checkbox-control\", classNames?.control, controlClassName)}\n onChange={(event) => {\n event.target.indeterminate = indeterminate;\n if (!disabled && !readOnly) onCheckedChange(indeterminate ? true : event.target.checked);\n }}\n />\n <span className={clsx(\"kb-checkbox-mark\", classNames?.mark)} aria-hidden=\"true\">\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <path className={clsx(\"kb-checkbox-tick\", classNames?.tick)} d=\"m3 8 3 3 7-7\" />\n <path className={clsx(\"kb-checkbox-mixed\", classNames?.mixed)} d=\"M3 8h10\" />\n </svg>\n </span>\n <label\n htmlFor={id}\n className={clsx(\"kb-checkbox-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-checkbox-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-checkbox-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { useEffect, useRef, useState } from \"react\";\n\nexport type CopyState = \"idle\" | \"pending\" | \"copied\" | \"failed\";\n\nexport type CopyFeedbackProps = {\n /** Disable copying while keeping content selectable. */\n disabled?: boolean | undefined;\n /** Idle copy button text and accessible name. */\n copyLabel?: string | undefined;\n /** Pending copy button text. */\n copyingLabel?: string | undefined;\n /** Successful copy button text. */\n copiedLabel?: string | undefined;\n /** Failed copy button text; activation retries. */\n copyErrorLabel?: string | undefined;\n /** Polite success announcement. */\n successMessage?: string | undefined;\n /** Visible, polite failure message with recovery instructions. */\n errorMessage?: string | undefined;\n /** Success feedback lifetime in milliseconds; zero keeps feedback until next action. */\n feedbackDuration?: number | undefined;\n /** Called after clipboard write succeeds for current content. */\n onCopy?: ((value: string) => void) | undefined;\n /** Called when current clipboard write fails, including unavailable Clipboard API. */\n onCopyError?: ((error: unknown) => void) | undefined;\n};\n\nexport function useClipboard(\n value: string,\n { disabled = false, feedbackDuration = 2000, onCopy, onCopyError }: CopyFeedbackProps,\n) {\n const [feedback, setFeedback] = useState({ value, disabled, status: \"idle\" as CopyState });\n const epoch = useRef(0);\n const busy = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const state =\n feedback.value === value && feedback.disabled === disabled ? feedback.status : \"idle\";\n\n useEffect(() => {\n setFeedback({ value, disabled, status: \"idle\" });\n return () => {\n // Ignore writes completed after content changes, disable, or unmount.\n epoch.current += 1;\n busy.current = false;\n clearTimeout(timer.current);\n };\n }, [value, disabled]);\n\n async function copy() {\n if (disabled || value.length === 0 || busy.current) return;\n const request = ++epoch.current;\n busy.current = true;\n clearTimeout(timer.current);\n setFeedback({ value, disabled, status: \"pending\" });\n try {\n if (typeof navigator === \"undefined\" || !navigator.clipboard?.writeText) {\n throw new Error(\"Clipboard unavailable\");\n }\n await navigator.clipboard.writeText(value);\n } catch (error) {\n if (request !== epoch.current) return;\n busy.current = false;\n setFeedback({ value, disabled, status: \"failed\" });\n onCopyError?.(error);\n return;\n }\n if (request !== epoch.current) return;\n busy.current = false;\n setFeedback({ value, disabled, status: \"copied\" });\n const duration =\n Number.isFinite(feedbackDuration) && feedbackDuration >= 0 ? feedbackDuration : 2000;\n if (duration > 0) {\n timer.current = setTimeout(() => {\n if (request === epoch.current) setFeedback({ value, disabled, status: \"idle\" });\n }, duration);\n }\n // Consumer callback errors must not turn successful writes into copy failures.\n onCopy?.(value);\n }\n\n return { state, copy, disabled: disabled || value.length === 0 };\n}\n","export type CodeLanguage =\n | \"tsx\"\n | \"ts\"\n | \"typescript\"\n | \"jsx\"\n | \"js\"\n | \"javascript\"\n | \"css\"\n | \"html\"\n | \"json\"\n | \"bash\"\n | \"sh\"\n | \"shell\"\n | \"shellscript\"\n | \"plain\"\n | \"text\";\n\nexport type CodeSyntaxKind =\n | \"keyword\"\n | \"string\"\n | \"comment\"\n | \"number\"\n | \"tag\"\n | \"attribute\"\n | \"type\"\n | \"function\"\n | \"operator\"\n | \"property\";\n\nexport type CodeToken = readonly [start: number, end: number, kind: CodeSyntaxKind];\n\nconst LANGUAGE_LABELS: Record<CodeLanguage, string | undefined> = {\n tsx: \"TSX\",\n ts: \"TS\",\n typescript: \"TS\",\n jsx: \"JSX\",\n js: \"JS\",\n javascript: \"JS\",\n css: \"CSS\",\n html: \"HTML\",\n json: \"JSON\",\n bash: \"Shell\",\n sh: \"Shell\",\n shell: \"Shell\",\n shellscript: \"Shell\",\n plain: undefined,\n text: undefined,\n};\n\nexport function formatCodeLanguage(language?: CodeLanguage): string | undefined {\n if (!language) return undefined;\n return language in LANGUAGE_LABELS ? LANGUAGE_LABELS[language] : String(language).toUpperCase();\n}\n\nconst TS_KEYWORDS = new Set([\n \"as\",\n \"async\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"from\",\n \"function\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"infer\",\n \"instanceof\",\n \"interface\",\n \"keyof\",\n \"let\",\n \"new\",\n \"null\",\n \"of\",\n \"private\",\n \"protected\",\n \"public\",\n \"readonly\",\n \"return\",\n \"satisfies\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"type\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n \"yield\",\n]);\n\nconst TS_BUILTIN_TYPES = new Set([\n \"Array\",\n \"Boolean\",\n \"CSSProperties\",\n \"ComponentProps\",\n \"Date\",\n \"Error\",\n \"Exclude\",\n \"Extract\",\n \"HTMLButtonElement\",\n \"HTMLDivElement\",\n \"HTMLElement\",\n \"HTMLInputElement\",\n \"Map\",\n \"NonNullable\",\n \"Number\",\n \"Omit\",\n \"Parameters\",\n \"Partial\",\n \"Pick\",\n \"Promise\",\n \"ReactElement\",\n \"ReactNode\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Ref\",\n \"RegExp\",\n \"Required\",\n \"ReturnType\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"any\",\n \"bigint\",\n \"boolean\",\n \"never\",\n \"number\",\n \"object\",\n \"string\",\n \"symbol\",\n \"unknown\",\n]);\n\nconst TS_EXPR_KEYWORDS = new Set([\n \"await\",\n \"case\",\n \"delete\",\n \"else\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"of\",\n \"return\",\n \"throw\",\n \"typeof\",\n \"void\",\n \"yield\",\n]);\n\nconst TS_TYPE_LEAD_KEYWORDS = new Set([\n \"as\",\n \"class\",\n \"enum\",\n \"extends\",\n \"implements\",\n \"interface\",\n \"satisfies\",\n \"type\",\n]);\n\nconst CSS_KEYWORDS = new Set([\n \"!important\",\n \"absolute\",\n \" anywhere\",\n \"auto\",\n \"baseline\",\n \"block\",\n \"bold\",\n \"border-box\",\n \"both\",\n \"break-spaces\",\n \"center\",\n \"clone\",\n \"column\",\n \"contain\",\n \"content-box\",\n \"currentColor\",\n \"dashed\",\n \"dotted\",\n \"ease\",\n \"ease-in\",\n \"ease-in-out\",\n \"ease-out\",\n \"end\",\n \"fixed\",\n \"flex\",\n \"grid\",\n \"hidden\",\n \"inberg\",\n \"inherit\",\n \"initial\",\n \"inline\",\n \"inline-block\",\n \"inline-flex\",\n \"inset\",\n \"italic\",\n \"linear\",\n \"max-content\",\n \"min-content\",\n \"none\",\n \"normal\",\n \"nowrap\",\n \"pointer\",\n \"relative\",\n \"revert\",\n \"row\",\n \" scroll\",\n \"slice\",\n \"solid\",\n \"space-between\",\n \"start\",\n \"static\",\n \"sticky\",\n \" stretch\",\n \"tabular-nums\",\n \"transparent\",\n \"unset\",\n \"uppercase\",\n \"visible\",\n \"wrap\",\n]);\n\nconst SHELL_KEYWORDS = new Set([\n \"case\",\n \"do\",\n \"done\",\n \"elif\",\n \"else\",\n \"esac\",\n \"exit\",\n \"export\",\n \"false\",\n \"fi\",\n \"for\",\n \"function\",\n \"if\",\n \"in\",\n \"local\",\n \"readonly\",\n \"return\",\n \"set\",\n \"then\",\n \"true\",\n \"unset\",\n \"until\",\n \"while\",\n]);\n\nfunction isIdentStart(ch: string | undefined): boolean {\n return ch !== undefined && /[A-Za-z_$]/.test(ch);\n}\n\nfunction isIdentChar(ch: string | undefined): boolean {\n return ch !== undefined && /[\\w$]/.test(ch);\n}\n\nfunction scanQuotedString(code: string, start: number, allowMultiline: boolean): number {\n const quote = code[start];\n let i = start + 1;\n while (i < code.length) {\n const ch = code[i];\n if (ch === \"\\\\\") {\n i += 2;\n continue;\n }\n if (ch === quote) return i + 1;\n if (!allowMultiline && ch === \"\\n\") return i;\n i += 1;\n }\n return code.length;\n}\n\n// Finds matching '}' while skipping nested braces, strings, and comments.\nfunction findMatchingBrace(code: string, openPos: number): number {\n let depth = 1;\n let i = openPos + 1;\n while (i < code.length && depth > 0) {\n const ch = code[i];\n if (code.startsWith(\"//\", i)) {\n const nl = code.indexOf(\"\\n\", i + 2);\n i = nl === -1 ? code.length : nl + 1;\n continue;\n }\n if (code.startsWith(\"/*\", i)) {\n const end = code.indexOf(\"*/\", i + 2);\n i = end === -1 ? code.length : end + 2;\n continue;\n }\n if (ch === \"'\" || ch === '\"') {\n i = scanQuotedString(code, i, false);\n continue;\n }\n if (ch === \"`\") {\n i = scanQuotedString(code, i, true);\n continue;\n }\n if (ch === \"{\") depth += 1;\n else if (ch === \"}\") depth -= 1;\n i += 1;\n }\n return i - 1;\n}\n\nfunction tokenizeTsx(code: string, baseOffset = 0): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let lastWord = \"\";\n let prevNonSpaceChar = \"\";\n let jsxDepth = 0;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([baseOffset + start, baseOffset + end, kind]);\n };\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (jsxDepth > 0) {\n if (ch === \"{\") {\n const closeBrace = findMatchingBrace(code, i);\n const exprEnd = closeBrace > i ? closeBrace : code.length;\n tokens.push(...tokenizeTsx(code.slice(i + 1, exprEnd), baseOffset + i + 1));\n i = closeBrace < code.length ? closeBrace + 1 : code.length;\n continue;\n }\n if (\n ch !== \"<\" ||\n (code[i + 1] !== \"/\" && code[i + 1] !== \">\" && !isIdentStart(code[i + 1]))\n ) {\n i += 1;\n continue;\n }\n }\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (code.startsWith(\"//\", i)) {\n const nl = code.indexOf(\"\\n\", i + 2);\n const end = nl === -1 ? code.length : nl;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (code.startsWith(\"/*\", i)) {\n const close = code.indexOf(\"*/\", i + 2);\n const end = close === -1 ? code.length : close + 2;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n prevNonSpaceChar = ch;\n lastWord = \"\";\n i = end;\n continue;\n }\n\n if (ch === \"`\") {\n let segStart = i;\n let cursor = i + 1;\n while (cursor < code.length) {\n const c = code[cursor];\n if (c === \"\\\\\") {\n cursor += 2;\n continue;\n }\n if (c === \"`\") {\n cursor += 1;\n break;\n }\n if (c === \"$\" && code[cursor + 1] === \"{\") {\n push(segStart, cursor + 2, \"string\");\n const closeBrace = findMatchingBrace(code, cursor + 1);\n const exprEnd = closeBrace >= cursor + 2 ? closeBrace : code.length;\n const expr = code.slice(cursor + 2, exprEnd);\n tokens.push(...tokenizeTsx(expr, baseOffset + cursor + 2));\n if (closeBrace < code.length && code[closeBrace] === \"}\") {\n segStart = closeBrace;\n cursor = closeBrace + 1;\n } else {\n segStart = code.length;\n cursor = code.length;\n }\n continue;\n }\n cursor += 1;\n }\n if (cursor > segStart) push(segStart, cursor, \"string\");\n prevNonSpaceChar = \"`\";\n lastWord = \"\";\n i = cursor;\n continue;\n }\n\n // JSX fragment opening: <>\n if (ch === \"<\" && code[i + 1] === \">\") {\n push(i, i + 2, \"operator\");\n i += 2;\n jsxDepth += 1;\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n\n // JSX closing tag: </Tag> or </>\n if (ch === \"<\" && code[i + 1] === \"/\") {\n push(i, i + 2, \"operator\");\n i += 2;\n while (i < code.length && /\\s/.test(code.charAt(i))) i += 1;\n const tagMatch = /^[A-Za-z_$][\\w$.-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n while (i < code.length && /\\s/.test(code.charAt(i))) i += 1;\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n }\n jsxDepth = Math.max(0, jsxDepth - 1);\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n\n // JSX opening tag when '<Ident' appears in expression position (not generic call/type).\n if (ch === \"<\" && isIdentStart(code[i + 1])) {\n const isGenericAfterIdent =\n jsxDepth === 0 && isIdentChar(prevNonSpaceChar) && !TS_EXPR_KEYWORDS.has(lastWord);\n if (!isGenericAfterIdent) {\n push(i, i + 1, \"operator\");\n i += 1;\n const tagMatch = /^[A-Za-z_$][\\w$.-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n let selfClosing = false;\n // Scan JSX attributes until closing '>' or '/>'.\n while (i < code.length) {\n if (/\\s/.test(code.charAt(i))) {\n i += 1;\n continue;\n }\n if (code.startsWith(\"/>\", i)) {\n push(i, i + 2, \"operator\");\n i += 2;\n selfClosing = true;\n break;\n }\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n break;\n }\n if (code[i] === \"'\" || code[i] === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n if (code[i] === \"{\") {\n const closeBrace = findMatchingBrace(code, i);\n const exprEnd = closeBrace > i ? closeBrace : code.length;\n tokens.push(...tokenizeTsx(code.slice(i + 1, exprEnd), baseOffset + i + 1));\n i = closeBrace < code.length ? closeBrace + 1 : code.length;\n continue;\n }\n if (code[i] === \"=\") {\n push(i, i + 1, \"operator\");\n i += 1;\n continue;\n }\n const attrMatch = /^[A-Za-z_$][\\w$-]*/.exec(code.slice(i));\n if (attrMatch) {\n push(i, i + attrMatch[0].length, \"attribute\");\n i += attrMatch[0].length;\n continue;\n }\n i += 1;\n }\n if (!selfClosing) jsxDepth += 1;\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n }\n\n const numMatch =\n /^(?:0[xX][\\da-fA-F_]+n?|0[bB][01_]+n?|0[oO][0-7_]+n?|\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d[\\d_]*)?n?)/.exec(\n code.slice(i),\n );\n if (numMatch) {\n const len = numMatch[0].length;\n push(i, i + len, \"number\");\n prevNonSpaceChar = code.charAt(i + len - 1);\n lastWord = \"\";\n i += len;\n continue;\n }\n\n if (isIdentStart(ch)) {\n const identMatch = /^[A-Za-z_$][\\w$]*/.exec(code.slice(i));\n const word = identMatch ? identMatch[0] : ch;\n const end = i + word.length;\n const afterSlice = code.slice(end);\n const isCall = /^\\s*(?:<[^>\\n]+>\\s*)?\\(/.test(afterSlice);\n const isObjKey =\n (prevNonSpaceChar === \"{\" || prevNonSpaceChar === \",\") && /^\\s*:(?!:)/.test(afterSlice);\n\n if (prevNonSpaceChar === \".\") {\n push(i, end, isCall ? \"function\" : \"property\");\n } else if (isObjKey) {\n push(i, end, \"property\");\n } else if (TS_KEYWORDS.has(word)) {\n push(i, end, \"keyword\");\n } else if (TS_BUILTIN_TYPES.has(word)) {\n push(i, end, \"type\");\n } else if (\n TS_TYPE_LEAD_KEYWORDS.has(lastWord) ||\n (prevNonSpaceChar === \":\" && /^[A-Z]/.test(word)) ||\n (prevNonSpaceChar === \"<\" && /^[A-Z]/.test(word))\n ) {\n push(i, end, \"type\");\n } else if (isCall) {\n push(i, end, \"function\");\n } else if (/^[A-Z]/.test(word)) {\n push(i, end, \"type\");\n }\n\n prevNonSpaceChar = word.charAt(word.length - 1);\n lastWord = word;\n i = end;\n continue;\n }\n\n const opMatch = /^(?:=>|===|!==|==|!=|<=|>=|&&|\\|\\||\\?\\?|\\?\\.|\\.\\.\\.|[+\\-*/%=<>!&|^~?:])/.exec(\n code.slice(i),\n );\n if (opMatch) {\n const op = opMatch[0];\n push(i, i + op.length, \"operator\");\n prevNonSpaceChar = op.charAt(op.length - 1);\n i += op.length;\n continue;\n }\n\n prevNonSpaceChar = ch;\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeCss(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let braceDepth = 0;\n let inAtRuleHeader = false;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([start, end, kind]);\n };\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (code.startsWith(\"/*\", i)) {\n const close = code.indexOf(\"*/\", i + 2);\n const end = close === -1 ? code.length : close + 2;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n\n if (ch === \"@\") {\n const m = /^@[A-Za-z_-][\\w-]*/.exec(code.slice(i));\n if (m) {\n push(i, i + m[0].length, \"keyword\");\n inAtRuleHeader = true;\n i += m[0].length;\n continue;\n }\n }\n\n if (ch === \"{\") {\n braceDepth += 1;\n inAtRuleHeader = false;\n i += 1;\n continue;\n }\n\n if (ch === \"}\") {\n braceDepth = Math.max(0, braceDepth - 1);\n i += 1;\n continue;\n }\n\n if (ch === \";\") {\n inAtRuleHeader = false;\n i += 1;\n continue;\n }\n\n if (ch === \"[\") {\n const close = code.indexOf(\"]\", i + 1);\n const end = close === -1 ? code.length : close + 1;\n push(i, end, \"attribute\");\n i = end;\n continue;\n }\n\n const numMatch =\n /^(?:#[0-9a-fA-F]{3,8}\\b|-?\\d+(?:\\.\\d+)?(?:px|rem|em|ch|vh|vw|vmin|vmax|%|deg|s|ms|fr)?)/.exec(\n code.slice(i),\n );\n if (numMatch) {\n push(i, i + numMatch[0].length, \"number\");\n i += numMatch[0].length;\n continue;\n }\n\n // Declaration property or media feature before ':'\n const propMatch = /^(--[\\w-]+|[A-Za-z_-][\\w-]*)(?=\\s*:(?!:))/.exec(code.slice(i));\n if (propMatch && (braceDepth > 0 || inAtRuleHeader)) {\n // Distinguish selector pseudo-classes (where '{' comes before ';') from declarations.\n const restAfterColon = code.slice(i + propMatch[0].length).replace(/^\\s*:/, \"\");\n const nextSemi = restAfterColon.indexOf(\";\");\n const nextBrace = restAfterColon.indexOf(\"{\");\n const isDeclaration =\n inAtRuleHeader || (nextSemi !== -1 && (nextBrace === -1 || nextSemi < nextBrace));\n if (isDeclaration) {\n push(i, i + propMatch[0].length, \"attribute\");\n i += propMatch[0].length;\n continue;\n }\n }\n\n const fnMatch = /^[A-Za-z_-][\\w-]*(?=\\()/.exec(code.slice(i));\n if (fnMatch) {\n push(i, i + fnMatch[0].length, \"function\");\n i += fnMatch[0].length;\n continue;\n }\n\n const varMatch = /^--[\\w-]+/.exec(code.slice(i));\n if (varMatch) {\n push(i, i + varMatch[0].length, \"property\");\n i += varMatch[0].length;\n continue;\n }\n\n // Selector tag or class/id outside declarations\n const restToBrace = code.slice(i);\n const nextOpenBrace = restToBrace.indexOf(\"{\");\n const nextSemi = restToBrace.indexOf(\";\");\n const inSelector =\n !inAtRuleHeader && nextOpenBrace !== -1 && (nextSemi === -1 || nextOpenBrace < nextSemi);\n\n if (inSelector) {\n const pseudoMatch = /^::?[A-Za-z_-][\\w-]*/.exec(restToBrace);\n if (pseudoMatch) {\n push(i, i + pseudoMatch[0].length, \"keyword\");\n i += pseudoMatch[0].length;\n continue;\n }\n const selMatch = /^(?:\\.|#)?[A-Za-z_-][\\w-]*/.exec(restToBrace);\n if (selMatch) {\n push(i, i + selMatch[0].length, \"tag\");\n i += selMatch[0].length;\n continue;\n }\n }\n\n const wordMatch = /^!?[A-Za-z_-][\\w-]*/.exec(code.slice(i));\n if (wordMatch) {\n if (CSS_KEYWORDS.has(wordMatch[0])) {\n push(i, i + wordMatch[0].length, \"keyword\");\n }\n i += wordMatch[0].length;\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeHtml(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([start, end, kind]);\n };\n\n while (i < code.length) {\n if (code.startsWith(\"<!--\", i)) {\n const close = code.indexOf(\"-->\", i + 4);\n const end = close === -1 ? code.length : close + 3;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (/^<!DOCTYPE/i.test(code.slice(i))) {\n const close = code.indexOf(\">\", i + 2);\n const end = close === -1 ? code.length : close + 1;\n push(i, end, \"keyword\");\n i = end;\n continue;\n }\n\n if (code[i] === \"<\" && /^<\\/?[A-Za-z]/.test(code.slice(i))) {\n const isClose = code[i + 1] === \"/\";\n const tagStart = i + (isClose ? 2 : 1);\n push(i, tagStart, \"operator\");\n i = tagStart;\n const tagMatch = /^[A-Za-z][\\w:-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n while (i < code.length) {\n if (/\\s/.test(code.charAt(i))) {\n i += 1;\n continue;\n }\n if (code.startsWith(\"/>\", i)) {\n push(i, i + 2, \"operator\");\n i += 2;\n break;\n }\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n break;\n }\n if (code[i] === \"'\" || code[i] === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n if (code[i] === \"=\") {\n push(i, i + 1, \"operator\");\n i += 1;\n continue;\n }\n const attrMatch = /^[A-Za-z_:][\\w:.-]*/.exec(code.slice(i));\n if (attrMatch) {\n push(i, i + attrMatch[0].length, \"attribute\");\n i += attrMatch[0].length;\n continue;\n }\n i += 1;\n }\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeJson(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n\n while (i < code.length) {\n const ch = code.charAt(i);\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n if (ch === '\"') {\n const end = scanQuotedString(code, i, false);\n const isKey = /^\\s*:/.test(code.slice(end));\n tokens.push([i, end, isKey ? \"property\" : \"string\"]);\n i = end;\n continue;\n }\n const numMatch = /^-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(code.slice(i));\n if (numMatch) {\n tokens.push([i, i + numMatch[0].length, \"number\"]);\n i += numMatch[0].length;\n continue;\n }\n const kwMatch = /^(?:true|false|null)\\b/.exec(code.slice(i));\n if (kwMatch) {\n tokens.push([i, i + kwMatch[0].length, \"keyword\"]);\n i += kwMatch[0].length;\n continue;\n }\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeShell(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let expectCommand = true;\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (ch === \"\\n\") {\n expectCommand = true;\n i += 1;\n continue;\n }\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (ch === \"#\" && (i === 0 || /[\\s;|&()]/.test(code.charAt(i - 1)))) {\n const nl = code.indexOf(\"\\n\", i + 1);\n const end = nl === -1 ? code.length : nl;\n tokens.push([i, end, \"comment\"]);\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, true);\n tokens.push([i, end, \"string\"]);\n expectCommand = false;\n i = end;\n continue;\n }\n\n const opMatch = /^(?:\\|\\||&&|;;|[|&;><]+|\\$\\()/.exec(code.slice(i));\n if (opMatch) {\n tokens.push([i, i + opMatch[0].length, \"operator\"]);\n expectCommand = true;\n i += opMatch[0].length;\n continue;\n }\n\n const varMatch = /^\\$(?:\\{[A-Za-z_]\\w*\\}|[A-Za-z_]\\w*)/.exec(code.slice(i));\n if (varMatch) {\n tokens.push([i, i + varMatch[0].length, \"property\"]);\n expectCommand = false;\n i += varMatch[0].length;\n continue;\n }\n\n const flagMatch = /^--?[A-Za-z0-9][\\w-]*/.exec(code.slice(i));\n if (flagMatch && (i === 0 || /\\s/.test(code.charAt(i - 1)))) {\n tokens.push([i, i + flagMatch[0].length, \"attribute\"]);\n expectCommand = false;\n i += flagMatch[0].length;\n continue;\n }\n\n const numMatch = /^\\b\\d+(?:\\.\\d+)?\\b/.exec(code.slice(i));\n if (numMatch) {\n tokens.push([i, i + numMatch[0].length, \"number\"]);\n expectCommand = false;\n i += numMatch[0].length;\n continue;\n }\n\n const wordMatch = /^[A-Za-z_][\\w./-]*/.exec(code.slice(i));\n if (wordMatch) {\n const word = wordMatch[0];\n if (SHELL_KEYWORDS.has(word)) {\n tokens.push([i, i + word.length, \"keyword\"]);\n expectCommand = word === \"then\" || word === \"do\" || word === \"else\";\n } else if (expectCommand) {\n tokens.push([i, i + word.length, \"function\"]);\n expectCommand = word === \"sudo\" || word === \"env\" || word === \"npx\" || word === \"bunx\";\n }\n i += word.length;\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nexport function tokenizeCode(code: string, language: CodeLanguage = \"tsx\"): CodeToken[] {\n if (!code || language === \"plain\" || language === \"text\") return [];\n switch (language) {\n case \"css\":\n return tokenizeCss(code);\n case \"html\":\n return tokenizeHtml(code);\n case \"json\":\n return tokenizeJson(code);\n case \"bash\":\n case \"sh\":\n case \"shell\":\n case \"shellscript\":\n return tokenizeShell(code);\n default:\n return tokenizeTsx(code);\n }\n}\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type CSSProperties,\n Fragment,\n type ReactNode,\n type Ref,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { type CopyFeedbackProps, useClipboard } from \"../../utils/useClipboard\";\nimport { type CodeLanguage, type CodeToken, formatCodeLanguage, tokenizeCode } from \"./tokenize\";\n\nexport {\n type CodeLanguage,\n type CodeSyntaxKind,\n type CodeToken,\n tokenizeCode,\n} from \"./tokenize\";\n\nexport type CodePart =\n | \"header\"\n | \"meta\"\n | \"title\"\n | \"language\"\n | \"actions\"\n | \"toggle\"\n | \"copy\"\n | \"feedback\"\n | \"viewport\"\n | \"pre\"\n | \"content\"\n | \"line\"\n | \"lineNumber\"\n | \"lineText\";\n\nexport type CodeProps = Omit<ComponentProps<\"code\">, \"ref\" | \"title\" | \"onCopy\"> &\n CopyFeedbackProps & {\n ref?: Ref<HTMLElement> | undefined;\n block?: boolean | undefined;\n language?: CodeLanguage | undefined;\n title?: string | undefined;\n copyable?: boolean | undefined;\n lineNumbers?: boolean | undefined;\n startLine?: number | undefined;\n highlightLines?: readonly number[] | undefined;\n minLines?: number | undefined;\n collapsible?: boolean | undefined;\n collapsedLines?: number | undefined;\n defaultCollapsed?: boolean | undefined;\n collapsed?: boolean | undefined;\n onCollapsedChange?: ((collapsed: boolean) => void) | undefined;\n maxHeight?: string | number | undefined;\n tokens?: readonly CodeToken[] | undefined;\n classNames?: ClassNames<CodePart> | undefined;\n };\n\nfunction renderLineTokens(\n lineText: string,\n lineStart: number,\n tokens: readonly CodeToken[],\n): ReactNode {\n if (!lineText || tokens.length === 0) return lineText;\n const lineEnd = lineStart + lineText.length;\n const nodes: ReactNode[] = [];\n let cursor = 0;\n\n for (const [tokStart, tokEnd, kind] of tokens) {\n if (tokEnd <= lineStart) continue;\n if (tokStart >= lineEnd) break;\n const start = Math.max(tokStart, lineStart) - lineStart;\n const end = Math.min(tokEnd, lineEnd) - lineStart;\n if (start > cursor) {\n nodes.push(lineText.slice(cursor, start));\n }\n if (end > start) {\n nodes.push(\n <span key={start} data-syntax={kind}>\n {lineText.slice(start, end)}\n </span>,\n );\n cursor = end;\n }\n }\n\n if (cursor === 0) return lineText;\n if (cursor < lineText.length) {\n nodes.push(lineText.slice(cursor));\n }\n return nodes;\n}\n\nexport function Code({\n ref,\n block,\n language,\n title,\n copyable,\n onCopy,\n onCopyError,\n disabled = false,\n feedbackDuration,\n copyLabel = \"Copy code\",\n copyingLabel = \"Copying…\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n successMessage = \"Code copied to clipboard\",\n errorMessage = \"Failed to copy code. Select and copy the text manually.\",\n lineNumbers = false,\n startLine = 1,\n highlightLines,\n minLines,\n collapsible = false,\n collapsedLines,\n defaultCollapsed = false,\n collapsed: collapsedProp,\n onCollapsedChange,\n maxHeight,\n tokens,\n classNames,\n className,\n style,\n children,\n ...props\n}: CodeProps) {\n const viewportId = useId();\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(defaultCollapsed);\n const rawCode = typeof children === \"string\" ? children : \"\";\n const clipboard = useClipboard(rawCode, { disabled, feedbackDuration, onCopy, onCopyError });\n const copyState = clipboard.state;\n const [expandedHeight, setExpandedHeight] = useState<number | undefined>(undefined);\n const preRef = useRef<HTMLPreElement | null>(null);\n\n const resolvedMinLines =\n minLines !== undefined && minLines > 0 ? Math.floor(minLines) : undefined;\n const resolvedCollapsedLines =\n collapsedLines !== undefined && collapsedLines > 0\n ? Math.floor(collapsedLines)\n : collapsible && resolvedMinLines !== undefined\n ? resolvedMinLines\n : undefined;\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: Re-measure when resolvedMinLines changes in non-ResizeObserver environments.\n useEffect(() => {\n if (!collapsible) return;\n const element = preRef.current;\n if (!element) return;\n const measure = () => {\n const next = Math.ceil(element.getBoundingClientRect().height) || element.scrollHeight;\n if (next > 0) setExpandedHeight(next);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [collapsible, resolvedMinLines]);\n\n const hasBlockProps =\n language !== undefined ||\n title !== undefined ||\n copyable !== undefined ||\n lineNumbers ||\n (highlightLines !== undefined && highlightLines.length > 0) ||\n resolvedMinLines !== undefined ||\n collapsible ||\n resolvedCollapsedLines !== undefined ||\n maxHeight !== undefined ||\n tokens !== undefined;\n const isMultilineString = typeof children === \"string\" && children.includes(\"\\n\");\n const isBlock = block ?? (hasBlockProps || isMultilineString);\n\n if (!isBlock) {\n return (\n <code\n {...props}\n ref={ref as Ref<HTMLElement>}\n title={title}\n style={style}\n {...kb(\"code\", {}, className)}\n >\n {children}\n </code>\n );\n }\n\n const isCollapsed = collapsible ? (collapsedProp ?? uncontrolledCollapsed) : false;\n const showCopy = copyable ?? true;\n const languageLabel = formatCodeLanguage(language);\n const hasMeta = Boolean(title || languageLabel);\n const hasActions = Boolean(collapsible || showCopy);\n const showHeader = hasMeta || hasActions;\n\n const resolvedTokens =\n typeof children === \"string\" ? (tokens ?? tokenizeCode(rawCode, language ?? \"tsx\")) : [];\n const lines = typeof children === \"string\" ? rawCode.split(\"\\n\") : [];\n const highlightSet =\n highlightLines && highlightLines.length > 0 ? new Set(highlightLines) : undefined;\n const extraLineCount =\n typeof children === \"string\" &&\n resolvedMinLines !== undefined &&\n resolvedMinLines > lines.length\n ? resolvedMinLines - lines.length\n : 0;\n\n const hasCustomVars =\n maxHeight !== undefined ||\n resolvedMinLines !== undefined ||\n resolvedCollapsedLines !== undefined ||\n (collapsible && expandedHeight !== undefined);\n const blockStyle: CSSProperties | undefined = hasCustomVars\n ? ({\n ...style,\n ...(maxHeight !== undefined\n ? { \"--_code-max-height\": typeof maxHeight === \"number\" ? `${maxHeight}px` : maxHeight }\n : null),\n ...(resolvedMinLines !== undefined\n ? { \"--_code-min-lines\": String(resolvedMinLines) }\n : null),\n ...(resolvedCollapsedLines !== undefined\n ? { \"--_code-collapsed-lines\": String(resolvedCollapsedLines) }\n : null),\n ...(collapsible && expandedHeight !== undefined\n ? { \"--_code-expanded-max-height\": `${expandedHeight}px` }\n : null),\n } as CSSProperties)\n : style;\n\n const handleToggleCollapse = () => {\n const next = !isCollapsed;\n if (collapsedProp === undefined) {\n setUncontrolledCollapsed(next);\n }\n onCollapsedChange?.(next);\n };\n\n const resolvedCopyLabel = {\n idle: copyLabel,\n pending: copyingLabel,\n copied: copiedLabel,\n failed: copyErrorLabel,\n }[copyState];\n const copyAnnouncement =\n copyState === \"copied\"\n ? successMessage\n : copyState === \"failed\"\n ? errorMessage\n : copyState === \"pending\"\n ? copyingLabel\n : \"\";\n\n let offset = 0;\n\n return (\n <div\n {...(props as ComponentProps<\"div\">)}\n ref={ref as Ref<HTMLDivElement>}\n style={blockStyle}\n {...kb(\n \"code\",\n {\n block: true,\n \"line-numbers\": lineNumbers || undefined,\n \"min-lines\": resolvedMinLines !== undefined || undefined,\n collapsible: collapsible || undefined,\n collapsed: isCollapsed || undefined,\n \"collapsed-lines\": resolvedCollapsedLines !== undefined || undefined,\n language: language || undefined,\n },\n className,\n )}\n >\n {showHeader ? (\n <div className={clsx(\"kb-code-header\", classNames?.header)}>\n {hasMeta ? (\n <div className={clsx(\"kb-code-meta\", classNames?.meta)}>\n {title ? (\n <span className={clsx(\"kb-code-title\", classNames?.title)}>{title}</span>\n ) : null}\n {languageLabel ? (\n <span className={clsx(\"kb-code-language\", classNames?.language)}>\n {languageLabel}\n </span>\n ) : null}\n </div>\n ) : null}\n {hasActions ? (\n <div className={clsx(\"kb-code-actions\", classNames?.actions)}>\n {collapsible ? (\n <button\n type=\"button\"\n className={clsx(\"kb-code-toggle\", classNames?.toggle)}\n aria-expanded={!isCollapsed}\n aria-controls={viewportId}\n onClick={handleToggleCollapse}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M4.5 6.25 8 9.75l3.5-3.5\" />\n </svg>\n {isCollapsed ? \"Expand code\" : \"Collapse code\"}\n </button>\n ) : null}\n {showCopy ? (\n <button\n type=\"button\"\n className={clsx(\"kb-code-copy\", classNames?.copy)}\n data-copy-state={copyState}\n disabled={clipboard.disabled}\n aria-disabled={copyState === \"pending\" || undefined}\n onClick={() => void clipboard.copy()}\n >\n {copyState === \"copied\" ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M3.5 8.5 6.5 11.5 12.5 4.5\" />\n </svg>\n ) : copyState === \"failed\" ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M8 4.5v4.5M8 11.75h.01\" />\n </svg>\n ) : (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <rect x=\"5.5\" y=\"5.5\" width=\"7.5\" height=\"7.5\" rx=\"1.5\" />\n <path d=\"M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5\" />\n </svg>\n )}\n {resolvedCopyLabel}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n {showCopy ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(\n \"kb-code-feedback\",\n copyState !== \"failed\" && \"kb-sr-only\",\n classNames?.feedback,\n )}\n >\n {copyAnnouncement}\n </span>\n ) : null}\n <section\n id={viewportId}\n aria-label={title || \"Code\"}\n // biome-ignore lint/a11y/noNoninteractiveTabindex: Scrollable source needs keyboard access.\n tabIndex={0}\n className={clsx(\"kb-code-viewport\", classNames?.viewport)}\n >\n <pre ref={preRef} className={clsx(\"kb-code-pre\", classNames?.pre)}>\n <code className={clsx(\"kb-code-content\", classNames?.content)}>\n {typeof children === \"string\" ? (\n <>\n {lines.map((lineText, idx) => {\n const lineStart = offset;\n offset += lineText.length + 1;\n const lineNumber = startLine + idx;\n const isHighlighted = highlightSet?.has(lineNumber) ?? false;\n return (\n <Fragment key={lineNumber}>\n {idx > 0 ? \"\\n\" : null}\n <span\n className={clsx(\"kb-code-line\", classNames?.line)}\n data-highlighted={isHighlighted ? \"\" : undefined}\n >\n {lineNumbers ? (\n <span\n className={clsx(\"kb-code-line-number\", classNames?.lineNumber)}\n data-line-number={String(lineNumber)}\n aria-hidden=\"true\"\n />\n ) : null}\n <span className={clsx(\"kb-code-line-text\", classNames?.lineText)}>\n {renderLineTokens(lineText, lineStart, resolvedTokens)}\n </span>\n </span>\n </Fragment>\n );\n })}\n {extraLineCount > 0\n ? Array.from({ length: extraLineCount }, (_, extraOffset) => {\n const lineNumber = startLine + lines.length + extraOffset;\n const isHighlighted = highlightSet?.has(lineNumber) ?? false;\n return (\n <span\n key={`pad-${lineNumber}`}\n className={clsx(\"kb-code-line\", classNames?.line)}\n data-highlighted={isHighlighted ? \"\" : undefined}\n aria-hidden=\"true\"\n >\n {lineNumbers ? (\n <span\n className={clsx(\"kb-code-line-number\", classNames?.lineNumber)}\n data-line-number={String(lineNumber)}\n aria-hidden=\"true\"\n />\n ) : null}\n <span className={clsx(\"kb-code-line-text\", classNames?.lineText)} />\n </span>\n );\n })\n : null}\n </>\n ) : (\n children\n )}\n </code>\n </pre>\n </section>\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { Ref } from \"react\";\nimport { Code, type CodeProps } from \"../Code/Code\";\n\nexport type CodeBlockProps = Omit<CodeProps, \"block\" | \"children\" | \"ref\"> & {\n /** Exact source string, including whitespace and trailing newlines. */\n children: string;\n /** Root block element. */\n ref?: Ref<HTMLDivElement> | undefined;\n};\n\n/** Explicit block rendering with Code's highlighting, line, and collapse contracts. */\nexport function CodeBlock({ className, ...props }: CodeBlockProps) {\n return <Code {...props} block className={clsx(\"kb-codeblock\", className)} />;\n}\n","import { Field } from \"@base-ui/react/field\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type InputSize = \"sm\" | \"md\" | \"lg\";\n\nexport type InputProps = Omit<BaseInput.Props, \"size\" | \"className\"> & {\n /** Plain class string for the root. */\n className?: string;\n /** Visible label; required for accessibility. */\n label: string;\n /** Hide the label visually, keep it for screen readers. */\n visuallyHidden?: boolean;\n /** Helper text under the control. */\n description?: string;\n /** Error message; when set the field is invalid. */\n error?: string;\n /** Control height scale. */\n size?: InputSize;\n /** Content before control text, such as icons. */\n startContent?: ReactNode;\n /** Content after control text, such as a named action. */\n endContent?: ReactNode;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"label\" | \"shell\" | \"start\" | \"control\" | \"end\" | \"description\" | \"error\"\n >;\n};\n\nexport function Input({\n classNames,\n label,\n visuallyHidden,\n description,\n error,\n size = \"md\",\n disabled,\n className,\n startContent,\n endContent,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: InputProps) {\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n return (\n <Field.Root\n {...kb(\n \"input\",\n {\n size,\n invalid,\n \"start-adornment\": Boolean(startContent),\n \"end-adornment\": Boolean(endContent),\n },\n className,\n )}\n invalid={invalid}\n disabled={Boolean(disabled)}\n >\n <Field.Label\n className={clsx(\"kb-input-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </Field.Label>\n <div className={clsx(\"kb-input-shell\", classNames?.shell)}>\n {startContent && (\n <span className={clsx(\"kb-input-start\", classNames?.start)}>{startContent}</span>\n )}\n <BaseInput\n {...props}\n aria-invalid={ariaInvalid}\n render={\n props.render ??\n (typeof ariaInvalid === \"string\" ? <input aria-invalid={ariaInvalid} /> : undefined)\n }\n className={clsx(\"kb-input-control\", classNames?.control)}\n />\n {endContent && <span className={clsx(\"kb-input-end\", classNames?.end)}>{endContent}</span>}\n </div>\n {description ? (\n <Field.Description className={clsx(\"kb-input-description\", classNames?.description)}>\n {description}\n </Field.Description>\n ) : null}\n {error ? (\n <Field.Error className={clsx(\"kb-input-error\", classNames?.error)} match>\n {error}\n </Field.Error>\n ) : null}\n </Field.Root>\n );\n}\n","import { Select as Base } from \"@base-ui/react/select\";\nimport { clsx } from \"clsx\";\nimport { type ComponentProps, useId, useImperativeHandle, useRef, useState } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type SelectOption = { value: string; label: string; disabled?: boolean };\nexport type SelectProps = Omit<ComponentProps<\"div\">, \"onChange\" | \"children\" | \"defaultValue\"> & {\n /** Visible label for the trigger. */\n label: string;\n /** Controlled selection; null displays the placeholder. */\n value: string | null;\n /** Receives selected value; consumers own domain transitions. */\n onValueChange: (value: string | null) => void;\n /** Unique string-valued options; an empty collection is supported. */\n options: readonly SelectOption[];\n /** Text when value is null. */\n placeholder?: string;\n /** Field helper text. */\n description?: string;\n /** Visible invalid-state message. */\n error?: string;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Preserve value while preventing changes. */\n readOnly?: boolean;\n /** Native form field name. */\n name?: string;\n /** Class on trigger slot. */\n controlClassName?: string;\n /** Class on popup slot. */\n popupClassName?: string;\n /** Portal host; defaults to field root to retain theme. */\n container?: Base.Portal.Props[\"container\"];\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n | \"control\"\n | \"popup\"\n | \"label\"\n | \"icon\"\n | \"portal\"\n | \"positioner\"\n | \"list\"\n | \"item\"\n | \"indicator\"\n | \"empty\"\n | \"description\"\n | \"error\"\n >;\n};\nexport function Select({\n classNames,\n label,\n value,\n onValueChange,\n options,\n placeholder = \"Choose an option\",\n description,\n error,\n disabled = false,\n readOnly = false,\n name,\n className,\n controlClassName,\n popupClassName,\n container,\n ref,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: SelectProps) {\n const id = useId();\n const root = useRef<HTMLDivElement>(null);\n const trigger = useRef<HTMLButtonElement>(null);\n const popup = useRef<HTMLDivElement>(null);\n const interaction = useRef<\"pointer\" | \"keyboard\">(\"keyboard\");\n const [pointerFocus, setPointerFocus] = useState(false);\n useImperativeHandle(ref, () => root.current as HTMLDivElement);\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const empty = options.length === 0;\n const inactive = disabled || empty;\n const help =\n [description, empty && \"No options available\"].filter(Boolean).join(\" \") || undefined;\n const described =\n [help ? `${id}-description` : null, error ? `${id}-error` : null, callerDescription]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <div {...props} ref={root} {...kb(\"select\", { disabled: inactive, invalid }, className)}>\n <Base.Root<string>\n modal={false}\n items={options}\n value={value}\n onValueChange={(next) => {\n if (\n !inactive &&\n !readOnly &&\n (next === null || options.some((item) => item.value === next && !item.disabled))\n )\n onValueChange(next);\n }}\n disabled={inactive}\n readOnly={readOnly}\n onOpenChange={(_open, details) => {\n if (details.event.type.startsWith(\"key\")) interaction.current = \"keyboard\";\n else if (/^(pointer|mouse)/.test(details.event.type)) interaction.current = \"pointer\";\n }}\n {...(name ? { name } : {})}\n >\n <Base.Label className={clsx(\"kb-select-label\", classNames?.label)}>{label}</Base.Label>\n <Base.Trigger\n ref={trigger}\n className={clsx(\"kb-select-control\", classNames?.control, controlClassName)}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n data-pointer-focus={pointerFocus || undefined}\n onPointerDown={() => {\n interaction.current = \"pointer\";\n setPointerFocus(true);\n }}\n onKeyDown={() => {\n interaction.current = \"keyboard\";\n setPointerFocus(false);\n }}\n onBlur={() => setPointerFocus(false)}\n >\n <Base.Value placeholder={placeholder} />\n <Base.Icon className={clsx(\"kb-select-icon\", classNames?.icon)} aria-hidden=\"true\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </svg>\n </Base.Icon>\n </Base.Trigger>\n <Base.Portal\n container={container ?? root}\n className={clsx(\"kb-select-portal\", classNames?.portal)}\n >\n <Base.Positioner\n className={clsx(\"kb-select-positioner\", classNames?.positioner)}\n sideOffset={6}\n alignItemWithTrigger={false}\n >\n <Base.Popup\n ref={popup}\n className={clsx(\"kb-select-popup\", classNames?.popup, popupClassName)}\n onPointerDownCapture={() => {\n interaction.current = \"pointer\";\n }}\n onKeyDownCapture={() => {\n interaction.current = \"keyboard\";\n }}\n finalFocus={() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== document.body &&\n active !== trigger.current &&\n !popup.current?.contains(active) &&\n !active.hasAttribute(\"data-base-ui-focus-guard\")\n ) {\n setPointerFocus(false);\n return false;\n }\n setPointerFocus(interaction.current === \"pointer\");\n return true;\n }}\n >\n <Base.List className={clsx(\"kb-select-list\", classNames?.list)} aria-label={label}>\n {options.length ? (\n options.map((option) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-select-item\", classNames?.item)}\n >\n <Base.ItemText>{option.label}</Base.ItemText>\n <Base.ItemIndicator\n className={clsx(\"kb-select-indicator\", classNames?.indicator)}\n aria-hidden=\"true\"\n >\n ✓\n </Base.ItemIndicator>\n </Base.Item>\n ))\n ) : (\n <Base.Item\n value=\"\"\n disabled\n className={clsx(\n \"kb-select-item kb-select-empty\",\n classNames?.item,\n classNames?.empty,\n )}\n >\n <Base.ItemText>No options available</Base.ItemText>\n </Base.Item>\n )}\n </Base.List>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n </Base.Root>\n {help && (\n <p\n className={clsx(\"kb-select-description\", classNames?.description)}\n id={`${id}-description`}\n >\n {help}\n </p>\n )}\n {error && (\n <p className={clsx(\"kb-select-error\", classNames?.error)} id={`${id}-error`}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { useLayoutEffect, useRef, useState } from \"react\";\n\nexport type CollectionSort = {\n /** Column identifier. */\n key: string;\n /** Comparison direction. */\n direction: \"ascending\" | \"descending\";\n};\nexport type CollectionState = {\n /** Search text, interpreted by matches or the server. */\n query: string;\n /** Facet values; empty values mean no constraint. */\n filters: Readonly<Record<string, string>>;\n /** Active sort; null preserves input order. */\n sort: CollectionSort | null;\n /** One-based page. */\n page: number;\n /** Positive integer records per page. */\n pageSize: number;\n /** Explicit record IDs; never an implicit all-results selection. */\n selectedKeys: readonly string[];\n};\nexport type CollectionData<T> = {\n /** Complete local dataset or one server page. */\n items: readonly T[];\n /** Unique, stable identity across pages and updates. */\n getKey: (item: T) => string;\n /** Disable selection for an ineligible record. */\n isItemDisabled?: ((item: T) => boolean) | undefined;\n /** Client search and facet predicate; server mode ignores it. */\n matches?: ((item: T, query: string, filters: CollectionState[\"filters\"]) => boolean) | undefined;\n /** Client comparison for the requested sort; server mode ignores it. */\n compare?: ((a: T, b: T, sort: CollectionSort) => number) | undefined;\n} & ({ mode?: \"client\" | undefined; totalItems?: never } | { mode: \"server\"; totalItems: number });\nexport type UseCollectionOptions<T> = CollectionData<T> & {\n /** Controlled workflow state; owner must apply changes. */\n state?: CollectionState | undefined;\n /** Initial uncontrolled workflow state. */\n defaultState?: Partial<CollectionState> | undefined;\n /** Receives complete next state for URL, server or external ownership. */\n onStateChange?: ((state: CollectionState) => void) | undefined;\n};\n\nexport function positiveInteger(value: number, name: string): number {\n if (!Number.isSafeInteger(value) || value < 1)\n throw new RangeError(`${name} must be a positive safe integer`);\n return value;\n}\nexport function collectionPageCount(totalItems: number, pageSize: number): number {\n positiveInteger(pageSize, \"pageSize\");\n if (!Number.isSafeInteger(totalItems) || totalItems < 0)\n throw new RangeError(\"totalItems must be a non-negative safe integer\");\n return Math.max(1, Math.ceil(totalItems / pageSize));\n}\n\nexport function useCollection<T>(options: UseCollectionOptions<T>) {\n const { items, getKey, isItemDisabled, matches, compare } = options;\n const [internal, setInternal] = useState<CollectionState>(() => ({\n query: \"\",\n filters: {},\n sort: null,\n page: 1,\n pageSize: 10,\n selectedKeys: [],\n ...options.defaultState,\n }));\n const derive = (requested: CollectionState) => {\n positiveInteger(requested.page, \"page\");\n positiveInteger(requested.pageSize, \"pageSize\");\n const keys = new Set<string>();\n const disabledKeys = new Set<string>();\n for (const item of items) {\n const key = getKey(item);\n if (keys.has(key)) throw new Error(\"Collection record keys must be unique\");\n keys.add(key);\n if (isItemDisabled?.(item)) disabledKeys.add(key);\n }\n let processed = items;\n if (options.mode !== \"server\") {\n processed = matches\n ? items.filter((item) => matches(item, requested.query, requested.filters))\n : items;\n if (requested.sort && compare) {\n const sort = requested.sort;\n processed = [...processed].sort(\n (a, b) => compare(a, b, sort) * (sort.direction === \"ascending\" ? 1 : -1),\n );\n }\n }\n const totalItems = options.mode === \"server\" ? options.totalItems : processed.length;\n const pageCount = collectionPageCount(totalItems, requested.pageSize);\n const state: CollectionState = {\n ...requested,\n page: Math.min(requested.page, pageCount),\n selectedKeys: [...new Set(requested.selectedKeys)].filter(\n (key) => !disabledKeys.has(key) && (options.mode === \"server\" || keys.has(key)),\n ),\n };\n const pageItems =\n options.mode === \"server\"\n ? items\n : processed.slice((state.page - 1) * state.pageSize, state.page * state.pageSize);\n const selectableKeys = pageItems.map(getKey).filter((key) => !disabledKeys.has(key));\n const selected = new Set(state.selectedKeys);\n const selectedOnPage = selectableKeys.filter((key) => selected.has(key)).length;\n const pageSelection: \"none\" | \"some\" | \"all\" =\n selectedOnPage === 0 ? \"none\" : selectedOnPage === selectableKeys.length ? \"all\" : \"some\";\n return {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableKeys,\n keys,\n disabledKeys,\n };\n };\n const {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableKeys,\n keys,\n disabledKeys,\n } = derive(options.state ?? internal);\n const requested = options.state ?? internal;\n const context = {\n state,\n derive,\n keys,\n disabledKeys,\n controlled: options.state !== undefined,\n onStateChange: options.onStateChange,\n };\n const latest = useRef(context);\n useLayoutEffect(() => {\n latest.current = context;\n if (\n options.state === undefined &&\n (requested.page !== state.page ||\n requested.selectedKeys.length !== state.selectedKeys.length ||\n requested.selectedKeys.some((key, index) => key !== state.selectedKeys[index]))\n )\n setInternal(state);\n });\n const change = (\n patch: Partial<CollectionState> | ((current: CollectionState) => Partial<CollectionState>),\n ) => {\n const current = latest.current;\n const next = current.derive({\n ...current.state,\n ...(typeof patch === \"function\" ? patch(current.state) : patch),\n }).state;\n if (!current.controlled) {\n current.state = next;\n setInternal(next);\n }\n current.onStateChange?.(next);\n };\n return {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableCount: selectableKeys.length,\n setQuery: (query: string) => change({ query, page: 1, selectedKeys: [] }),\n setFilter: (key: string, value: string) =>\n change((current) => ({\n filters: { ...current.filters, [key]: value },\n page: 1,\n selectedKeys: [],\n })),\n setSort: (sort: CollectionSort | null) => change({ sort, page: 1 }),\n setPage: (page: number) => change({ page }),\n setPageSize: (pageSize: number) => change({ pageSize, page: 1 }),\n toggle: (key: string, checked: boolean) => {\n const current = latest.current;\n if (!current.keys.has(key) || current.disabledKeys.has(key)) return;\n change((current) => {\n const next = new Set(current.selectedKeys);\n if (checked) next.add(key);\n else next.delete(key);\n return { selectedKeys: [...next] };\n });\n },\n selectPage: (checked: boolean) => {\n change((current) => {\n const next = new Set(current.selectedKeys);\n for (const key of latest.current.derive(current).selectableKeys) {\n if (checked) next.add(key);\n else next.delete(key);\n }\n return { selectedKeys: [...next] };\n });\n },\n clearSelection: () => change({ selectedKeys: [] }),\n removeSelection: (keysToRemove: readonly string[]) => {\n const removed = new Set(keysToRemove);\n change((current) => ({\n selectedKeys: current.selectedKeys.filter((key) => !removed.has(key)),\n }));\n },\n };\n}\nexport type CollectionController<T> = ReturnType<typeof useCollection<T>>;\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type ReactNode,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Button } from \"../Button/Button\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { Input } from \"../Input/Input\";\nimport { Select } from \"../Select/Select\";\nimport {\n collectionPageCount,\n positiveInteger,\n type UseCollectionOptions,\n useCollection,\n} from \"./useCollection\";\n\nexport type CollectionColumn<T> = {\n /** Unique column identity used in sort requests. */\n key: string;\n /** Visible column label. */\n header: string;\n /** Record cell content. */\n cell: (item: T) => ReactNode;\n /** Ascending comparator; enables sorting in client mode. */\n compare?: ((a: T, b: T) => number) | undefined;\n /** Enable a server-owned sortable column without a local comparator. */\n sortable?: boolean | undefined;\n};\nexport type CollectionFilter = {\n /** State filter key. */\n key: string;\n /** Visible select label. */\n label: string;\n /** Nonempty facet values and their visible labels. */\n options: readonly { value: string; label: string }[];\n};\nexport type CollectionBulkAction = {\n /** Unique action identity. */\n key: string;\n /** Visible action label. */\n label: string;\n /** Receives explicit ID snapshot; rejection preserves selection. */\n onAction: (keys: readonly string[]) => void | Promise<void>;\n /** Caller-owned permission or availability constraint. */\n disabled?: boolean | undefined;\n};\nexport type CollectionPaginationProps = Omit<ComponentProps<\"nav\">, \"onChange\"> & {\n /** One-based current page; clamped to available pages. */\n page: number;\n /** Positive integer page size. */\n pageSize: number;\n /** Known non-negative total after filtering. */\n totalItems: number;\n /** Receives bounded one-based page requests. */\n onPageChange: (page: number) => void;\n /** Receives page-size requests; caller also resets page to one. */\n onPageSizeChange?: ((pageSize: number) => void) | undefined;\n /** Positive integer page-size choices. */\n pageSizes?: readonly number[] | undefined;\n /** Disable navigation while data or actions are pending. */\n disabled?: boolean | undefined;\n};\nexport function CollectionPagination({\n page,\n pageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n pageSizes = [10, 25, 50],\n disabled,\n className,\n ...props\n}: CollectionPaginationProps) {\n const count = collectionPageCount(totalItems, pageSize);\n const current = Math.min(positiveInteger(page, \"page\"), count);\n const sizes = [...new Set([pageSize, ...pageSizes])].sort((a, b) => a - b);\n for (const size of sizes) positiveInteger(size, \"pageSizes\");\n return (\n <nav\n {...props}\n {...kb(\"collection-pagination\", {}, className)}\n aria-label={props[\"aria-label\"] ?? \"Collection pagination\"}\n >\n <div>\n <span>\n {totalItems ? (current - 1) * pageSize + 1 : 0}–{Math.min(current * pageSize, totalItems)}{\" \"}\n of {totalItems}\n </span>\n {onPageSizeChange && (\n <Select\n label=\"Rows per page\"\n disabled={Boolean(disabled)}\n value={String(pageSize)}\n options={sizes.map((size) => ({ value: String(size), label: String(size) }))}\n onValueChange={(value) => {\n if (value !== null) onPageSizeChange(Number(value));\n }}\n />\n )}\n </div>\n <div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || current === 1}\n onClick={() => onPageChange(current - 1)}\n aria-label=\"Previous page\"\n >\n Previous\n </Button>\n <span aria-live=\"polite\" aria-atomic=\"true\">\n Page {current} of {count}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || current === count}\n onClick={() => onPageChange(current + 1)}\n aria-label=\"Next page\"\n >\n Next\n </Button>\n </div>\n </nav>\n );\n}\nexport type CollectionBulkActionsProps = ComponentProps<\"fieldset\"> & {\n /** Explicit selected record IDs, including off-page selection. */\n selectedKeys: readonly string[];\n /** Available application-owned operations. */\n actions: readonly CollectionBulkAction[];\n /** Clear current selection on request. */\n onClear: () => void;\n /** Remove successfully submitted IDs; omitted preserves selection. */\n onSuccess?: ((keys: readonly string[]) => void) | undefined;\n /** Lock surrounding collection controls during an operation. */\n onPendingChange?: ((pending: boolean) => void) | undefined;\n /** Disable actions while parent data is unavailable. */\n disabled?: boolean | undefined;\n};\nexport function CollectionBulkActions({\n selectedKeys,\n actions,\n onClear,\n onSuccess,\n onPendingChange,\n disabled,\n className,\n ...props\n}: CollectionBulkActionsProps) {\n const [pending, setPending] = useState<string | null>(null);\n const [failed, setFailed] = useState(false);\n useEffect(() => {\n if (failed && selectedKeys.length === 0) setFailed(false);\n }, [failed, selectedKeys.length]);\n const lock = useRef(false);\n const selection = [...new Set(selectedKeys)];\n const success = useRef(onSuccess);\n useLayoutEffect(() => {\n success.current = onSuccess;\n });\n const run = async (action: CollectionBulkAction) => {\n if (lock.current || disabled || action.disabled || !selection.length) return;\n lock.current = true;\n const snapshot = [...selection];\n setFailed(false);\n setPending(action.key);\n onPendingChange?.(true);\n try {\n await action.onAction(snapshot);\n success.current?.(snapshot);\n } catch {\n setFailed(true);\n } finally {\n lock.current = false;\n setPending(null);\n onPendingChange?.(false);\n }\n };\n return (\n <fieldset\n {...props}\n {...kb(\"collection-bulk\", { pending: pending !== null }, className)}\n aria-label={props[\"aria-label\"] ?? \"Selection actions\"}\n >\n <span role=\"status\">{selection.length} selected</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || pending !== null || !selection.length}\n onClick={() => {\n setFailed(false);\n onClear();\n }}\n >\n Clear selection\n </Button>\n {actions.map((action) => (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n key={action.key}\n disabled={disabled || pending !== null || action.disabled || !selection.length}\n onClick={() => void run(action)}\n >\n {action.label}\n </Button>\n ))}\n <span role=\"status\">{pending !== null ? \"Action in progress\" : \"\"}</span>\n {failed && selectedKeys.length > 0 && (\n <span role=\"alert\">Action failed. Selection kept; try again.</span>\n )}\n </fieldset>\n );\n}\n\ntype CollectionPart =\n | \"toolbar\"\n | \"filters\"\n | \"viewport\"\n | \"table\"\n | \"caption\"\n | \"head\"\n | \"cell\"\n | \"row\"\n | \"empty\"\n | \"status\"\n | \"bulk\"\n | \"pagination\";\nexport type CollectionProps<T> = UseCollectionOptions<T> &\n Omit<ComponentProps<\"section\">, \"children\" | \"defaultValue\"> & {\n /** Accessible region name and visible table caption. */\n label: string;\n /** Stable accessible record name used by selection controls. */\n getItemLabel: (item: T) => string;\n /** Ordered table columns. */\n columns: readonly CollectionColumn<T>[];\n /** Facet controls; matches applies their values in client mode. */\n filters?: readonly CollectionFilter[] | undefined;\n /** Application-owned operations on explicit selected IDs. */\n bulkActions?: readonly CollectionBulkAction[] | undefined;\n /** Hide selection controls for read-only collections. */\n selectable?: boolean | undefined;\n /** Suppress rows and lock controls while fetching. */\n loading?: boolean | undefined;\n /** Caller-owned fetch failure and recovery content. */\n error?: ReactNode | undefined;\n /** Content shown when no records match. */\n empty?: ReactNode | undefined;\n /** Additional named controls or recovery actions. */\n toolbar?: ReactNode | undefined;\n /** Classes for collection slots. */\n classNames?: ClassNames<CollectionPart> | undefined;\n };\nfunction CollectionRoot<T>({\n label,\n getItemLabel,\n columns,\n filters = [],\n bulkActions = [],\n selectable = true,\n loading = false,\n error,\n empty = \"No matching records\",\n toolbar,\n classNames,\n className,\n items,\n getKey,\n isItemDisabled,\n matches,\n compare,\n mode,\n totalItems,\n state,\n defaultState,\n onStateChange,\n ...props\n}: CollectionProps<T>) {\n const [pending, setPending] = useState(false);\n const blocked = loading || Boolean(error) || pending;\n const collection = useCollection<T>({\n items,\n getKey,\n isItemDisabled,\n matches,\n compare:\n compare ??\n ((a, b, sort) => columns.find((column) => column.key === sort.key)?.compare?.(a, b) ?? 0),\n ...(mode === \"server\" ? { mode, totalItems: totalItems as number } : { mode: \"client\" }),\n state,\n defaultState,\n onStateChange,\n });\n const id = useId();\n const slot = (part: CollectionPart) => clsx(`kb-collection-${part}`, classNames?.[part]);\n const { state: current } = collection;\n const selectedKeys = new Set(current.selectedKeys);\n return (\n <section\n {...props}\n {...kb(\"collection\", { loading, pending }, className)}\n aria-label={label}\n aria-busy={loading}\n >\n <div className={slot(\"toolbar\")}>\n {(matches || mode === \"server\") && (\n <Input\n type=\"search\"\n label={`Search ${label}`}\n value={current.query}\n disabled={blocked}\n onChange={(event) => collection.setQuery(event.target.value)}\n />\n )}\n <div className={slot(\"filters\")}>\n {filters.map((filter) => (\n <Select\n key={filter.key}\n label={filter.label}\n disabled={blocked}\n value={current.filters[filter.key] ? `option:${current.filters[filter.key]}` : \"all\"}\n options={[\n { value: \"all\", label: \"All\" },\n ...filter.options.map((option) => ({ ...option, value: `option:${option.value}` })),\n ]}\n onValueChange={(value) =>\n collection.setFilter(\n filter.key,\n value && value !== \"all\" ? value.slice(\"option:\".length) : \"\",\n )\n }\n />\n ))}\n </div>\n {toolbar}\n </div>\n {selectable && (\n <CollectionBulkActions\n className={classNames?.bulk}\n selectedKeys={current.selectedKeys}\n actions={bulkActions}\n onClear={collection.clearSelection}\n onSuccess={collection.removeSelection}\n onPendingChange={setPending}\n disabled={blocked}\n />\n )}\n <p className={slot(\"status\")} role=\"status\" aria-atomic=\"true\">\n {loading\n ? \"Loading records\"\n : error\n ? \"Records unavailable\"\n : `${collection.totalItems} records`}\n </p>\n {error ? (\n <div role=\"alert\">{error}</div>\n ) : (\n // biome-ignore lint/a11y/noNoninteractiveTabindex: Keyboard users must scroll wide tables.\n <section className={slot(\"viewport\")} tabIndex={0} aria-label={`${label} table`}>\n <table className={slot(\"table\")}>\n <caption className={slot(\"caption\")}>{label}</caption>\n <thead>\n <tr>\n {selectable && (\n <th className={slot(\"head\")} scope=\"col\">\n <Checkbox\n label=\"Select this page\"\n visuallyHidden\n checked={collection.pageSelection === \"all\"}\n indeterminate={collection.pageSelection === \"some\"}\n disabled={blocked || collection.selectableCount === 0}\n onCheckedChange={collection.selectPage}\n />\n </th>\n )}\n {columns.map((column) => {\n const sortable = Boolean(\n column.compare || (mode === \"server\" && column.sortable),\n );\n const direction =\n current.sort?.key === column.key ? current.sort.direction : \"none\";\n return (\n <th\n key={column.key}\n scope=\"col\"\n className={slot(\"head\")}\n aria-sort={sortable ? direction : undefined}\n >\n {sortable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Sort by ${column.header}`}\n disabled={blocked}\n onClick={() =>\n collection.setSort(\n direction === \"descending\"\n ? null\n : {\n key: column.key,\n direction: direction === \"none\" ? \"ascending\" : \"descending\",\n },\n )\n }\n >\n {column.header}{\" \"}\n <span aria-hidden=\"true\">\n {direction === \"ascending\"\n ? \"↑\"\n : direction === \"descending\"\n ? \"↓\"\n : \"↕\"}\n </span>\n </Button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {!loading &&\n collection.items.map((item) => {\n const key = getKey(item);\n const selected = selectedKeys.has(key);\n return (\n <tr key={key} className={slot(\"row\")} data-selected={selected || undefined}>\n {selectable && (\n <td className={slot(\"cell\")}>\n <Checkbox\n label={`Select ${getItemLabel(item)}`}\n visuallyHidden\n checked={selected}\n disabled={blocked || isItemDisabled?.(item)}\n onCheckedChange={(checked) => collection.toggle(key, checked)}\n />\n </td>\n )}\n {columns.map((column) => (\n <td className={slot(\"cell\")} key={column.key}>\n {column.cell(item)}\n </td>\n ))}\n </tr>\n );\n })}\n {(loading || collection.items.length === 0) && (\n <tr>\n <td className={slot(\"empty\")} colSpan={columns.length + (selectable ? 1 : 0)}>\n {loading ? \"Loading records…\" : empty}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </section>\n )}\n <CollectionPagination\n id={`${id}-pagination`}\n className={classNames?.pagination}\n aria-label={`${label} pagination`}\n page={current.page}\n pageSize={current.pageSize}\n totalItems={collection.totalItems}\n onPageChange={collection.setPage}\n onPageSizeChange={collection.setPageSize}\n disabled={blocked}\n />\n </section>\n );\n}\n\nexport const Collection = Object.assign(CollectionRoot, {\n Pagination: CollectionPagination,\n BulkActions: CollectionBulkActions,\n});\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type CollectionListElement = \"ul\" | \"ol\";\nexport type CollectionListProps<T extends CollectionListElement = \"ul\"> = ComponentProps<T> & {\n as?: T | undefined;\n density?: \"comfortable\" | \"dense\" | undefined;\n dividers?: boolean | undefined;\n};\nexport function CollectionList<T extends CollectionListElement = \"ul\">({\n as,\n density = \"comfortable\",\n dividers = true,\n className,\n ...props\n}: CollectionListProps<T>) {\n return createElement(as ?? \"ul\", {\n ...props,\n role: props.role ?? \"list\",\n ...kb(\"collectionlist\", { density, dividers, ordered: as === \"ol\" }, className),\n });\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type CollectionRowProps = Omit<ComponentProps<\"li\">, \"title\" | \"children\"> & {\n /** Primary record name; compose a named link for navigation. */\n title: ReactNode;\n /** Supporting detail; rich content and zero values remain intact. */\n description?: ReactNode | undefined;\n /** Leading icon, avatar or independent selection control. */\n leading?: ReactNode | undefined;\n metadata?: ReactNode | undefined;\n /** Independent named links, Buttons or Menu composition. */\n actions?: ReactNode | undefined;\n /** Visual selection; selection control supplies accessible state. */\n selected?: boolean | undefined;\n classNames?:\n | ClassNames<\n | \"layout\"\n | \"leading\"\n | \"content\"\n | \"title\"\n | \"description\"\n | \"aside\"\n | \"metadata\"\n | \"actions\"\n >\n | undefined;\n};\nfunction hasSlotContent(value: ReactNode): boolean {\n return value != null && typeof value !== \"boolean\" && value !== \"\";\n}\n\nexport function CollectionRow({\n title,\n description,\n leading,\n metadata,\n actions,\n selected = false,\n classNames,\n className,\n ...props\n}: CollectionRowProps) {\n const aside = hasSlotContent(metadata) || hasSlotContent(actions);\n return (\n <li\n {...props}\n {...kb(\"collectionrow\", { selected, leading: hasSlotContent(leading), aside }, className)}\n >\n <div className={clsx(\"kb-collectionrow-layout\", classNames?.layout)}>\n {hasSlotContent(leading) && (\n <div className={clsx(\"kb-collectionrow-leading\", classNames?.leading)}>{leading}</div>\n )}\n <div className={clsx(\"kb-collectionrow-content\", classNames?.content)}>\n <div className={clsx(\"kb-collectionrow-title\", classNames?.title)}>{title}</div>\n {hasSlotContent(description) && (\n <div className={clsx(\"kb-collectionrow-description\", classNames?.description)}>\n {description}\n </div>\n )}\n </div>\n {aside && (\n <div className={clsx(\"kb-collectionrow-aside\", classNames?.aside)}>\n {hasSlotContent(metadata) && (\n <div className={clsx(\"kb-collectionrow-metadata\", classNames?.metadata)}>\n {metadata}\n </div>\n )}\n {hasSlotContent(actions) && (\n <div className={clsx(\"kb-collectionrow-actions\", classNames?.actions)}>{actions}</div>\n )}\n </div>\n )}\n </div>\n </li>\n );\n}\n","import { Combobox as Base } from \"@base-ui/react/combobox\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\n/** Single selectable option in a MultiSelect list. */\nexport interface MultiSelectOption {\n /** Option value included in `value` and passed to `onValueChange`. */\n value: string;\n /** Visible option label shown in the popup list and selection chip. */\n label: string;\n /** Prevent selecting or deselecting this option in the list. */\n disabled?: boolean;\n}\n\n/** Styleable inner anatomy slots of MultiSelect. */\nexport type MultiSelectSlot =\n | \"label\"\n | \"shell\"\n | \"chips\"\n | \"chip\"\n | \"chipLabel\"\n | \"chipRemove\"\n | \"input\"\n | \"actions\"\n | \"clear\"\n | \"trigger\"\n | \"positioner\"\n | \"popup\"\n | \"list\"\n | \"option\"\n | \"optionIndicator\"\n | \"optionLabel\"\n | \"empty\"\n | \"description\"\n | \"error\";\n\n/** Props for the searchable multi-select component with removable chips. */\nexport interface MultiSelectProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"defaultValue\" | \"onChange\"> {\n /** Visible label naming the multiselect input. */\n label: string;\n /** Selectable options shown and filtered in the popup list. */\n options: readonly MultiSelectOption[];\n /** Selected option values rendered as removable chips. */\n value: readonly string[];\n /** Called when the user adds, removes, or clears selected values. */\n onValueChange: (value: string[]) => void;\n /** Placeholder text shown when the input is empty. */\n placeholder?: string;\n /** Message announced and shown when no options match the query. */\n emptyMessage?: ReactNode;\n /** Control height and typography scale. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Supporting helper text linked through `aria-describedby`. */\n description?: ReactNode;\n /** Validation error message; marks the control invalid when truthy. */\n error?: ReactNode;\n /** Mark the control invalid without an error message. */\n invalid?: boolean;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Allow focus and inspection while preventing value changes. */\n readOnly?: boolean;\n /** Require at least one selection for form validation. */\n required?: boolean;\n /** Form field name for native form submission. */\n name?: string;\n /** Controlled popup open state. */\n open?: boolean;\n /** Initial popup open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the popup opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Controlled search query text inside the input. */\n inputValue?: string;\n /** Called when the search query text changes. */\n onInputValueChange?: (inputValue: string) => void;\n /** Accessible name builder for each chip remove button (defaults to `\"Remove {option.label}\"`). */\n removeLabel?: (option: MultiSelectOption) => string;\n /** Accessible name for the clear-all button (defaults to `\"Clear {label}\"`). */\n clearLabel?: string;\n /** Accessible name for the popup toggle button (defaults to `\"Toggle {label} options\"`). */\n toggleLabel?: string;\n /** Portal host; defaults to field root to retain nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Extra classes for inner parts, keyed by slot name. */\n classNames?: ClassNames<MultiSelectSlot>;\n}\n\nconst defaultRemoveLabel = (option: MultiSelectOption) => `Remove ${option.label}`;\n// Strip prohibited aria-readonly/aria-disabled emitted by Base UI on generic chip div.\nconst chipAriaReset: Record<string, undefined> = {\n \"aria-readonly\": undefined,\n \"aria-disabled\": undefined,\n};\n\n/** Searchable multi-choice selection control with removable selection chips. */\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(function MultiSelect(\n {\n label,\n options,\n value,\n onValueChange,\n placeholder,\n emptyMessage = \"No matching options\",\n size = \"md\",\n description,\n error,\n invalid,\n disabled = false,\n readOnly = false,\n required = false,\n name,\n open,\n defaultOpen,\n onOpenChange,\n inputValue,\n onInputValueChange,\n removeLabel = defaultRemoveLabel,\n clearLabel,\n toggleLabel,\n container,\n className,\n classNames,\n id,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...rest\n },\n ref,\n) {\n const uid = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputId = id ?? `${uid}-input`;\n const labelId = `${uid}-label`;\n const descId = `${uid}-desc`;\n const errId = `${uid}-err`;\n const hasError = Boolean(error);\n const { invalid: isInvalid, ariaInvalid } = resolveInvalid(\n Boolean(invalid) || hasError,\n callerAriaInvalid,\n );\n const hasDescription = Boolean(description);\n const describedBy =\n [hasDescription ? descId : null, hasError ? errId : null, ariaDescribedBy]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const collection = useMemo(\n () => Base.createItems(options, { getValue: (o) => o.value, getLabel: (o) => o.label }),\n [options],\n );\n\n const optionMap = useMemo(() => new Map(options.map((o) => [o.value, o])), [options]);\n\n const selectedValues = useMemo(\n () => value.filter((v, idx) => optionMap.has(v) && value.indexOf(v) === idx),\n [value, optionMap],\n );\n\n const selectedOptions = useMemo(\n () =>\n selectedValues\n .map((v) => optionMap.get(v))\n .filter((o): o is MultiSelectOption => o !== undefined),\n [selectedValues, optionMap],\n );\n\n return (\n <Base.Root<string, true, MultiSelectOption>\n multiple\n items={collection}\n value={selectedValues}\n onValueChange={(next) => {\n if (disabled || readOnly) return;\n onValueChange(next ?? []);\n }}\n inputValue={inputValue}\n onInputValueChange={(next) => {\n onInputValueChange?.(next);\n }}\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next, details) => {\n if (!next && details.reason === \"item-press\") {\n details.cancel();\n return;\n }\n onOpenChange?.(next);\n }}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n >\n <div\n {...rest}\n ref={rootRef}\n {...kb(\n \"multiselect\",\n {\n size,\n invalid: isInvalid,\n disabled,\n readonly: readOnly,\n required,\n },\n className,\n )}\n >\n <label\n id={labelId}\n htmlFor={inputId}\n className={clsx(\"kb-multiselect-label\", classNames?.label)}\n >\n {label}\n </label>\n <Base.InputGroup\n aria-labelledby={labelId}\n className={clsx(\"kb-multiselect-shell\", classNames?.shell)}\n >\n <Base.Chips\n aria-label={`${label} selections`}\n className={clsx(\"kb-multiselect-chips\", classNames?.chips)}\n >\n {selectedOptions.map((option) => (\n <Base.Chip\n key={option.value}\n {...chipAriaReset}\n className={clsx(\"kb-multiselect-chip\", classNames?.chip)}\n >\n <span className={clsx(\"kb-multiselect-chip-label\", classNames?.chipLabel)}>\n {option.label}\n </span>\n <Base.ChipRemove\n aria-label={removeLabel(option)}\n disabled={disabled || readOnly}\n className={clsx(\"kb-multiselect-chip-remove\", classNames?.chipRemove)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.ChipRemove>\n </Base.Chip>\n ))}\n <Base.Input\n ref={ref}\n id={inputId}\n placeholder={placeholder}\n aria-labelledby={labelId}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-multiselect-input\", classNames?.input)}\n />\n </Base.Chips>\n <div className={clsx(\"kb-multiselect-actions\", classNames?.actions)}>\n <Base.Clear\n aria-label={clearLabel ?? `Clear ${label}`}\n disabled={disabled || readOnly}\n className={clsx(\"kb-multiselect-clear\", classNames?.clear)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.Clear>\n <Base.Trigger\n aria-label={toggleLabel ?? `Toggle ${label} options`}\n disabled={disabled}\n className={clsx(\"kb-multiselect-trigger\", classNames?.trigger)}\n >\n <span aria-hidden=\"true\">▾</span>\n </Base.Trigger>\n </div>\n </Base.InputGroup>\n <Base.Portal container={container ?? rootRef}>\n <Base.Positioner\n sideOffset={6}\n className={clsx(\"kb-multiselect-positioner\", classNames?.positioner)}\n >\n <Base.Popup className={clsx(\"kb-multiselect-popup\", classNames?.popup)}>\n <Base.List\n aria-labelledby={labelId}\n className={clsx(\"kb-multiselect-list\", classNames?.list)}\n >\n {(option: MultiSelectOption) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-multiselect-option\", classNames?.option)}\n >\n <Base.ItemIndicator\n keepMounted\n className={clsx(\n \"kb-multiselect-option-indicator\",\n classNames?.optionIndicator,\n )}\n >\n ✓\n </Base.ItemIndicator>\n <span className={clsx(\"kb-multiselect-option-label\", classNames?.optionLabel)}>\n {option.label}\n </span>\n </Base.Item>\n )}\n </Base.List>\n <Base.Empty className={clsx(\"kb-multiselect-empty\", classNames?.empty)}>\n {emptyMessage}\n </Base.Empty>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n {hasDescription && (\n <p id={descId} className={clsx(\"kb-multiselect-description\", classNames?.description)}>\n {description}\n </p>\n )}\n {hasError && (\n <p id={errId} className={clsx(\"kb-multiselect-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n </Base.Root>\n );\n});\n","import { Combobox as Base } from \"@base-ui/react/combobox\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nimport { MultiSelect, type MultiSelectProps } from \"../MultiSelect/MultiSelect\";\n\n/** Single selectable option in a Combobox list. */\nexport interface ComboboxOption {\n /** Option value committed to `onValueChange`. */\n value: string;\n /** Visible option label used for display and filtering. */\n label: string;\n /** Prevent selecting this option while keeping it visible. */\n disabled?: boolean;\n}\n\n/** Styleable inner anatomy slots of Combobox. */\nexport type ComboboxSlot =\n | \"label\"\n | \"shell\"\n | \"input\"\n | \"actions\"\n | \"clear\"\n | \"trigger\"\n | \"positioner\"\n | \"popup\"\n | \"list\"\n | \"option\"\n | \"optionIndicator\"\n | \"optionLabel\"\n | \"empty\"\n | \"description\"\n | \"error\";\n\n/** Props for the searchable single-select Combobox component. */\nexport interface ComboboxProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"defaultValue\" | \"onChange\"> {\n /** Choose one option; omit for single selection. */\n multiple?: false | undefined;\n /** Visible label naming the combobox input. */\n label: string;\n /** Selectable options shown and filtered in the popup list. */\n options: readonly ComboboxOption[];\n /** Selected option value, or `null` when nothing is selected. */\n value: string | null;\n /** Called when the user selects or clears an option. */\n onValueChange: (value: string | null) => void;\n /** Placeholder text shown when the input is empty. */\n placeholder?: string;\n /** Message announced and shown when no options match the query. */\n emptyMessage?: ReactNode;\n /** Control height and typography scale. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Supporting helper text linked through `aria-describedby`. */\n description?: ReactNode;\n /** Validation error message; marks the control invalid when truthy. */\n error?: ReactNode;\n /** Mark the control invalid without an error message. */\n invalid?: boolean;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Allow focus and inspection while preventing value changes. */\n readOnly?: boolean;\n /** Require a selection for form validation. */\n required?: boolean;\n /** Form field name for native form submission. */\n name?: string;\n /** Controlled popup open state. */\n open?: boolean;\n /** Initial popup open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the popup opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Controlled search query text inside the input. */\n inputValue?: string;\n /** Called when the search query text changes. */\n onInputValueChange?: (inputValue: string) => void;\n /** Accessible name for the clear button (defaults to `\"Clear {label}\"`). */\n clearLabel?: string;\n /** Accessible name for the popup toggle button (defaults to `\"Toggle {label} options\"`). */\n toggleLabel?: string;\n /** Portal host; defaults to field root to retain nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Extra classes for inner parts, keyed by slot name. */\n classNames?: ClassNames<ComboboxSlot>;\n}\n\n/** Multiple-choice combobox props; shares MultiSelect behavior and styling. */\nexport interface ComboboxMultipleProps extends MultiSelectProps {\n /** Enable multiple selections with removable chips. */\n multiple: true;\n}\n\n/** Explicit single-selection props; preserves existing ComboboxProps contract. */\nexport type ComboboxSingleProps = ComboboxProps;\n\ntype ComboboxSelectionProps = ComboboxProps | ComboboxMultipleProps;\n\n/** Searchable single or multiple selection with removable values. */\nexport const Combobox = forwardRef<HTMLInputElement, ComboboxSelectionProps>(\n function Combobox(props, ref) {\n if (props.multiple) {\n const { multiple: _, ...rest } = props;\n return <MultiSelect {...rest} ref={ref} />;\n }\n return <SingleCombobox {...props} ref={ref} />;\n },\n);\n\nconst SingleCombobox = forwardRef<HTMLInputElement, ComboboxSingleProps>(function SingleCombobox(\n {\n label,\n options,\n value,\n onValueChange,\n placeholder,\n emptyMessage = \"No matching options\",\n size = \"md\",\n description,\n error,\n invalid,\n disabled = false,\n readOnly = false,\n required = false,\n name,\n open,\n defaultOpen,\n onOpenChange,\n inputValue,\n onInputValueChange,\n clearLabel,\n toggleLabel,\n container,\n className,\n classNames,\n id,\n multiple: _,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...rest\n },\n ref,\n) {\n const uid = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputId = id ?? `${uid}-input`;\n const labelId = `${uid}-label`;\n const descId = `${uid}-desc`;\n const errId = `${uid}-err`;\n const hasError = Boolean(error);\n const { invalid: isInvalid, ariaInvalid } = resolveInvalid(\n Boolean(invalid) || hasError,\n callerAriaInvalid,\n );\n const hasDescription = Boolean(description);\n const describedBy =\n [hasDescription ? descId : null, hasError ? errId : null, ariaDescribedBy]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const collection = useMemo(\n () => Base.createItems(options, { getValue: (o) => o.value, getLabel: (o) => o.label }),\n [options],\n );\n\n const validValue = useMemo(\n () => (value !== null && options.some((o) => o.value === value) ? value : null),\n [value, options],\n );\n\n return (\n <Base.Root<string, false, ComboboxOption>\n items={collection}\n value={validValue}\n onValueChange={(next) => {\n if (disabled || readOnly) return;\n onValueChange(next ?? null);\n }}\n inputValue={inputValue}\n onInputValueChange={(next) => {\n onInputValueChange?.(next);\n }}\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next) => {\n onOpenChange?.(next);\n }}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n >\n <div\n {...rest}\n ref={rootRef}\n {...kb(\n \"combobox\",\n {\n size,\n invalid: isInvalid,\n disabled,\n readonly: readOnly,\n required,\n },\n className,\n )}\n >\n <label\n id={labelId}\n htmlFor={inputId}\n className={clsx(\"kb-combobox-label\", classNames?.label)}\n >\n {label}\n </label>\n <Base.InputGroup\n aria-labelledby={labelId}\n className={clsx(\"kb-combobox-shell\", classNames?.shell)}\n >\n <Base.Input\n ref={ref}\n id={inputId}\n placeholder={placeholder}\n aria-labelledby={labelId}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-combobox-input\", classNames?.input)}\n />\n <div className={clsx(\"kb-combobox-actions\", classNames?.actions)}>\n <Base.Clear\n aria-label={clearLabel ?? `Clear ${label}`}\n disabled={disabled || readOnly}\n className={clsx(\"kb-combobox-clear\", classNames?.clear)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.Clear>\n <Base.Trigger\n aria-label={toggleLabel ?? `Toggle ${label} options`}\n disabled={disabled}\n className={clsx(\"kb-combobox-trigger\", classNames?.trigger)}\n >\n <span aria-hidden=\"true\">▾</span>\n </Base.Trigger>\n </div>\n </Base.InputGroup>\n <Base.Portal container={container ?? rootRef}>\n <Base.Positioner\n sideOffset={6}\n className={clsx(\"kb-combobox-positioner\", classNames?.positioner)}\n >\n <Base.Popup className={clsx(\"kb-combobox-popup\", classNames?.popup)}>\n <Base.List\n aria-labelledby={labelId}\n className={clsx(\"kb-combobox-list\", classNames?.list)}\n >\n {(option: ComboboxOption) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-combobox-option\", classNames?.option)}\n >\n <Base.ItemIndicator\n keepMounted\n className={clsx(\"kb-combobox-option-indicator\", classNames?.optionIndicator)}\n >\n ✓\n </Base.ItemIndicator>\n <span className={clsx(\"kb-combobox-option-label\", classNames?.optionLabel)}>\n {option.label}\n </span>\n </Base.Item>\n )}\n </Base.List>\n <Base.Empty className={clsx(\"kb-combobox-empty\", classNames?.empty)}>\n {emptyMessage}\n </Base.Empty>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n {hasDescription && (\n <p id={descId} className={clsx(\"kb-combobox-description\", classNames?.description)}>\n {description}\n </p>\n )}\n {hasError && (\n <p id={errId} className={clsx(\"kb-combobox-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n </Base.Root>\n );\n});\n","import { createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutElementProps } from \"../../utils/layout\";\n\nexport type ContainerElement =\n | \"div\"\n | \"main\"\n | \"section\"\n | \"article\"\n | \"aside\"\n | \"header\"\n | \"footer\";\nexport type ContainerSize = \"sm\" | \"md\" | \"lg\" | \"full\";\nexport type ContainerProps<T extends ContainerElement = \"div\"> = LayoutElementProps<T> & {\n /** Maximum outer width, including gutters. */\n size?: ContainerSize;\n /** Shared responsive gutters; disable when the parent owns padding. */\n gutter?: boolean;\n};\n\nexport function Container<T extends ContainerElement = \"div\">({\n as,\n size = \"lg\",\n gutter = true,\n className,\n ...props\n}: ContainerProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n \"data-gutter\": undefined,\n ...kb(\"container\", { size, gutter: gutter ? undefined : \"none\" }, className),\n });\n}\n","import {\n type ComponentProps,\n type ComponentType,\n createContext,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type LinkProps = ComponentProps<\"a\"> & {\n /** Navigation destination; use Button for actions. */\n href: string;\n};\n\n/** Router adapter contract: render an anchor with href; pass other props and ref through. */\nexport type LinkComponent = \"a\" | ComponentType<LinkProps>;\n\nconst LinkComponentContext = createContext<LinkComponent>(\"a\");\n\nexport type LinkProviderProps = {\n /** Renders every kbui anchor below it; adapt your router's link here. */\n component: LinkComponent;\n children?: ReactNode;\n};\n\nfunction LinkProvider({ component, children }: LinkProviderProps) {\n return (\n <LinkComponentContext.Provider value={component}>{children}</LinkComponentContext.Provider>\n );\n}\n\nexport function useLinkComponent(): LinkComponent {\n return useContext(LinkComponentContext);\n}\n\nfunction LinkRoot({ className, ...props }: LinkProps) {\n const Anchor = useLinkComponent();\n return <Anchor {...props} {...kb(\"link\", {}, className)} />;\n}\n\nexport const Link = Object.assign(LinkRoot, { Provider: LinkProvider });\n","import { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type CodeLanguage, tokenizeCode } from \"../Code/tokenize\";\nimport { Link } from \"../Link/Link\";\n\ntype Range = { start: number; end: number };\ntype WebLink = Range & { href: string };\ntype ContentOptions = {\n highlight?: string | readonly string[] | undefined;\n linkify: boolean;\n detectCode: boolean;\n codeLanguage?: CodeLanguage | undefined;\n codeClassName?: string | undefined;\n highlightClassName?: string | undefined;\n linkClassName?: string | undefined;\n};\n\nfunction highlightRanges(value: string, highlight: ContentOptions[\"highlight\"]): Range[] {\n const terms = (typeof highlight === \"string\" ? [highlight] : (highlight ?? [])).filter(Boolean);\n const ranges: Range[] = [];\n let cursor = 0;\n while (cursor < value.length) {\n let next: Range | undefined;\n for (const term of terms) {\n const start = value.indexOf(term, cursor);\n if (start < 0) continue;\n const end = start + term.length;\n if (!next || start < next.start || (start === next.start && end > next.end)) {\n next = { start, end };\n }\n }\n if (!next) break;\n ranges.push(next);\n cursor = next.end;\n }\n return ranges;\n}\n\nfunction webLinks(value: string): WebLink[] {\n const links: WebLink[] = [];\n for (const match of value.matchAll(\n /(?:https?:\\/\\/|www\\.)[^\\s<>\"'`\\p{Cc}\\u2018\\u2019\\u201c\\u201d]+/giu,\n )) {\n if (/[a-z0-9@_.-]/i.test(value[match.index - 1] ?? \"\")) continue;\n let href = match[0];\n // Keep balanced URL delimiters; leave sentence punctuation outside anchor.\n while (href) {\n const last = href.at(-1) ?? \"\";\n const opener = ({ \")\": \"(\", \"]\": \"[\", \"}\": \"{\" } as Record<string, string>)[last];\n if (\n /[.,!?;:]/.test(last) ||\n (opener && href.split(last).length > href.split(opener).length)\n ) {\n href = href.slice(0, -1);\n } else break;\n }\n try {\n const url = new URL(/^www\\./i.test(href) ? `https://${href}` : href);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") continue;\n links.push({\n start: match.index,\n end: match.index + href.length,\n href: /^www\\./i.test(href) ? `https://${href}` : href,\n });\n } catch {\n // Invalid web candidates remain literal text.\n }\n }\n for (const match of value.matchAll(\n /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+/giu,\n )) {\n const start = match.index;\n const end = start + match[0].length;\n if (/[a-z0-9.!#$%&'*+/=?^_`{|}~@-]/i.test(value[start - 1] ?? \"\")) continue;\n if (links.some((link) => start < link.end && end > link.start)) continue;\n links.push({\n start,\n end,\n href: `mailto:${encodeURIComponent(match[0]).replaceAll(\"%40\", \"@\")}`,\n });\n }\n return links.sort((a, b) => a.start - b.start);\n}\n\nconst CODE_LANGUAGES: Record<string, CodeLanguage> = {\n ts: \"ts\",\n tsx: \"tsx\",\n typescript: \"ts\",\n js: \"js\",\n jsx: \"jsx\",\n javascript: \"js\",\n json: \"json\",\n css: \"css\",\n html: \"html\",\n sh: \"bash\",\n bash: \"bash\",\n shell: \"bash\",\n text: \"plain\",\n plain: \"plain\",\n};\n\nexport function detectCopyableLanguage(value: string): CodeLanguage | undefined {\n const source = value.trim();\n const fence = /^```([^\\s`]*)[^\\S\\r\\n]*\\r?\\n[\\s\\S]*\\r?\\n```$/.exec(source);\n if (fence) {\n const language = fence[1]?.toLowerCase() ?? \"\";\n return Object.hasOwn(CODE_LANGUAGES, language) ? CODE_LANGUAGES[language] : \"plain\";\n }\n if (/^[{[]/.test(source)) {\n try {\n JSON.parse(source);\n return \"json\";\n } catch {\n /* Continue with conservative source patterns. */\n }\n }\n if (\n /^(?:(?:export\\s+(?:default\\s+)?)?(?:const|let|var)\\s+[\\w$]+\\s*[:=]|(?:export\\s+)?(?:async\\s+)?function\\s+[\\w$]+\\s*\\(|(?:export\\s+)?(?:class|interface|enum)\\s+\\w+|(?:export\\s+)?type\\s+\\w+\\s*=|import\\s+(?:.+\\s+from\\s+[\"']|[\"']))/.test(\n source,\n )\n )\n return \"ts\";\n if (/^<(?:[A-Z][\\w.]*)[\\s/>]/.test(source)) return \"tsx\";\n if (/^<(?:!doctype\\s+html|[a-z][\\w-]*(?:\\s[^<>]*)?)[\\s/>]/i.test(source)) return \"html\";\n if (\n /^(?:(?:\\$\\s+)?(?:bun|npm|pnpm|yarn)\\s+(?:add|install|run|test|exec|dlx|build)\\b|(?:\\$\\s+)?git\\s+(?:status|diff|log|add|commit|push|pull|fetch|checkout|switch|clone)\\b|(?:\\$\\s+)?curl\\s+(?:-|https?:\\/\\/))/.test(\n source,\n )\n )\n return \"bash\";\n if (/^(?:[.#@][\\w-]|[a-z][\\w-]*[\\s:#.])[\\s\\S]*\\{\\s*[\\w-]+\\s*:/i.test(source)) return \"css\";\n return undefined;\n}\n\nexport function renderCopyableContent(value: string, options: ContentOptions): ReactNode {\n const highlights = highlightRanges(value, options.highlight);\n if (!options.linkify && !options.detectCode && !options.codeLanguage && highlights.length === 0)\n return value;\n const text = (start: number, end: number): ReactNode => {\n if (start >= end) return null;\n const nodes: ReactNode[] = [];\n let cursor = start;\n for (const range of highlights) {\n if (range.end <= start) continue;\n if (range.start >= end) break;\n const from = Math.max(cursor, range.start);\n const to = Math.min(end, range.end);\n if (from > cursor) nodes.push(value.slice(cursor, from));\n nodes.push(\n <mark key={from} className={clsx(\"kb-copyabletext-highlight\", options.highlightClassName)}>\n {value.slice(from, to)}\n </mark>,\n );\n cursor = to;\n }\n if (cursor < end) nodes.push(value.slice(cursor, end));\n return nodes;\n };\n const code = (start: number, end: number, language: CodeLanguage): ReactNode => {\n let from = start;\n let to = end;\n const source = value.slice(start, end);\n if (source.trim().startsWith(\"```\") && source.includes(\"\\n\")) {\n from = start + source.indexOf(\"\\n\") + 1;\n to = start + source.lastIndexOf(\"```\");\n } else if (source.startsWith(\"`\") && source.endsWith(\"`\")) {\n from += 1;\n to -= 1;\n }\n const nodes: ReactNode[] = [text(start, from)];\n let cursor = from;\n for (const [tokenStart, tokenEnd, kind] of tokenizeCode(value.slice(from, to), language)) {\n const begin = from + tokenStart;\n const finish = from + tokenEnd;\n if (begin > cursor) nodes.push(text(cursor, begin));\n nodes.push(\n <span key={begin} data-syntax={kind}>\n {text(begin, finish)}\n </span>,\n );\n cursor = finish;\n }\n nodes.push(text(cursor, end));\n return (\n <code\n key={`code-${start}`}\n className={clsx(\"kb-code\", \"kb-copyabletext-code\", options.codeClassName)}\n data-language={language}\n >\n {nodes}\n </code>\n );\n };\n if (options.codeLanguage) return code(0, value.length, options.codeLanguage);\n const codeRanges = options.detectCode\n ? [...value.matchAll(/`([^`\\r\\n]+)`/g)].map((match) => ({\n start: match.index,\n end: match.index + match[0].length,\n }))\n : [];\n const links = options.linkify\n ? webLinks(value).filter(\n (link) => !codeRanges.some((range) => link.start < range.end && link.end > range.start),\n )\n : [];\n const ranges = [\n ...codeRanges.map((range) => ({ ...range, kind: \"code\" as const })),\n ...links.map((link) => ({ ...link, kind: \"link\" as const })),\n ].sort((a, b) => a.start - b.start);\n const nodes: ReactNode[] = [];\n let cursor = 0;\n for (const range of ranges) {\n nodes.push(text(cursor, range.start));\n if (range.kind === \"code\") {\n nodes.push(\n code(\n range.start,\n range.end,\n detectCopyableLanguage(value.slice(range.start + 1, range.end - 1)) ?? \"plain\",\n ),\n );\n } else {\n nodes.push(\n <Link\n key={range.start}\n href={range.href}\n className={clsx(\"kb-copyabletext-link\", options.linkClassName)}\n >\n {text(range.start, range.end)}\n </Link>,\n );\n }\n cursor = range.end;\n }\n nodes.push(text(cursor, value.length));\n return nodes;\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useEffect, useId, useState } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { type CopyFeedbackProps, useClipboard } from \"../../utils/useClipboard\";\nimport type { CodeLanguage } from \"../Code/tokenize\";\nimport { detectCopyableLanguage, renderCopyableContent } from \"./content\";\n\nexport type CopyableTextPart =\n | \"label\"\n | \"value\"\n | \"actions\"\n | \"toggle\"\n | \"copy\"\n | \"feedback\"\n | \"link\"\n | \"highlight\"\n | \"code\";\nexport type CopyableTextFormat = \"auto\" | \"text\" | \"code\";\nexport type CopyableTextTone = \"neutral\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type CopyableTextProps = Omit<ComponentProps<\"span\">, \"onCopy\"> &\n CopyFeedbackProps & {\n /** Exact clipboard value; display formatting never changes copied bytes. */\n value: string;\n /** Optional visible context above value. */\n label?: string | undefined;\n /** Bordered field or inline text with adjacent copy action. */\n appearance?: \"field\" | \"plain\" | undefined;\n /** Content and copy target density. */\n size?: \"sm\" | \"md\" | undefined;\n /** Monospace display for identifiers, paths, and commands. */\n mono?: boolean | undefined;\n /** Value color and subtle field tint; independent of clipboard state. */\n tone?: CopyableTextTone | undefined;\n /** Single-line preview with explicit full-value disclosure. */\n truncate?: boolean | undefined;\n /** Collapsed disclosure button text. */\n expandLabel?: string | undefined;\n /** Expanded disclosure button text. */\n collapseLabel?: string | undefined;\n /** Case-sensitive literal terms to emphasize; longer matches win overlaps. */\n highlight?: string | readonly string[] | undefined;\n /** Automatic recognition, literal text, or explicit source code. */\n format?: CopyableTextFormat | undefined;\n /** Code language hint; forces code in automatic mode. */\n language?: CodeLanguage | undefined;\n /** Override automatic web/email links when full content is visible. */\n linkify?: boolean | undefined;\n /** Extra classes for each rendered part. */\n classNames?: ClassNames<CopyableTextPart> | undefined;\n };\n\nexport function CopyableText({\n value,\n label,\n appearance = \"field\",\n size = \"md\",\n mono = true,\n tone = \"neutral\",\n truncate = false,\n expandLabel = \"Show full value\",\n collapseLabel = \"Show less\",\n highlight,\n linkify,\n format = \"auto\",\n language,\n copyLabel = \"Copy\",\n copyingLabel = \"Copying…\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Retry copy\",\n successMessage = \"Copied to clipboard\",\n errorMessage = \"Copy failed. Select and copy the text manually.\",\n disabled,\n feedbackDuration,\n onCopy,\n onCopyError,\n className,\n classNames,\n children,\n ...props\n}: CopyableTextProps) {\n const valueId = useId();\n const codeLanguage =\n format === \"text\"\n ? undefined\n : (language ?? (format === \"code\" ? \"tsx\" : detectCopyableLanguage(value)));\n const [disclosure, setDisclosure] = useState({ value, open: false });\n const expanded = truncate && disclosure.value === value && disclosure.open;\n useEffect(() => setDisclosure({ value, open: false }), [value]);\n const clipboard = useClipboard(value, {\n disabled,\n feedbackDuration,\n onCopy,\n onCopyError: (error) => {\n setDisclosure({ value, open: true });\n onCopyError?.(error);\n },\n });\n const buttonLabel = {\n idle: copyLabel,\n pending: copyingLabel,\n copied: copiedLabel,\n failed: copyErrorLabel,\n }[clipboard.state];\n return (\n <span\n {...props}\n {...kb(\n \"copyabletext\",\n {\n appearance,\n format: codeLanguage ? \"code\" : \"text\",\n size,\n mono,\n tone,\n expandable: truncate,\n expanded,\n truncate: truncate && !expanded,\n disabled: clipboard.disabled,\n \"copy-state\": clipboard.state,\n },\n className,\n )}\n >\n {label ? (\n <span className={clsx(\"kb-copyabletext-label\", classNames?.label)}>{label}</span>\n ) : null}\n <span className={clsx(\"kb-copyabletext-value\", classNames?.value)} id={valueId}>\n {children != null && !expanded && clipboard.state !== \"failed\"\n ? children\n : renderCopyableContent(value, {\n highlight,\n linkify: (linkify ?? format !== \"text\") && (!truncate || expanded),\n detectCode: format !== \"text\",\n codeLanguage,\n codeClassName: classNames?.code,\n highlightClassName: classNames?.highlight,\n linkClassName: classNames?.link,\n })}\n </span>\n <span className={clsx(\"kb-copyabletext-actions\", classNames?.actions)}>\n {truncate ? (\n <button\n type=\"button\"\n className={clsx(\"kb-copyabletext-toggle\", classNames?.toggle)}\n aria-expanded={expanded}\n aria-controls={valueId}\n onClick={() => setDisclosure({ value, open: !expanded })}\n >\n {expanded ? collapseLabel : expandLabel}\n </button>\n ) : null}\n <button\n type=\"button\"\n className={clsx(\"kb-copyabletext-copy\", classNames?.copy)}\n disabled={clipboard.disabled}\n aria-disabled={clipboard.state === \"pending\" || undefined}\n onClick={() => void clipboard.copy()}\n >\n {buttonLabel}\n </button>\n </span>\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(\n \"kb-copyabletext-feedback\",\n clipboard.state !== \"failed\" && \"kb-sr-only\",\n classNames?.feedback,\n )}\n >\n {clipboard.state === \"copied\"\n ? successMessage\n : clipboard.state === \"failed\"\n ? errorMessage\n : clipboard.state === \"pending\"\n ? copyingLabel\n : \"\"}\n </span>\n </span>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type DescriptionListProps = ComponentProps<\"dl\"> & {\n /** Responsive label/value columns, always horizontal, or always stacked. */\n layout?: \"responsive\" | \"horizontal\" | \"stacked\" | undefined;\n density?: \"comfortable\" | \"dense\" | undefined;\n dividers?: boolean | undefined;\n};\nfunction DescriptionListRoot({\n layout = \"responsive\",\n density = \"comfortable\",\n dividers = true,\n className,\n ...props\n}: DescriptionListProps) {\n return <dl {...props} {...kb(\"descriptionlist\", { layout, density, dividers }, className)} />;\n}\nexport type DescriptionListItemProps = ComponentProps<\"div\">;\nfunction DescriptionListItem({ className, ...props }: DescriptionListItemProps) {\n return <div {...props} {...kb(\"descriptionlist-item\", {}, className)} />;\n}\nexport type DescriptionListTermProps = ComponentProps<\"dt\">;\nfunction DescriptionListTerm({ className, ...props }: DescriptionListTermProps) {\n return <dt {...props} {...kb(\"descriptionlist-term\", {}, className)} />;\n}\nexport type DescriptionListDetailProps = ComponentProps<\"dd\">;\nfunction DescriptionListDetail({ className, ...props }: DescriptionListDetailProps) {\n return <dd {...props} {...kb(\"descriptionlist-detail\", {}, className)} />;\n}\nexport const DescriptionList = Object.assign(DescriptionListRoot, {\n Item: DescriptionListItem,\n Term: DescriptionListTerm,\n Detail: DescriptionListDetail,\n});\n","import { Dialog as Base } from \"@base-ui/react/dialog\";\nimport { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport type { ClassNames } from \"../../utils/kb\";\n\nexport type DialogProps = Base.Root.Props;\nexport type DialogTriggerProps = Base.Trigger.Props;\nexport type DialogCloseProps = Base.Close.Props;\nexport type DialogTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type DialogDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type DialogActionsProps = ComponentProps<\"div\">;\nexport type DialogSectionProps = ComponentProps<\"div\">;\n\nexport type DialogContentProps = Omit<Base.Popup.Props, \"className\" | \"title\"> & {\n /** Centered dialog or inline-end drawer with independently scrolling Body. */\n layout?: \"center\" | \"drawer\";\n /** Accessible name; mutually exclusive with a composed Dialog.Title. */\n title?: ReactNode;\n /** Accessible description; mutually exclusive with a composed Dialog.Description. */\n description?: ReactNode;\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Portal target; defaults to document.body. */\n container?: Base.Portal.Props[\"container\"];\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"backdrop\">;\n};\n\nfunction DialogRoot(props: DialogProps) {\n return <Base.Root {...props} />;\n}\n\nfunction DialogTrigger(props: DialogTriggerProps) {\n return <Base.Trigger {...props} />;\n}\n\nfunction DialogClose(props: DialogCloseProps) {\n return <Base.Close {...props} />;\n}\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return <Base.Title {...props} className={clsx(\"kb-dialog-title\", className)} />;\n}\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return <Base.Description {...props} className={clsx(\"kb-dialog-description\", className)} />;\n}\n\nfunction DialogActions({ className, ...props }: DialogActionsProps) {\n return <div {...props} className={clsx(\"kb-dialog-actions\", className)} />;\n}\n\nfunction DialogHeader({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-header\", className)} />;\n}\nfunction DialogBody({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-body\", className)} />;\n}\nfunction DialogFooter({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-footer\", className)} />;\n}\n\nfunction DialogContent({\n layout = \"center\",\n classNames,\n title,\n description,\n container,\n children,\n className,\n ...props\n}: DialogContentProps) {\n const hasTitle = title != null && title !== \"\";\n const hasDescription = description != null && description !== \"\";\n const heading = (\n <>\n {hasTitle ? <DialogTitle>{title}</DialogTitle> : null}\n {hasDescription ? <DialogDescription>{description}</DialogDescription> : null}\n </>\n );\n return (\n <Base.Portal container={container}>\n <Base.Backdrop className={clsx(\"kb-dialog-backdrop\", classNames?.backdrop)} />\n <Base.Popup {...props} data-layout={layout} className={clsx(\"kb-dialog-popup\", className)}>\n {layout === \"drawer\" && (hasTitle || hasDescription) ? (\n <DialogHeader>{heading}</DialogHeader>\n ) : (\n heading\n )}\n {children}\n </Base.Popup>\n </Base.Portal>\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Actions: DialogActions,\n Header: DialogHeader,\n Body: DialogBody,\n Footer: DialogFooter,\n});\n","import { Collapsible as Base } from \"@base-ui/react/collapsible\";\nimport { CollapsiblePanel } from \"../../utils/CollapsiblePanel\";\nimport { kb } from \"../../utils/kb\";\n\nexport type DisclosureProps = Omit<Base.Root.Props, \"className\"> & {\n /** Plain class string on root. */\n className?: string | undefined;\n};\nexport type DisclosureTriggerProps = Omit<Base.Trigger.Props, \"className\"> & {\n /** Plain class string on trigger. */\n className?: string | undefined;\n};\nexport type DisclosurePanelProps = Omit<Base.Panel.Props, \"className\"> & {\n /** Plain class string on panel. */\n className?: string | undefined;\n};\n\nfunction DisclosureRoot({ className, ...props }: DisclosureProps) {\n return <Base.Root {...props} {...kb(\"disclosure\", {}, className)} />;\n}\nfunction DisclosureTrigger({ className, ...props }: DisclosureTriggerProps) {\n return <Base.Trigger {...props} {...kb(\"disclosure-trigger\", {}, className)} />;\n}\nfunction DisclosurePanel({ className, children, render, ...props }: DisclosurePanelProps) {\n return (\n <Base.Panel\n {...props}\n {...kb(\"disclosure-panel\", {}, className)}\n render={(nativeProps, state) => (\n <CollapsiblePanel nativeProps={nativeProps} state={state} render={render} />\n )}\n >\n <div className=\"kb-disclosure-panel-content\">{children}</div>\n </Base.Panel>\n );\n}\n\nexport const Disclosure = Object.assign(DisclosureRoot, {\n Trigger: DisclosureTrigger,\n Panel: DisclosurePanel,\n});\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type EmptyStateSize = \"sm\" | \"md\" | \"lg\";\nexport type EmptyStateVariant = \"surface\" | \"subtle\" | \"plain\";\nexport type EmptyStateTone = \"neutral\" | \"info\" | \"warning\" | \"danger\";\nexport type EmptyStateHeadingLevel = 2 | 3 | 4;\n\nexport type EmptyStateProps = Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Primary heading explaining why the region is empty or unavailable. */\n title: ReactNode;\n /** Supporting guidance explaining what appears here or how to proceed. */\n description?: ReactNode;\n /** Short category or state label above the title. */\n eyebrow?: ReactNode;\n /** Decorative glyph or emblem rendered above the header. */\n icon?: ReactNode;\n /** Primary and secondary recovery or creation controls. */\n actions?: ReactNode;\n /** Quiet metadata or secondary link below the actions. */\n footer?: ReactNode;\n /** Document outline rank for the title heading (`2`–`4`). */\n headingLevel?: EmptyStateHeadingLevel;\n size?: EmptyStateSize;\n variant?: EmptyStateVariant;\n tone?: EmptyStateTone;\n /** Announces dynamic empty or recoverable failure updates via `role=\"status\"`. */\n live?: boolean;\n classNames?: ClassNames<\n \"icon\" | \"header\" | \"eyebrow\" | \"title\" | \"description\" | \"body\" | \"actions\" | \"footer\"\n >;\n};\n\nconst headingTags = {\n 2: \"h2\",\n 3: \"h3\",\n 4: \"h4\",\n} as const;\n\n/** Structured placeholder for empty collections, zero-match filters, and recoverable section errors. */\nexport function EmptyState({\n title,\n description,\n eyebrow,\n icon,\n actions,\n footer,\n headingLevel = 3,\n size = \"md\",\n variant = \"surface\",\n tone = \"neutral\",\n live = false,\n className,\n classNames,\n children,\n ...rest\n}: EmptyStateProps) {\n const HeadingTag = headingTags[headingLevel];\n\n return (\n <div\n {...rest}\n {...(live ? { role: \"status\" } : {})}\n {...kb(\"emptystate\", { size, variant, tone }, className)}\n >\n {icon != null ? (\n <span className={clsx(\"kb-emptystate-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <div className={clsx(\"kb-emptystate-header\", classNames?.header)}>\n {eyebrow != null ? (\n <p className={clsx(\"kb-emptystate-eyebrow\", classNames?.eyebrow)}>{eyebrow}</p>\n ) : null}\n <HeadingTag className={clsx(\"kb-emptystate-title\", classNames?.title)}>{title}</HeadingTag>\n {description != null ? (\n <p className={clsx(\"kb-emptystate-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n </div>\n {children != null ? (\n <div className={clsx(\"kb-emptystate-body\", classNames?.body)}>{children}</div>\n ) : null}\n {actions != null ? (\n <div className={clsx(\"kb-emptystate-actions\", classNames?.actions)}>{actions}</div>\n ) : null}\n {footer != null ? (\n <div className={clsx(\"kb-emptystate-footer\", classNames?.footer)}>{footer}</div>\n ) : null}\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type MouseEvent, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ErrorSummaryHeadingLevel = 2 | 3 | 4;\nexport type ErrorSummaryPart = \"title\" | \"description\" | \"list\" | \"item\" | \"link\";\n\nexport interface ErrorSummaryItem {\n /** Optional key when multiple items point to the same href. */\n id?: string | undefined;\n /** Anchor fragment such as \"#email\" targeting the invalid field or group. */\n href: string;\n /** Actionable message naming the field and how to fix it. */\n label: ReactNode;\n}\n\nexport interface ErrorSummaryProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n /** Summary heading displayed above the error list. */\n title?: ReactNode | undefined;\n /** Optional guidance shown between the heading and list. */\n description?: ReactNode | undefined;\n /** Ordered field errors with fragment links for focus recovery. */\n items: readonly ErrorSummaryItem[];\n /** Document heading rank for the summary title. */\n headingLevel?: ErrorSummaryHeadingLevel | undefined;\n /** Callback fired when a recovery link is activated. */\n onItemSelect?: ((href: string, event: MouseEvent<HTMLAnchorElement>) => void) | undefined;\n /** Classes for the title, description, list, item and link slots. */\n classNames?: ClassNames<ErrorSummaryPart> | undefined;\n}\n\nconst FOCUSABLE_CHILD_SELECTOR = [\n \"input:not(:disabled):not([type='hidden']):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"textarea:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"select:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"button:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"[tabindex]:not([tabindex='-1']):not(:disabled):not([hidden]):not([aria-hidden='true']):not([aria-disabled='true'])\",\n].join(\", \");\n\nfunction focusTargetByHref(doc: Document, href: string): boolean {\n if (!href.startsWith(\"#\") || href.length < 2) return false;\n const rawId = href.slice(1);\n let targetId = rawId;\n try {\n targetId = decodeURIComponent(rawId);\n } catch {\n targetId = rawId;\n }\n const element = doc.getElementById(targetId);\n if (!element) return false;\n\n const focusTarget = element.matches(FOCUSABLE_CHILD_SELECTOR)\n ? element\n : (element.querySelector<HTMLElement>(FOCUSABLE_CHILD_SELECTOR) ??\n (element.hasAttribute(\"tabindex\") && !element.matches(\":disabled\") && !element.hidden\n ? element\n : null));\n if (!focusTarget) return false;\n\n focusTarget.focus();\n focusTarget.scrollIntoView?.({ block: \"nearest\" });\n return true;\n}\n\n/** Focusable form-level validation alert that links each error to its field. */\nexport const ErrorSummary = ({\n ref,\n title = \"There is a problem\",\n description,\n items,\n headingLevel = 2,\n onItemSelect,\n tabIndex = -1,\n className,\n classNames,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...props\n}: ErrorSummaryProps) => {\n const reactId = useId();\n if (items.length === 0) return null;\n\n const baseId = props.id ?? `kb-errorsummary-${reactId}`;\n const titleId = `${baseId}-title`;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const labelledBy = ariaLabelledBy ?? titleId;\n const describedBy = [descriptionId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n const HeadingTag = `h${headingLevel}` as const;\n const seenKeys = new Map<string, number>();\n\n return (\n <div\n {...props}\n ref={ref}\n role=\"alert\"\n tabIndex={tabIndex}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n {...kb(\"errorsummary\", {}, className)}\n >\n <HeadingTag id={titleId} className={clsx(\"kb-errorsummary-title\", classNames?.title)}>\n {title}\n </HeadingTag>\n {description ? (\n <p\n id={descriptionId}\n className={clsx(\"kb-errorsummary-description\", classNames?.description)}\n >\n {description}\n </p>\n ) : null}\n <ul className={clsx(\"kb-errorsummary-list\", classNames?.list)}>\n {items.map((item) => {\n const baseKey =\n item.id ??\n `${item.href}:${typeof item.label === \"string\" || typeof item.label === \"number\" ? item.label : \"\"}`;\n const occurrence = (seenKeys.get(baseKey) ?? 0) + 1;\n seenKeys.set(baseKey, occurrence);\n const itemKey = occurrence === 1 ? baseKey : `${baseKey}:${occurrence}`;\n return (\n <li key={itemKey} className={clsx(\"kb-errorsummary-item\", classNames?.item)}>\n <a\n href={item.href}\n className={clsx(\"kb-errorsummary-link\", classNames?.link)}\n onClick={(event) => {\n onItemSelect?.(item.href, event);\n if (event.defaultPrevented) return;\n if (focusTargetByHref(event.currentTarget.ownerDocument, item.href)) {\n event.preventDefault();\n }\n }}\n >\n {item.label}\n </a>\n </li>\n );\n })}\n </ul>\n </div>\n );\n};\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type FieldsetPart = \"legend\" | \"description\" | \"fields\" | \"error\";\n\nexport interface FieldsetProps extends ComponentProps<\"fieldset\"> {\n /** Group heading rendered inside the native legend element. */\n legend: ReactNode;\n /** Hide the legend visually while keeping the accessible group name. */\n visuallyHidden?: boolean | undefined;\n /** Supporting context explaining the grouped fields. */\n description?: ReactNode | undefined;\n /** Group-level validation error message. */\n error?: ReactNode | undefined;\n /** Classes for the legend, description, fields and error slots. */\n classNames?: ClassNames<FieldsetPart> | undefined;\n}\n\n/** Semantic fieldset and legend section that groups related form controls. */\nexport const Fieldset = ({\n ref,\n legend,\n visuallyHidden,\n description,\n error,\n disabled,\n className,\n classNames,\n children,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: FieldsetProps) => {\n const reactId = useId();\n const baseId = props.id ?? `kb-fieldset-${reactId}`;\n const hasError = Boolean(error);\n const { invalid, ariaInvalid } = resolveInvalid(hasError, callerAriaInvalid);\n const descriptionId = description ? `${baseId}-description` : undefined;\n const errorId = hasError ? `${baseId}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n\n return (\n <fieldset\n {...props}\n ref={ref}\n disabled={disabled}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n {...kb(\"fieldset\", { disabled: Boolean(disabled), invalid }, className)}\n >\n <legend\n className={clsx(\"kb-fieldset-legend\", visuallyHidden && \"kb-sr-only\", classNames?.legend)}\n >\n {legend}\n </legend>\n {description ? (\n <p id={descriptionId} className={clsx(\"kb-fieldset-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n <div className={clsx(\"kb-fieldset-fields\", classNames?.fields)}>{children}</div>\n {hasError ? (\n <div id={errorId} className={clsx(\"kb-fieldset-error\", classNames?.error)}>\n {error}\n </div>\n ) : null}\n </fieldset>\n );\n};\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type ReactNode,\n type Ref,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nimport { Button } from \"../Button/Button\";\n\nexport type FileInputItem = {\n /** Stable unique identity independent of display name. */\n id: string;\n /** Visible filename and default accessible removal name. */\n name: string;\n /** Caller-owned metadata such as size or processing status. */\n description?: ReactNode;\n};\nexport type FileInputProps = Omit<\n ComponentProps<\"div\">,\n \"onChange\" | \"children\" | \"defaultValue\"\n> & {\n /** Accessible field label. */\n label: string;\n /** Retained items; caller owns acceptance and list updates. */\n items: readonly FileInputItem[];\n /** Receives original native File objects without policy filtering. */\n onFiles: (files: File[]) => void;\n /** Requests removal; focus moves only after items change. */\n onRemove: (id: string) => void;\n /** Native picker hint; callers must validate selected files. */\n accept?: string;\n /** Allow multiple selections; defaults to true. */\n multiple?: boolean;\n /** Block selection, removal and mutation callbacks. */\n disabled?: boolean;\n /** Keep retained items readable while blocking changes. */\n readOnly?: boolean;\n /** Helper text associated with picker action. */\n description?: string;\n /** Caller-owned rejection/error text; announced when shown. */\n error?: string;\n /** Hide field label visually while retaining accessible name. */\n visuallyHidden?: boolean;\n /** Localized picker action; defaults to Choose files. */\n chooseLabel?: string;\n /** Localized empty list message. */\n emptyMessage?: string;\n /** Localized accessible remove action for an item. */\n removeLabel?: (item: FileInputItem) => string;\n /** Localized announcement after controlled removal succeeds. */\n removedMessage?: (item: FileInputItem) => string;\n /** Localized native selection announcement; does not imply acceptance. */\n selectionMessage?: (count: number) => string;\n /** Custom item content; retain visible file identity. */\n renderItem?: (item: FileInputItem) => ReactNode;\n /** Class on picker action. */\n triggerClassName?: string;\n /** Class on retained-item list. */\n listClassName?: string;\n /** Class on each retained item. */\n itemClassName?: string;\n /** Ref to native hidden file input. */\n inputRef?: Ref<HTMLInputElement>;\n /** Ref to accessible picker button. */\n triggerRef?: Ref<HTMLButtonElement>;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n | \"label\"\n | \"trigger\"\n | \"list\"\n | \"item\"\n | \"native\"\n | \"description\"\n | \"error\"\n | \"content\"\n | \"name\"\n | \"metadata\"\n | \"remove\"\n | \"empty\"\n >;\n};\nconst defaultRemoveLabel = (item: FileInputItem) => `Remove ${item.name}`;\nconst defaultRemovedMessage = (item: FileInputItem) => `${item.name} removed.`;\nconst defaultSelectionMessage = (count: number) =>\n `${count} ${count === 1 ? \"file\" : \"files\"} selected.`;\n\nexport function FileInput({\n classNames,\n label,\n items,\n onFiles,\n onRemove,\n accept,\n multiple = true,\n disabled = false,\n readOnly = false,\n description,\n error,\n visuallyHidden,\n chooseLabel = \"Choose files\",\n emptyMessage = \"No files added.\",\n removeLabel = defaultRemoveLabel,\n removedMessage = defaultRemovedMessage,\n selectionMessage = defaultSelectionMessage,\n renderItem,\n triggerClassName,\n listClassName,\n itemClassName,\n inputRef,\n triggerRef,\n className,\n onBlurCapture,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: FileInputProps) {\n const id = useId();\n const input = useRef<HTMLInputElement>(null);\n const trigger = useRef<HTMLButtonElement>(null);\n const removeButtons = useRef(new Map<string, HTMLButtonElement>());\n const pending = useRef<{ item: FileInputItem; index: number; button: HTMLButtonElement } | null>(\n null,\n );\n const [announcement, setAnnouncement] = useState(\"\");\n useImperativeHandle(inputRef, () => input.current as HTMLInputElement);\n useImperativeHandle(triggerRef, () => trigger.current as HTMLButtonElement);\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const blocked = disabled || readOnly;\n const described =\n [description ? `${id}-description` : null, error ? `${id}-error` : null, callerDescription]\n .filter(Boolean)\n .join(\" \") || undefined;\n useLayoutEffect(() => {\n const request = pending.current;\n if (!request || items.some((item) => item.id === request.item.id)) return;\n pending.current = null;\n const active = request.button.ownerDocument.activeElement;\n if (!blocked && (active === request.button.ownerDocument.body || active === request.button)) {\n const next = items[Math.min(request.index, items.length - 1)];\n (next ? removeButtons.current.get(next.id) : trigger.current)?.focus();\n }\n setAnnouncement(removedMessage(request.item));\n }, [items, blocked, removedMessage]);\n return (\n <div\n {...props}\n {...kb(\"fileinput\", { disabled, readonly: readOnly, invalid }, className)}\n onBlurCapture={(event) => {\n if (\n pending.current?.button.isSameNode(event.target) &&\n event.relatedTarget !== pending.current.button\n )\n pending.current = null;\n onBlurCapture?.(event);\n }}\n >\n <span\n id={`${id}-label`}\n className={clsx(\"kb-fileinput-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </span>\n <input\n ref={input}\n type=\"file\"\n hidden\n className={clsx(\"kb-fileinput-native\", classNames?.native)}\n accept={accept}\n multiple={multiple}\n disabled={blocked}\n onChange={(event) => {\n const control = event.currentTarget;\n try {\n const files = Array.from(control.files ?? []);\n if (!blocked && files.length) {\n onFiles(files);\n setAnnouncement(selectionMessage(files.length));\n }\n } finally {\n control.value = \"\";\n }\n }}\n />\n <Button\n ref={trigger}\n type=\"button\"\n size=\"lg\"\n variant=\"secondary\"\n disabled={blocked}\n aria-labelledby={`${id}-label ${id}-action`}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n className={clsx(\"kb-fileinput-trigger\", classNames?.trigger, triggerClassName)}\n onClick={() => {\n if (!blocked) input.current?.click();\n }}\n >\n <span id={`${id}-action`}>{chooseLabel}</span>\n </Button>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-fileinput-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p\n id={`${id}-error`}\n className={clsx(\"kb-fileinput-error\", classNames?.error)}\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {items.length ? (\n <ul\n className={clsx(\"kb-fileinput-list\", classNames?.list, listClassName)}\n aria-labelledby={`${id}-label`}\n >\n {items.map((item, index) => (\n <li\n className={clsx(\"kb-fileinput-item\", classNames?.item, itemClassName)}\n key={item.id}\n >\n <div className={clsx(\"kb-fileinput-content\", classNames?.content)}>\n {renderItem ? (\n renderItem(item)\n ) : (\n <>\n <span className={clsx(\"kb-fileinput-name\", classNames?.name)}>{item.name}</span>\n {item.description && (\n <span className={clsx(\"kb-fileinput-metadata\", classNames?.metadata)}>\n {item.description}\n </span>\n )}\n </>\n )}\n </div>\n <Button\n ref={(node) => {\n if (node) removeButtons.current.set(item.id, node);\n else removeButtons.current.delete(item.id);\n }}\n type=\"button\"\n size=\"lg\"\n variant=\"ghost\"\n disabled={blocked}\n className={clsx(\"kb-fileinput-remove\", classNames?.remove)}\n aria-label={removeLabel(item)}\n onClick={(event) => {\n if (blocked) return;\n if (event.currentTarget === event.currentTarget.ownerDocument.activeElement)\n pending.current = { item, index, button: event.currentTarget };\n onRemove(item.id);\n }}\n >\n <span aria-hidden=\"true\">×</span>\n </Button>\n </li>\n ))}\n </ul>\n ) : (\n <p className={clsx(\"kb-fileinput-empty\", classNames?.empty)}>{emptyMessage}</p>\n )}\n <p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" className=\"kb-sr-only\">\n {announcement}\n </p>\n </div>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type FormActionsAlign = \"end\" | \"start\" | \"between\";\n\nexport interface FormActionsProps extends ComponentProps<\"div\"> {\n /** Horizontal alignment for form action buttons. */\n align?: FormActionsAlign | undefined;\n /** Add a top border and spacing above the action row. */\n divider?: boolean | undefined;\n}\n\n/** Wrapping action footer for form submit, reset and secondary buttons. */\nexport const FormActions = ({\n ref,\n align = \"end\",\n divider = false,\n className,\n children,\n ...props\n}: FormActionsProps) => (\n <div {...props} ref={ref} {...kb(\"formactions\", { align, divider }, className)}>\n {children}\n </div>\n);\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutGap } from \"../../utils/layout\";\n\nexport type GridElement = \"div\" | \"ul\" | \"ol\";\nexport type GridLayout = \"auto\" | \"stack\";\nexport type GridColumns = \"auto\" | 1 | 2 | 3 | 4;\nexport type GridMinItemWidth = \"sm\" | \"md\" | \"lg\";\nexport type GridProps<T extends GridElement = \"div\"> = ComponentProps<T> & {\n /** Native container; list children must be list items. */\n as?: T | undefined;\n /** Responsive equal columns or a single vertical track. */\n layout?: GridLayout | undefined;\n /** Explicit column count or automatic wrapping columns. */\n columns?: GridColumns | undefined;\n /** Minimum column width before automatic columns wrap. */\n minItemWidth?: GridMinItemWidth | undefined;\n /** Space between columns and stacked rows. */\n gap?: LayoutGap | undefined;\n /** Cross-axis alignment within each grid row. */\n align?: LayoutAlign | undefined;\n};\n\nexport function Grid<T extends GridElement = \"div\">({\n as,\n layout = \"auto\",\n columns,\n minItemWidth,\n gap,\n align,\n className,\n ...props\n}: GridProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n ...kb(\n \"grid\",\n {\n layout,\n columns: columns === undefined ? undefined : String(columns),\n \"min-item-width\": minItemWidth,\n gap,\n align,\n },\n className,\n ),\n });\n}\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\nexport type HeadingSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"display\";\nexport type HeadingProps = ComponentProps<\"h2\"> & {\n /** Native heading rank; follow document hierarchy. */\n level?: HeadingLevel;\n /** Visual size, independent of rank; defaults from level. */\n size?: HeadingSize;\n};\n\nconst sizes: Record<HeadingLevel, HeadingSize> = {\n 1: \"xl\",\n 2: \"lg\",\n 3: \"md\",\n 4: \"sm\",\n 5: \"sm\",\n 6: \"sm\",\n};\n\nexport function Heading({ level = 2, size = sizes[level], className, ...props }: HeadingProps) {\n return createElement(`h${level}`, { ...props, ...kb(\"heading\", { size }, className) });\n}\n","import { createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutElementProps, LayoutGap } from \"../../utils/layout\";\n\nexport type InlineElement = \"div\" | \"ul\" | \"ol\" | \"nav\";\nexport type InlineJustify = \"start\" | \"center\" | \"end\" | \"between\";\nexport type InlineProps<T extends InlineElement = \"div\"> = LayoutElementProps<T> & {\n /** Space between items and wrapped rows. */\n gap?: LayoutGap;\n /** Cross-axis alignment within each row. */\n align?: LayoutAlign;\n /** Main-axis distribution within each row. */\n justify?: InlineJustify;\n};\n\nexport function Inline<T extends InlineElement = \"div\">({\n as,\n gap = \"md\",\n align = \"center\",\n justify = \"start\",\n className,\n ...props\n}: InlineProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n ...kb(\"inline\", { gap, align, justify }, className),\n });\n}\n","import { Menu as Base } from \"@base-ui/react/menu\";\nimport { Separator } from \"@base-ui/react/separator\";\nimport { clsx } from \"clsx\";\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\nconst PointerFocus = createContext(false);\n\nexport type MenuProps = Base.Root.Props;\nexport type MenuTriggerProps = Base.Trigger.Props;\nexport type MenuItemProps = Omit<Base.Item.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type MenuSeparatorProps = Omit<Separator.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type MenuContentProps = Omit<Base.Popup.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Portal target; pass the consumer theme host for nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Side of the trigger the popup prefers. */\n side?: Base.Positioner.Props[\"side\"];\n /** Alignment along that side. */\n align?: Base.Positioner.Props[\"align\"];\n};\n\nfunction MenuRoot({ onOpenChange, ...props }: MenuProps) {\n const [pointerFocus, setPointerFocus] = useState(false);\n useEffect(() => {\n if (!pointerFocus) return;\n const keyboard = () => setPointerFocus(false);\n document.addEventListener(\"keydown\", keyboard, { capture: true, once: true });\n return () => document.removeEventListener(\"keydown\", keyboard, true);\n }, [pointerFocus]);\n return (\n <PointerFocus.Provider value={pointerFocus}>\n <Base.Root\n {...props}\n onOpenChange={(open, details) => {\n const event = details.event;\n setPointerFocus(\n /^(pointer|mouse|touch|click)/.test(event.type) &&\n !(event.type === \"click\" && \"detail\" in event && event.detail === 0),\n );\n onOpenChange?.(open, details);\n }}\n />\n </PointerFocus.Provider>\n );\n}\n\nfunction MenuTrigger(props: MenuTriggerProps) {\n const pointerFocus = useContext(PointerFocus);\n return (\n <Base.Trigger\n {...props}\n data-kb-menu-trigger=\"\"\n data-pointer-focus={pointerFocus || undefined}\n />\n );\n}\n\nfunction MenuContent({\n side = \"bottom\",\n align = \"start\",\n className,\n container,\n ...props\n}: MenuContentProps) {\n return (\n <Base.Portal container={container}>\n <Base.Positioner side={side} align={align} sideOffset={6}>\n <Base.Popup {...props} className={clsx(\"kb-menu\", className)} />\n </Base.Positioner>\n </Base.Portal>\n );\n}\n\nfunction MenuItem({ className, ...props }: MenuItemProps) {\n return <Base.Item {...props} className={clsx(\"kb-menu-item\", className)} />;\n}\n\nfunction MenuSeparator({ className, ...props }: MenuSeparatorProps) {\n return <Separator {...props} className={clsx(\"kb-menu-separator\", className)} />;\n}\n\nexport const Menu = Object.assign(MenuRoot, {\n Trigger: MenuTrigger,\n Content: MenuContent,\n Item: MenuItem,\n Separator: MenuSeparator,\n});\n","import { NumberField as Base } from \"@base-ui/react/number-field\";\nimport { clsx } from \"clsx\";\nimport { type ComponentProps, type Ref, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type NumberFieldSize = \"sm\" | \"md\" | \"lg\";\nexport type NumberFieldProps = Omit<\n ComponentProps<\"div\">,\n \"onChange\" | \"children\" | \"defaultValue\"\n> & {\n /** Accessible label for the numeric input. */\n label: string;\n /** Controlled number; null represents an empty field. */\n value: number | null;\n /** Receives numeric edits and null on clearing. */\n onValueChange: (value: number | null) => void;\n /** Lower stepping bound; typed drafts remain visible outside it. */\n min?: number;\n /** Upper stepping bound; typed drafts remain visible outside it. */\n max?: number;\n /** Step for buttons and arrows; defaults to one. */\n step?: number;\n /** Locale for numeric editing and display. */\n locale?: Intl.LocalesArgument;\n /** Native form field name. */\n name?: string;\n /** External native form identifier. */\n form?: string;\n /** Require a value for native form validation. */\n required?: boolean;\n /** Disable editing, stepping and form submission. */\n disabled?: boolean;\n /** Preserve value while blocking edits and stepping. */\n readOnly?: boolean;\n /** Keep label accessible while hiding it visually. */\n visuallyHidden?: boolean;\n /** Help associated with the visible input. */\n description?: string;\n /** Invalid message; callers own business validation. */\n error?: string;\n /** Control height; defaults to md. */\n size?: NumberFieldSize;\n /** Class on the visible numeric input. */\n inputClassName?: string;\n /** Class on the group containing the input and steppers. */\n groupClassName?: string;\n /** Ref to the visible input; root ref targets the outer div. */\n inputRef?: Ref<HTMLInputElement>;\n /** Native input extensions; value and behavior remain controlled. */\n inputProps?: Omit<\n Base.Input.Props,\n | \"className\"\n | \"render\"\n | \"value\"\n | \"defaultValue\"\n | \"onChange\"\n | \"id\"\n | \"ref\"\n | \"type\"\n | \"disabled\"\n | \"readOnly\"\n | \"required\"\n | \"name\"\n >;\n /** Localized decrement action; defaults to Decrease plus label. */\n decrementLabel?: string;\n /** Localized increment action; defaults to Increase plus label. */\n incrementLabel?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"label\" | \"group\" | \"input\" | \"editor\" | \"decrement\" | \"increment\" | \"description\" | \"error\"\n >;\n};\n\nexport function NumberField({\n classNames,\n label,\n value,\n onValueChange,\n min,\n max,\n step = 1,\n locale,\n name,\n form,\n required,\n disabled = false,\n readOnly = false,\n visuallyHidden,\n description,\n error,\n size = \"md\",\n inputClassName,\n groupClassName,\n inputRef,\n inputProps,\n decrementLabel = `Decrease ${label}`,\n incrementLabel = `Increase ${label}`,\n className,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: NumberFieldProps) {\n const id = useId();\n const { invalid, ariaInvalid } = resolveInvalid(\n Boolean(error),\n inputProps?.[\"aria-invalid\"] ?? callerAriaInvalid,\n );\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n callerDescription,\n inputProps?.[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <div\n {...props}\n {...kb(\"numberfield\", { size, disabled, readonly: readOnly, invalid }, className)}\n >\n <label\n htmlFor={id}\n className={clsx(\"kb-numberfield-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n <Base.Root\n id={id}\n value={value}\n onValueChange={(next) => {\n if (!disabled && !readOnly) onValueChange(next);\n }}\n min={min}\n max={max}\n step={step}\n smallStep={step}\n largeStep={step * 10}\n locale={locale}\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n snapOnStep\n allowOutOfRange\n allowWheelScrub={false}\n className={clsx(\"kb-numberfield-editor\", classNames?.editor)}\n >\n <Base.Group className={clsx(\"kb-numberfield-group\", classNames?.group, groupClassName)}>\n <Base.Decrement\n aria-label={decrementLabel}\n className={clsx(\"kb-numberfield-decrement\", classNames?.decrement)}\n >\n −\n </Base.Decrement>\n <Base.Input\n {...inputProps}\n ref={inputRef}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n className={clsx(\"kb-numberfield-input\", classNames?.input, inputClassName)}\n />\n <Base.Increment\n aria-label={incrementLabel}\n className={clsx(\"kb-numberfield-increment\", classNames?.increment)}\n >\n +\n </Base.Increment>\n </Base.Group>\n </Base.Root>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-numberfield-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-numberfield-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { Collapsible } from \"@base-ui/react/collapsible\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n createContext,\n type KeyboardEvent,\n type PointerEvent,\n type Ref,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type PanelTone = \"quiet\" | \"default\" | \"sunken\" | \"active\" | \"critical\";\nexport type PanelRail = \"none\" | \"accent\" | \"status\";\nexport type PanelDensity = \"compact\" | \"standard\";\nexport type PanelGroupDirection = \"row\" | \"column\";\n\n/** Name the region with aria-labelledby pointing at the heading inside Panel.Header. */\nexport type PanelProps = ComponentProps<\"section\"> & {\n /** Plane weight: quiet has no seam, sunken recesses, active lifts, critical warns. */\n tone?: PanelTone;\n /** Inline-start rail: accent is always accent; status follows the tone. */\n rail?: PanelRail;\n /** Padding scale. */\n density?: PanelDensity;\n /** Makes Panel.Body collapse and expand from Panel.Toggle. */\n collapsible?: boolean;\n /** Controlled open state; collapsible only. */\n open?: boolean;\n /** Initial open state; collapsible only. */\n defaultOpen?: boolean;\n /** Called when the toggle changes the open state; collapsible only. */\n onOpenChange?: (open: boolean) => void;\n};\nexport type PanelHeaderProps = ComponentProps<\"header\">;\nexport type PanelToolbarProps = ComponentProps<\"div\">;\nexport type PanelBodyProps = ComponentProps<\"div\">;\nexport type PanelFooterProps = ComponentProps<\"footer\">;\nexport type PanelWellProps = ComponentProps<\"div\">;\nexport type PanelToggleProps = Omit<Collapsible.Trigger.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type PanelGroupProps = ComponentProps<\"div\"> & {\n /** Flow of the panels inside the group. */\n direction?: PanelGroupDirection;\n};\n/** Sizes the panel right before it; the panel after it takes the rest. Needs a name. */\nexport type PanelHandleProps = Omit<ComponentProps<\"div\">, \"children\" | \"role\"> & {\n /** Controlled size of the panel before the handle, in percent of the group. */\n size?: number;\n /** Initial size when uncontrolled, in percent. */\n defaultSize?: number;\n /** Smallest size in percent; Enter collapses to it. */\n min?: number;\n /** Largest size in percent. */\n max?: number;\n /** Arrow-key change in percent. */\n step?: number;\n /** Called with the next size after a key press or drag. */\n onSizeChange?: (size: number) => void;\n} & ({ \"aria-label\": string } | { \"aria-labelledby\": string });\n\nconst NestedContext = createContext(false);\nconst CollapsibleContext = createContext(false);\nconst DirectionContext = createContext<PanelGroupDirection>(\"column\");\n\nconst paneBefore = (handle: HTMLElement | null) =>\n handle?.previousElementSibling as HTMLElement | null | undefined;\n\nfunction PanelRoot({\n tone = \"default\",\n rail = \"none\",\n density = \"standard\",\n collapsible = false,\n open,\n defaultOpen,\n onOpenChange,\n className,\n children,\n ref,\n ...props\n}: PanelProps) {\n const nested = useContext(NestedContext);\n const attrs = kb(\"panel\", { tone, rail, density, nested, collapsible }, className);\n const content = (\n <NestedContext value={true}>\n <CollapsibleContext value={collapsible}>\n <span className=\"kb-panel-glow\" aria-hidden=\"true\" />\n <span className=\"kb-panel-plate\" aria-hidden=\"true\">\n {rail !== \"none\" ? <span className=\"kb-panel-rail\" /> : null}\n </span>\n {children}\n </CollapsibleContext>\n </NestedContext>\n );\n if (!collapsible) {\n return (\n <section {...props} ref={ref} {...attrs}>\n {content}\n </section>\n );\n }\n return (\n <Collapsible.Root\n {...props}\n // Base UI types the root as a div; render swaps in the section.\n ref={ref as Ref<HTMLDivElement>}\n {...(open !== undefined ? { open } : {})}\n {...(defaultOpen !== undefined ? { defaultOpen } : {})}\n {...(onOpenChange ? { onOpenChange: (next: boolean) => onOpenChange(next) } : {})}\n render={<section />}\n {...attrs}\n >\n {content}\n </Collapsible.Root>\n );\n}\n\nfunction PanelHeader({ className, ...props }: PanelHeaderProps) {\n return <header {...props} className={clsx(\"kb-panel-header\", className)} />;\n}\n\nfunction PanelToolbar({ className, ...props }: PanelToolbarProps) {\n return <div {...props} className={clsx(\"kb-panel-toolbar\", className)} />;\n}\n\nfunction PanelBody({ className, ...props }: PanelBodyProps) {\n const collapsible = useContext(CollapsibleContext);\n const merged = clsx(\"kb-panel-body\", className);\n if (collapsible) return <Collapsible.Panel {...props} className={merged} />;\n return <div {...props} className={merged} />;\n}\n\nfunction PanelFooter({ className, ...props }: PanelFooterProps) {\n return <footer {...props} className={clsx(\"kb-panel-footer\", className)} />;\n}\n\nfunction PanelWell({ className, ...props }: PanelWellProps) {\n return <div {...props} className={clsx(\"kb-panel-well\", className)} />;\n}\n\nfunction PanelToggle({ className, ...props }: PanelToggleProps) {\n return <Collapsible.Trigger {...props} className={clsx(\"kb-panel-toggle\", className)} />;\n}\n\nfunction PanelGroup({ direction = \"column\", className, ...props }: PanelGroupProps) {\n return (\n <DirectionContext value={direction}>\n <div {...props} {...kb(\"panel-group\", { direction }, className)} />\n </DirectionContext>\n );\n}\n\nfunction PanelHandle({\n size,\n defaultSize = 50,\n min = 10,\n max = 90,\n step = 5,\n onSizeChange,\n className,\n ref,\n onKeyDown,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n ...props\n}: PanelHandleProps) {\n const row = useContext(DirectionContext) === \"row\";\n const clamp = (value: number) => Math.min(max, Math.max(min, value));\n const [inner, setInner] = useState(defaultSize);\n const current = clamp(size ?? inner);\n const [controls, setControls] = useState<string>();\n const [dragging, setDragging] = useState(false);\n const restore = useRef(current);\n const node = useRef<HTMLDivElement | null>(null);\n const fallbackId = useId();\n\n useLayoutEffect(() => {\n const target = paneBefore(node.current);\n if (!target) return;\n target.id ||= fallbackId;\n setControls(target.id);\n }, [fallbackId]);\n\n useLayoutEffect(() => {\n paneBefore(node.current)?.style.setProperty(\"--kb-panel-size\", `${current}%`);\n }, [current]);\n\n const commit = (value: number) => {\n const next = clamp(value);\n if (next === current) return;\n if (size === undefined) setInner(next);\n onSizeChange?.(next);\n };\n\n const keys: Record<string, () => number> = {\n [row ? \"ArrowLeft\" : \"ArrowUp\"]: () => current - step,\n [row ? \"ArrowRight\" : \"ArrowDown\"]: () => current + step,\n Home: () => min,\n End: () => max,\n Enter: () => {\n if (current > min) {\n restore.current = current;\n return min;\n }\n return restore.current;\n },\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const next = keys[event.key];\n if (event.defaultPrevented || !next) return;\n event.preventDefault();\n commit(next());\n };\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0) return;\n event.preventDefault();\n event.currentTarget.setPointerCapture?.(event.pointerId);\n setDragging(true);\n };\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n onPointerMove?.(event);\n const group = node.current?.parentElement?.getBoundingClientRect();\n const start = paneBefore(node.current)?.getBoundingClientRect();\n if (!dragging || !group || !start) return;\n const offset = row ? event.clientX - start.left : event.clientY - start.top;\n const length = row ? group.width : group.height;\n // One decimal keeps drags smooth without leaking float noise into aria-valuenow.\n if (length > 0) commit(Math.round((offset / length) * 1000) / 10);\n };\n\n const endDrag = (event: PointerEvent<HTMLDivElement>) => {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n setDragging(false);\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a focusable splitter with a value cannot be an hr.\n <div\n {...props}\n ref={(element) => {\n node.current = element;\n if (typeof ref === \"function\") return ref(element);\n if (ref) ref.current = element;\n }}\n role=\"separator\"\n tabIndex={0}\n aria-orientation={row ? \"vertical\" : \"horizontal\"}\n aria-valuenow={current}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-controls={controls}\n onKeyDown={handleKeyDown}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={(event) => {\n onPointerUp?.(event);\n endDrag(event);\n }}\n onPointerCancel={(event) => {\n onPointerCancel?.(event);\n endDrag(event);\n }}\n {...kb(\"panel-handle\", { orientation: row ? \"vertical\" : \"horizontal\", dragging }, className)}\n />\n );\n}\n\nexport const Panel = Object.assign(PanelRoot, {\n Header: PanelHeader,\n Toolbar: PanelToolbar,\n Body: PanelBody,\n Footer: PanelFooter,\n Well: PanelWell,\n Toggle: PanelToggle,\n Group: PanelGroup,\n Handle: PanelHandle,\n});\n","import { Popover as Base } from \"@base-ui/react/popover\";\nimport { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type PopoverProps = Base.Root.Props;\nexport type PopoverTriggerProps = Base.Trigger.Props;\nexport type PopoverCloseProps = Base.Close.Props;\nexport type PopoverSectionProps = ComponentProps<\"div\">;\nexport type PopoverTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Plain class string on title. */\n className?: string | undefined;\n};\nexport type PopoverDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Plain class string on description. */\n className?: string | undefined;\n};\nexport type PopoverContentProps = Omit<Base.Popup.Props, \"className\" | \"title\"> & {\n /** Accessible name; omit when composing Popover.Title. */\n title?: ReactNode;\n /** Accessible description; omit when composing Popover.Description. */\n description?: ReactNode;\n /** Plain class string on popup. */\n className?: string | undefined;\n /** Portal target; pass nested theme host when needed. */\n container?: Base.Portal.Props[\"container\"];\n /** Preferred side; collision handling may flip it. */\n side?: Base.Positioner.Props[\"side\"];\n /** Alignment relative to trigger. */\n align?: Base.Positioner.Props[\"align\"];\n /** Gap between trigger and popup, in CSS pixels. */\n sideOffset?: Base.Positioner.Props[\"sideOffset\"];\n /** Advanced positioning, including collision boundary, padding and anchor. */\n positionerProps?:\n | Omit<Base.Positioner.Props, \"children\" | \"className\" | \"side\" | \"align\" | \"sideOffset\">\n | undefined;\n /** Classes for inner positioner. */\n classNames?: ClassNames<\"positioner\"> | undefined;\n};\n\nfunction PopoverRoot(props: PopoverProps) {\n return <Base.Root {...props} />;\n}\nfunction PopoverTrigger(props: PopoverTriggerProps) {\n return <Base.Trigger {...props} />;\n}\nfunction PopoverClose(props: PopoverCloseProps) {\n return <Base.Close {...props} />;\n}\nfunction PopoverTitle({ className, ...props }: PopoverTitleProps) {\n return <Base.Title {...props} {...kb(\"popover-title\", {}, className)} />;\n}\nfunction PopoverDescription({ className, ...props }: PopoverDescriptionProps) {\n return <Base.Description {...props} {...kb(\"popover-description\", {}, className)} />;\n}\nfunction PopoverHeader({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-header\", {}, className)} />;\n}\nfunction PopoverBody({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-body\", {}, className)} />;\n}\nfunction PopoverFooter({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-footer\", {}, className)} />;\n}\nfunction PopoverContent({\n title,\n description,\n container,\n side = \"bottom\",\n align = \"start\",\n sideOffset = 6,\n positionerProps,\n classNames,\n className,\n children,\n ...props\n}: PopoverContentProps) {\n const hasTitle = title != null && title !== \"\";\n const hasDescription = description != null && description !== \"\";\n return (\n <Base.Portal container={container}>\n <Base.Positioner\n {...positionerProps}\n side={side}\n align={align}\n sideOffset={sideOffset}\n className={clsx(\"kb-popover-positioner\", classNames?.positioner)}\n >\n <Base.Popup {...props} {...kb(\"popover\", {}, className)}>\n {hasTitle || hasDescription ? (\n <PopoverHeader>\n {hasTitle ? <PopoverTitle>{title}</PopoverTitle> : null}\n {hasDescription ? <PopoverDescription>{description}</PopoverDescription> : null}\n </PopoverHeader>\n ) : null}\n {children}\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n );\n}\n\nexport const Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Title: PopoverTitle,\n Description: PopoverDescription,\n Close: PopoverClose,\n Header: PopoverHeader,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n","import { Progress as Base } from \"@base-ui/react/progress\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\n/** Determinate progress with a visible label; valueText replaces the percent, e.g. \"3 of 5\". */\nexport type ProgressProps = Omit<Base.Root.Props, \"className\" | \"children\" | \"value\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Visible name of the progressbar. */\n label: ReactNode;\n /** Current value, from 0 to max. */\n value: number;\n /** Shown beside the label and announced instead of the percent. */\n valueText?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"head\" | \"label\" | \"value\" | \"track\" | \"indicator\">;\n};\n\nexport function Progress({\n classNames,\n label,\n value,\n valueText,\n className,\n ...props\n}: ProgressProps) {\n return (\n <Base.Root\n {...props}\n value={value}\n {...(valueText ? { getAriaValueText: () => valueText } : {})}\n {...kb(\"progress\", {}, className)}\n >\n <div className={clsx(\"kb-progress-head\", classNames?.head)}>\n <Base.Label className={clsx(\"kb-progress-label\", classNames?.label)}>{label}</Base.Label>\n <Base.Value className={clsx(\"kb-progress-value\", classNames?.value)}>\n {(formatted) => valueText ?? formatted}\n </Base.Value>\n </div>\n <Base.Track className={clsx(\"kb-progress-track\", classNames?.track)}>\n <Base.Indicator className={clsx(\"kb-progress-indicator\", classNames?.indicator)} />\n </Base.Track>\n </Base.Root>\n );\n}\n","import { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup as BaseGroup } from \"@base-ui/react/radio-group\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type RadioGroupProps = Omit<ComponentProps<\"div\">, \"onChange\" | \"defaultValue\"> & {\n /** Visible group label. */\n label: string;\n /** Controlled choice; null means none selected. */\n value: string | null;\n /** Receives the selected item's value. */\n onValueChange: (value: string) => void;\n /** Disable all items. */\n disabled?: boolean;\n /** Segmented visual treatment; native single-choice behavior stays shared. */\n appearance?: \"standard\" | \"segmented\";\n /** Segmented background movement; reduced motion always wins. */\n selectionMotion?: \"slide\" | \"none\";\n /** Segmented selection color. */\n selectionTone?: \"primary\" | \"neutral\";\n /** Native form field name. */\n name?: string;\n /** Helper text for group. */\n description?: string;\n /** Group error message. */\n error?: string;\n /** Keep group label accessible but visually hidden. */\n visuallyHidden?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"label\" | \"options\" | \"description\" | \"error\">;\n};\nexport type RadioGroupItemProps = Omit<\n Radio.Root.Props<string>,\n \"className\" | \"children\" | \"render\"\n> & {\n /** Plain class on item label. */\n className?: string;\n /** Caller content supplies meaningful item label. */\n children: ReactNode;\n /** Class on focusable radio slot. */\n controlClassName?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"item\" | \"control\" | \"indicator\" | \"content\">;\n};\ntype EntryData = { checked: boolean; eligible: boolean; tabIndex: number | undefined };\ntype EntryState = {\n target: string | null;\n update: (id: string, data: EntryData) => void;\n remove: (id: string) => void;\n markFocused: (id: string) => void;\n inside: boolean;\n};\nconst EntryContext = createContext<EntryState | null>(null);\n\ntype SelectionBounds = { x: number; y: number; width: number; height: number; disabled: boolean };\n\nfunction RadioOptions({\n segmented,\n className,\n children,\n}: {\n segmented: boolean;\n className: string | undefined;\n children: ReactNode;\n}) {\n const track = useRef<HTMLDivElement>(null);\n const [selection, setSelection] = useState<SelectionBounds | null>(null);\n useLayoutEffect(() => {\n const options = track.current;\n if (!options || !segmented) {\n setSelection(null);\n return;\n }\n const measure = () => {\n const control = options.querySelector<HTMLElement>(\".kb-radiogroup-control[data-checked]\");\n const item = control?.closest<HTMLLabelElement>(\".kb-radiogroup-item\");\n const next =\n item && item.offsetWidth > 0 && item.offsetHeight > 0\n ? {\n x: item.offsetLeft,\n y: item.offsetTop,\n width: item.offsetWidth,\n height: item.offsetHeight,\n disabled: control?.hasAttribute(\"data-disabled\") ?? false,\n }\n : null;\n setSelection((current) =>\n current?.x === next?.x &&\n current?.y === next?.y &&\n current?.width === next?.width &&\n current?.height === next?.height &&\n current?.disabled === next?.disabled\n ? current\n : next,\n );\n };\n const resize = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(measure);\n const observeItems = () => {\n resize?.disconnect();\n resize?.observe(options);\n for (const item of options.querySelectorAll(\".kb-radiogroup-item\")) resize?.observe(item);\n measure();\n };\n // Observe committed selection and layout; focus may move before owner accepts value.\n const changes = new MutationObserver(observeItems);\n changes.observe(options, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: [\"data-checked\", \"data-disabled\"],\n });\n observeItems();\n return () => {\n resize?.disconnect();\n changes.disconnect();\n };\n }, [segmented]);\n return (\n <div\n ref={track}\n className={clsx(\"kb-radiogroup-options\", className)}\n data-selection={segmented && selection ? \"\" : undefined}\n >\n {segmented && selection && (\n <span\n aria-hidden=\"true\"\n className=\"kb-radiogroup-selection\"\n data-disabled={selection.disabled ? \"\" : undefined}\n style={{\n width: selection.width,\n height: selection.height,\n transform: `translate(${selection.x}px, ${selection.y}px)`,\n }}\n />\n )}\n {children}\n </div>\n );\n}\n\nfunction RadioControl({\n checked,\n disabled,\n customTabIndex,\n ...props\n}: ComponentProps<\"span\"> & {\n checked: boolean;\n disabled: boolean;\n customTabIndex: number | undefined;\n}) {\n const entry = useContext(EntryContext);\n const update = entry?.update;\n const remove = entry?.remove;\n const id = useId();\n const eligible = !disabled && (customTabIndex === undefined || customTabIndex >= 0);\n useLayoutEffect(\n () => () => {\n remove?.(id);\n },\n [remove, id],\n );\n useLayoutEffect(() => {\n update?.(id, { checked, eligible, tabIndex: props.tabIndex });\n }, [update, id, checked, eligible, props.tabIndex]);\n // Entry follows selection; vendor retains arrow focus while user stays inside.\n const tabIndex = disabled\n ? -1\n : (customTabIndex ??\n (entry && !entry.inside && entry.target !== null\n ? entry.target === id\n ? 0\n : -1\n : props.tabIndex));\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: Base UI render props supply radio role.\n <span\n {...props}\n tabIndex={tabIndex}\n onFocus={(event) => {\n // Mark before handlers; caller may remove this control during focus.\n entry?.markFocused(id);\n props.onFocus?.(event);\n }}\n />\n );\n}\n\nfunction RadioGroupRoot({\n classNames,\n label,\n value,\n onValueChange,\n disabled = false,\n appearance = \"standard\",\n selectionMotion = \"slide\",\n selectionTone = \"primary\",\n name,\n description,\n error,\n visuallyHidden,\n className,\n children,\n onFocusCapture,\n onBlurCapture,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: RadioGroupProps) {\n const id = useId();\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const focused = useRef<string | null>(null);\n const [inside, setInside] = useState(false);\n const markFocused = useCallback((id: string) => {\n focused.current = id;\n }, []);\n const [entries, setEntries] = useState<Map<string, EntryData>>(() => new Map());\n const update = useCallback((id: string, data: EntryData) => {\n setEntries((current) => {\n const previous = current.get(id);\n if (\n previous &&\n previous.checked === data.checked &&\n previous.eligible === data.eligible &&\n previous.tabIndex === data.tabIndex\n )\n return current;\n return new Map(current).set(id, data);\n });\n }, []);\n const remove = useCallback((id: string) => {\n if (focused.current === id) {\n focused.current = null;\n setInside(false);\n }\n setEntries((current) => {\n if (!current.has(id)) return current;\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n const eligible = [...entries].filter(([, item]) => item.eligible);\n const target =\n (eligible.find(([, item]) => item.checked) ??\n eligible.find(([, item]) => item.tabIndex === 0) ??\n eligible[0])?.[0] ?? null;\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n props[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <EntryContext.Provider value={{ target, update, remove, markFocused, inside }}>\n <BaseGroup<string | null>\n {...props}\n value={value}\n onFocusCapture={(event) => {\n setInside(true);\n onFocusCapture?.(event);\n }}\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n focused.current = null;\n setInside(false);\n }\n onBlurCapture?.(event);\n }}\n onValueChange={(next) => {\n if (next !== null && !disabled) onValueChange(next);\n }}\n disabled={disabled}\n {...(name ? { name } : {})}\n {...kb(\n \"radiogroup\",\n {\n invalid,\n disabled,\n appearance,\n \"selection-motion\": selectionMotion,\n \"selection-tone\": selectionTone,\n },\n className,\n )}\n aria-labelledby={`${id}-label`}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n >\n <div\n className={clsx(\"kb-radiogroup-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n id={`${id}-label`}\n >\n {label}\n </div>\n <RadioOptions segmented={appearance === \"segmented\"} className={classNames?.options}>\n {children}\n </RadioOptions>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-radiogroup-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-radiogroup-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </BaseGroup>\n </EntryContext.Provider>\n );\n}\nfunction RadioGroupItem({\n classNames,\n className,\n children,\n controlClassName,\n ...props\n}: RadioGroupItemProps) {\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: Base UI Radio.Root renders its native input inside this label.\n <label className={clsx(\"kb-radiogroup-item\", classNames?.item, className)}>\n <Radio.Root\n {...props}\n className={clsx(\"kb-radiogroup-control\", classNames?.control, controlClassName)}\n render={(controlProps, state) => (\n <RadioControl\n {...controlProps}\n checked={state.checked}\n disabled={state.disabled}\n customTabIndex={props.tabIndex}\n />\n )}\n >\n <Radio.Indicator className={clsx(\"kb-radiogroup-indicator\", classNames?.indicator)} />\n </Radio.Root>\n <span className={clsx(\"kb-radiogroup-content\", classNames?.content)}>{children}</span>\n </label>\n );\n}\nexport const RadioGroup = Object.assign(RadioGroupRoot, { Item: RadioGroupItem });\n","import { ScrollArea as Base } from \"@base-ui/react/scroll-area\";\nimport { clsx } from \"clsx\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\n/** Scrolling region that keyboard users can reach: the viewport is a named, focusable region. */\nexport type ScrollAreaProps = Omit<Base.Root.Props, \"className\" | \"children\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Accessible name of the region. */\n label: string;\n /** Height cap, any CSS length; content scrolls past it. */\n maxHeight?: string;\n /** Scrolled content. */\n children: ReactNode;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"viewport\" | \"scrollbar\" | \"thumb\">;\n};\n\nexport function ScrollArea({\n classNames,\n label,\n maxHeight,\n className,\n style,\n children,\n ...props\n}: ScrollAreaProps) {\n const vars = maxHeight ? ({ \"--_scrollarea-max-height\": maxHeight } as CSSProperties) : {};\n return (\n <Base.Root\n {...props}\n style={{ ...vars, ...(typeof style === \"object\" ? style : {}) }}\n {...kb(\"scrollarea\", {}, className)}\n >\n <Base.Viewport\n className={clsx(\"kb-scrollarea-viewport\", classNames?.viewport)}\n tabIndex={0}\n role=\"region\"\n aria-label={label}\n >\n <Base.Content>{children}</Base.Content>\n </Base.Viewport>\n <Base.Scrollbar\n className={clsx(\"kb-scrollarea-scrollbar\", classNames?.scrollbar)}\n orientation=\"vertical\"\n >\n <Base.Thumb className={clsx(\"kb-scrollarea-thumb\", classNames?.thumb)} />\n </Base.Scrollbar>\n </Base.Root>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type SeparatorOrientation = \"horizontal\" | \"vertical\";\nexport type SeparatorProps = Omit<\n ComponentProps<\"hr\">,\n \"children\" | \"role\" | \"aria-hidden\" | \"aria-orientation\"\n> & {\n /** Direction of the visible rule and announced separator. */\n orientation?: SeparatorOrientation;\n /** Hide a visual-only divider from assistive technology. */\n decorative?: boolean;\n};\n\nexport function Separator({\n orientation = \"horizontal\",\n decorative = false,\n className,\n ...props\n}: SeparatorProps) {\n return (\n <hr\n {...props}\n {...kb(\"separator\", { orientation }, className)}\n role={decorative ? \"none\" : undefined}\n aria-hidden={decorative ? true : undefined}\n aria-orientation={decorative ? undefined : orientation}\n />\n );\n}\n","import { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SkeletonVariant = \"text\" | \"rect\" | \"circle\" | \"pill\";\nexport type SkeletonSize = \"sm\" | \"md\" | \"lg\";\nexport type SkeletonAnimation = \"shimmer\" | \"pulse\" | \"wave\" | \"none\";\nexport type SkeletonTone = \"default\" | \"subtle\" | \"accent\";\nexport type SkeletonPart = \"root\" | \"line\" | \"content\";\n\nexport interface SkeletonProps extends ComponentPropsWithoutRef<\"div\"> {\n /** Shape preset for the placeholder geometry. */\n variant?: SkeletonVariant | undefined;\n /** Size preset controlling line height or avatar diameter. */\n size?: SkeletonSize | undefined;\n /** Number of stacked placeholder lines when `variant=\"text\"`. */\n lines?: number | undefined;\n /** Enable motion on placeholder shapes; set `false` for static placeholders. */\n animated?: boolean | undefined;\n /** Motion choreography (`shimmer` diagonal sweep, `pulse` breathing opacity, `wave` staggered cascade, or `none`). */\n animation?: SkeletonAnimation | undefined;\n /** Surface color treatment (`default` surface, `subtle` recessed tint, or `accent` warm synthesis tint). */\n tone?: SkeletonTone | undefined;\n /** Whether content is still loading; when `false`, renders `children` inside `.kb-skeleton-content`. */\n loading?: boolean | undefined;\n /** Optional explicit inline size (`px` number or CSS length string). */\n width?: number | string | undefined;\n /** Optional explicit block size (`px` number or CSS length string). */\n height?: number | string | undefined;\n /** Loaded content revealed when `loading` is `false`. */\n children?: ReactNode | undefined;\n /** Custom class names for internal component slots. */\n classNames?: ClassNames<SkeletonPart> | undefined;\n}\n\nfunction toDimension(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? `${value}px` : value;\n}\n\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(function Skeleton(\n {\n variant = \"text\",\n size = \"md\",\n lines = 1,\n animated = true,\n animation = \"shimmer\",\n tone = \"default\",\n loading = true,\n width,\n height,\n style,\n className,\n classNames,\n children,\n ...props\n },\n ref,\n) {\n const count = variant === \"text\" ? Math.max(1, Math.trunc(lines)) : 1;\n const inlineSize = toDimension(width);\n const blockSize = toDimension(height);\n const isAnimated = animated && animation !== \"none\";\n const rootStyle: CSSProperties | undefined =\n inlineSize !== undefined ? { ...style, inlineSize } : style;\n const lineStyle: CSSProperties | undefined = blockSize !== undefined ? { blockSize } : undefined;\n const lineIndices = Array.from({ length: count }, (_, idx) => idx);\n\n return (\n <div\n ref={ref}\n aria-hidden={loading ? \"true\" : undefined}\n style={rootStyle}\n {...props}\n {...kb(\n \"skeleton\",\n {\n variant,\n size,\n tone,\n animation: isAnimated ? animation : false,\n animated: isAnimated,\n loaded: !loading,\n },\n classNames?.root ?? className,\n )}\n >\n {loading ? (\n lineIndices.map((lineNumber) => (\n <span\n key={`line-${lineNumber}`}\n style={lineStyle}\n className={clsx(\"kb-skeleton-line\", classNames?.line)}\n />\n ))\n ) : (\n <div className={clsx(\"kb-skeleton-content\", classNames?.content)}>{children}</div>\n )}\n </div>\n );\n});\n","import { clsx } from \"clsx\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SpinnerSize = \"sm\" | \"md\" | \"lg\";\nexport type SpinnerTone =\n | \"current\"\n | \"accent\"\n | \"neutral\"\n | \"info\"\n | \"success\"\n | \"warning\"\n | \"danger\";\nexport type SpinnerVariant = \"ring\" | \"orbit\" | \"dots\" | \"bars\";\nexport type SpinnerAppearance = \"plain\" | \"pill\";\nexport type SpinnerPart = \"root\" | \"icon\" | \"track\" | \"arc\" | \"core\" | \"dot\" | \"bar\" | \"label\";\n\nexport interface SpinnerProps extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> {\n /** Accessible status label announced by assistive technology and optionally shown beside the indicator. */\n label?: string | undefined;\n /** Render the label visibly beside the spinner instead of visually hidden. */\n showLabel?: boolean | undefined;\n /** Mark spinner as purely decorative (`aria-hidden=\"true\"`, no status role) when a parent control already owns busy semantics. */\n decorative?: boolean | undefined;\n /** Visual size token preset. */\n size?: SpinnerSize | undefined;\n /** Semantic color tone; use `current` inside buttons or badges to inherit text color. */\n tone?: SpinnerTone | undefined;\n /** Indicator geometry and motion style. */\n variant?: SpinnerVariant | undefined;\n /** Container framing; `pill` wraps the indicator and label in a tinted status pill. */\n appearance?: SpinnerAppearance | undefined;\n /** Custom class names for internal component slots. */\n classNames?: ClassNames<SpinnerPart> | undefined;\n}\n\nconst DOT_CX = [5, 12, 19] as const;\nconst BAR_X = [3.5, 8.25, 13, 17.75] as const;\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n {\n label = \"Loading\",\n showLabel = false,\n decorative = false,\n size = \"md\",\n tone = \"accent\",\n variant = \"ring\",\n appearance = \"plain\",\n className,\n classNames,\n ...props\n },\n ref,\n) {\n return (\n <span\n ref={ref}\n role={decorative ? undefined : \"status\"}\n aria-live={decorative ? undefined : \"polite\"}\n aria-hidden={decorative ? \"true\" : undefined}\n {...props}\n {...kb(\n \"spinner\",\n { size, tone, variant, appearance, \"show-label\": showLabel },\n classNames?.root ?? className,\n )}\n >\n <svg\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n focusable=\"false\"\n className={clsx(\"kb-spinner-icon\", classNames?.icon)}\n >\n {variant === \"ring\" && (\n <>\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <path\n d=\"M12 2.5a9.5 9.5 0 0 1 9.5 9.5\"\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n </>\n )}\n {variant === \"orbit\" && (\n <>\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"5.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <path\n d=\"M12 2.5a9.5 9.5 0 0 1 9.5 9.5\"\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n <path\n d=\"M12 17.5a5.5 5.5 0 0 1 -5.5 -5.5\"\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"1.75\"\n className={clsx(\"kb-spinner-core\", classNames?.core)}\n />\n </>\n )}\n {variant === \"dots\" &&\n DOT_CX.map((cxPos) => (\n <circle\n key={cxPos}\n cx={cxPos}\n cy=\"12\"\n r=\"2.25\"\n className={clsx(\"kb-spinner-dot\", classNames?.dot)}\n />\n ))}\n {variant === \"bars\" &&\n BAR_X.map((xPos) => (\n <rect\n key={xPos}\n x={xPos}\n y=\"5\"\n width=\"2.5\"\n height=\"14\"\n rx=\"1.25\"\n className={clsx(\"kb-spinner-bar\", classNames?.bar)}\n />\n ))}\n </svg>\n {!decorative && (\n <span className={clsx(\"kb-spinner-label\", !showLabel && \"kb-sr-only\", classNames?.label)}>\n {label}\n </span>\n )}\n </span>\n );\n});\n","import { clsx } from \"clsx\";\nimport { Children, createElement } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutElementProps, LayoutGap } from \"../../utils/layout\";\n\nexport type SplitElement = \"div\" | \"section\" | \"article\";\nexport type SplitRatio = \"equal\" | \"wide-start\" | \"wide-end\";\nexport type SplitCollapse = \"sm\" | \"md\" | \"lg\";\nexport type SplitProps<T extends SplitElement = \"div\"> = LayoutElementProps<T> & {\n /** Classes for each layout-owned column track. */\n classNames?: ClassNames<\"track\">;\n /** Column proportions: 1:1, 2:1 or 1:2 in source order. */\n ratio?: SplitRatio;\n /** Available-width threshold below which columns stack. */\n collapse?: SplitCollapse;\n /** Space between columns or stacked rows. */\n gap?: LayoutGap;\n /** Cross-axis alignment while columns share a row. */\n align?: LayoutAlign;\n};\n\nexport function Split<T extends SplitElement = \"div\">({\n as,\n ratio = \"equal\",\n collapse = \"md\",\n gap = \"md\",\n align = \"stretch\",\n className,\n classNames,\n children,\n ...props\n}: SplitProps<T>) {\n const trackClassName = clsx(\"kb-split-track\", classNames?.track);\n return createElement(\n as ?? \"div\",\n { ...props, ...kb(\"split\", { ratio, collapse, gap, align }, className) },\n Children.map(children, (child) =>\n child == null ? null : <div className={trackClassName}>{child}</div>,\n ),\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type StatSize = \"md\" | \"display\";\n\n/** A labelled value; the label renders first so it is read first. */\nexport type StatProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n /** What the value measures. */\n label: ReactNode;\n /** The number or short text; figures are tabular. */\n value: ReactNode;\n /** Value size; display is for one headline number. */\n size?: StatSize;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"label\" | \"value\">;\n};\n\nexport function Stat({ classNames, label, value, size = \"md\", className, ...props }: StatProps) {\n return (\n <div {...props} {...kb(\"stat\", { size }, className)}>\n <span className={clsx(\"kb-stat-label\", classNames?.label)}>{label}</span>\n <span className={clsx(\"kb-stat-value\", classNames?.value)}>{value}</span>\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type StatusTone = \"neutral\" | \"info\" | \"running\" | \"success\" | \"warning\" | \"blocked\";\nexport type StatusAppearance = \"plain\" | \"chip\";\n\n/** Text is mandatory: tone is never conveyed by color alone. */\nexport type StatusProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n /** Visible label. */\n children: ReactNode;\n /** Meaning of the state; drives color and the icon slot's color. */\n tone?: StatusTone;\n /** Caller-provided decorative icon; kbui ships no icons. */\n icon?: ReactNode;\n /** Announce changes: adds role=\"status\" and nothing else. */\n live?: boolean;\n /** Plain text and icon, or a chip tinted from the tone. */\n appearance?: StatusAppearance;\n /** Tighter spacing and smaller text; the text stays visible. */\n compact?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"icon\" | \"text\">;\n};\n\nexport function Status({\n classNames,\n tone = \"neutral\",\n appearance = \"plain\",\n icon,\n live = false,\n compact = false,\n className,\n children,\n ...props\n}: StatusProps) {\n return (\n <span\n {...props}\n {...(live ? { role: \"status\" } : {})}\n {...kb(\"status\", { tone, appearance, compact }, className)}\n >\n {icon != null ? (\n <span className={clsx(\"kb-status-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className={clsx(\"kb-status-text\", classNames?.text)}>{children}</span>\n </span>\n );\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type CSSProperties, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type SwitchSize = \"sm\" | \"md\" | \"lg\";\nexport type SwitchTone = \"neutral\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport type SwitchProps = Omit<\n ComponentProps<\"input\">,\n \"type\" | \"role\" | \"checked\" | \"defaultChecked\" | \"onChange\" | \"size\" | \"children\" | \"style\"\n> & {\n /** Visible, associated label. */\n label: string;\n /** Owner controls checked state. */\n checked: boolean;\n /** Requests next checked state. */\n onCheckedChange: (checked: boolean) => void;\n /** Track size; defaults to sm inside Fieldset and md elsewhere. */\n size?: SwitchSize | undefined;\n /** Shorthand tone for the on side when onTone is omitted. */\n tone?: SwitchTone | undefined;\n /** Semantic tone for the off side. */\n offTone?: SwitchTone | undefined;\n /** Semantic tone for the on side; defaults to accent. */\n onTone?: SwitchTone | undefined;\n /** Custom CSS color or token for the off side. */\n offColor?: string | undefined;\n /** Custom CSS color or token for the on side. */\n onColor?: string | undefined;\n /** Associated helper text. */\n description?: string | undefined;\n /** Associated error; marks native control invalid for assistive technology. */\n error?: string | undefined;\n /** Hide label visually; keep its accessible name. */\n visuallyHidden?: boolean | undefined;\n /** Decorative content in off position. */\n offIcon?: ReactNode;\n /** Decorative content in on position. */\n onIcon?: ReactNode;\n /** Added to native input; className belongs to root. */\n controlClassName?: string | undefined;\n /** Native styles; custom properties also feed visible planes. */\n style?: CSSProperties | (CSSProperties & Record<`--${string}`, string | number | undefined>);\n /** Classes for inner parts, keyed by part. */\n classNames?:\n | ClassNames<\n | \"control\"\n | \"label\"\n | \"field\"\n | \"target\"\n | \"track\"\n | \"thumb\"\n | \"off\"\n | \"on\"\n | \"description\"\n | \"error\"\n >\n | undefined;\n};\n\nexport function Switch({\n classNames,\n label,\n checked,\n onCheckedChange,\n size,\n tone,\n offTone,\n onTone,\n offColor,\n onColor,\n description,\n error,\n visuallyHidden,\n offIcon,\n onIcon,\n controlClassName,\n className,\n style,\n id,\n disabled,\n readOnly,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: SwitchProps) {\n const customVars = Object.fromEntries(\n Object.entries(style ?? {}).filter(([property]) => property.startsWith(\"--\")),\n );\n const rootStyle = {\n ...customVars,\n ...(offColor ? { \"--kb-switch-off-color\": offColor } : {}),\n ...(onColor ? { \"--kb-switch-on-color\": onColor } : {}),\n } as CSSProperties;\n const resolvedOffTone = offColor ? \"custom\" : offTone;\n const resolvedOnTone = onColor ? \"custom\" : (onTone ?? tone ?? \"accent\");\n const generated = useId();\n const controlId = id ?? `kb-switch-${generated}`;\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const descriptionId = `${controlId}-description`;\n const errorId = `${controlId}-error`;\n const descriptions =\n [describedBy, description && descriptionId, error && errorId].filter(Boolean).join(\" \") ||\n undefined;\n return (\n <div\n style={rootStyle}\n {...kb(\n \"switch\",\n {\n size,\n \"off-tone\": resolvedOffTone,\n \"on-tone\": resolvedOnTone,\n checked,\n disabled,\n readonly: readOnly,\n invalid,\n },\n className,\n )}\n >\n <div className={clsx(\"kb-switch-field\", classNames?.field)}>\n <span className={clsx(\"kb-switch-target\", classNames?.target)}>\n <input\n {...props}\n style={style}\n id={controlId}\n type=\"checkbox\"\n role=\"switch\"\n aria-checked={checked}\n className={clsx(\"kb-switch-control\", classNames?.control, controlClassName)}\n checked={checked}\n disabled={disabled}\n readOnly={readOnly}\n aria-readonly={readOnly || undefined}\n aria-invalid={ariaInvalid}\n aria-describedby={descriptions}\n onChange={(event) => {\n if (!readOnly) onCheckedChange(event.currentTarget.checked);\n }}\n />\n <span className={clsx(\"kb-switch-track\", classNames?.track)} aria-hidden=\"true\">\n <span className={clsx(\"kb-switch-thumb\", classNames?.thumb)} />\n <span className={clsx(\"kb-switch-off\", classNames?.off)}>{offIcon}</span>\n <span className={clsx(\"kb-switch-on\", classNames?.on)}>{onIcon}</span>\n </span>\n </span>\n <label\n htmlFor={controlId}\n className={clsx(\"kb-switch-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n </div>\n {description && (\n <p className={clsx(\"kb-switch-description\", classNames?.description)} id={descriptionId}>\n {description}\n </p>\n )}\n {error && (\n <p className={clsx(\"kb-switch-error\", classNames?.error)} id={errorId}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import type { ComponentProps, CSSProperties } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Checkbox, type CheckboxProps } from \"../Checkbox/Checkbox\";\n\nexport type TableProps = ComponentProps<\"table\"> & {\n /** Cell spacing; dense retains full-size control targets. */\n density?: \"comfortable\" | \"dense\" | undefined;\n stickyHeader?: boolean | undefined;\n /** Fixed column sizing; supply widths through colgroup or cell styles. */\n layout?: \"auto\" | \"fixed\" | undefined;\n};\nexport function TableRoot({\n density = \"comfortable\",\n stickyHeader = false,\n layout = \"auto\",\n className,\n ...props\n}: TableProps) {\n return (\n <table\n {...props}\n {...kb(\"table\", { density, \"sticky-header\": stickyHeader, layout }, className)}\n />\n );\n}\nfunction revealTableFocus(viewport: HTMLElement, target: HTMLElement) {\n const table = [...viewport.querySelectorAll<HTMLTableElement>(\".kb-table\")].find(\n (candidate) => candidate.contains(target) && candidate.closest(\".kb-table-scroll\") === viewport,\n );\n if (!table) return;\n const bounds = viewport.getBoundingClientRect();\n const left = bounds.left + viewport.clientLeft;\n const top = bounds.top + viewport.clientTop;\n let focusedEdge: string | undefined;\n for (let cell: HTMLElement | null = target; cell && cell !== table; cell = cell.parentElement) {\n if (cell.matches(\"th[data-sticky], td[data-sticky]\") && cell.closest(\".kb-table\") === table) {\n focusedEdge = cell.dataset.sticky;\n break;\n }\n }\n let visibleLeft = left;\n let visibleRight = left + viewport.clientWidth;\n const pinnedCells = table.querySelectorAll<HTMLElement>(\n \":scope > thead > tr > [data-sticky], :scope > :is(tbody, tfoot) > tr:first-child > [data-sticky]\",\n );\n for (const cell of pinnedCells) {\n const appearance = getComputedStyle(cell);\n if (\n cell.dataset.sticky === focusedEdge ||\n appearance.position !== \"sticky\" ||\n appearance.visibility !== \"visible\"\n )\n continue;\n const cellBounds = cell.getBoundingClientRect();\n if (cellBounds.width <= 0 || cellBounds.height <= 0) continue;\n const leftEdge = (cell.dataset.sticky === \"start\") !== (appearance.direction === \"rtl\");\n if (leftEdge) visibleLeft = Math.max(visibleLeft, cellBounds.right);\n else visibleRight = Math.min(visibleRight, cellBounds.left);\n }\n const head = table.tHead;\n const visibleTop =\n head && table.hasAttribute(\"data-sticky-header\") && !head.contains(target)\n ? Math.max(top, head.getBoundingClientRect().bottom)\n : top;\n const visibleBottom = top + viewport.clientHeight;\n const targetBounds = target.getBoundingClientRect();\n if (visibleRight > visibleLeft) {\n if (targetBounds.left < visibleLeft)\n viewport.scrollLeft += Math.floor(targetBounds.left - visibleLeft);\n else if (targetBounds.right > visibleRight)\n viewport.scrollLeft += Math.ceil(targetBounds.right - visibleRight);\n }\n if (visibleBottom > visibleTop) {\n if (targetBounds.top < visibleTop)\n viewport.scrollTop += Math.floor(targetBounds.top - visibleTop);\n else if (targetBounds.bottom > visibleBottom)\n viewport.scrollTop += Math.ceil(targetBounds.bottom - visibleBottom);\n }\n}\n\nexport type TableScrollContainerProps = ComponentProps<\"section\"> & {\n label: string;\n /** Height cap; sticky headers use this scroll boundary. */\n maxHeight?: CSSProperties[\"maxHeight\"] | undefined;\n};\nexport function TableScrollContainer({\n label,\n maxHeight,\n onFocus,\n className,\n style,\n ...props\n}: TableScrollContainerProps) {\n return (\n <section\n {...props}\n aria-label={label}\n tabIndex={props.tabIndex ?? 0}\n {...kb(\"table-scroll\", {}, className)}\n style={{ maxHeight, ...style }}\n onFocus={(event) => {\n onFocus?.(event);\n if (!event.defaultPrevented && event.target instanceof HTMLElement)\n revealTableFocus(event.currentTarget, event.target);\n }}\n />\n );\n}\nexport type TableCaptionProps = ComponentProps<\"caption\">;\nexport function TableCaption({ className, ...props }: TableCaptionProps) {\n return <caption {...props} {...kb(\"table-caption\", {}, className)} />;\n}\nexport type TableHeadProps = ComponentProps<\"thead\">;\nexport function TableHead({ className, ...props }: TableHeadProps) {\n return <thead {...props} {...kb(\"table-head\", {}, className)} />;\n}\nexport type TableBodyProps = ComponentProps<\"tbody\">;\nexport function TableBody({ className, ...props }: TableBodyProps) {\n return <tbody {...props} {...kb(\"table-body\", {}, className)} />;\n}\nexport type TableFootProps = ComponentProps<\"tfoot\">;\nexport function TableFoot({ className, ...props }: TableFootProps) {\n return <tfoot {...props} {...kb(\"table-foot\", {}, className)} />;\n}\nexport type TableRowProps = ComponentProps<\"tr\"> & {\n /** Highlight a row whose checkbox is selected; adds no grid role. */\n selected?: boolean | undefined;\n};\nexport function TableRow({ selected = false, className, ...props }: TableRowProps) {\n return <tr {...props} {...kb(\"table-row\", { selected }, className)} />;\n}\nexport type TableCellOptions = {\n align?: \"start\" | \"center\" | \"end\" | undefined;\n /** Pin one edge cell; use matching edges in header and body. */\n sticky?: \"start\" | \"end\" | undefined;\n};\nexport type TableSortDirection = \"none\" | \"ascending\" | \"descending\";\nexport type TableColumnHeaderProps = Omit<ComponentProps<\"th\">, \"align\"> &\n TableCellOptions & {\n /** Controlled order; app owns sorting and resets other columns to none. */\n sortDirection?: TableSortDirection | undefined;\n /** Enables native sort button; none starts ascending, then toggles. */\n onSortChange?: ((direction: Exclude<TableSortDirection, \"none\">) => void) | undefined;\n sortDisabled?: boolean | undefined;\n classNames?: ClassNames<\"sortButton\" | \"sortIcon\"> | undefined;\n };\nexport function TableColumnHeader({\n align = \"start\",\n sticky,\n sortDirection,\n onSortChange,\n sortDisabled,\n className,\n classNames,\n children,\n scope = \"col\",\n \"aria-sort\": ariaSort,\n ...props\n}: TableColumnHeaderProps) {\n const direction =\n sortDirection ?? (ariaSort === \"ascending\" || ariaSort === \"descending\" ? ariaSort : \"none\");\n return (\n <th\n {...props}\n scope={scope}\n aria-sort={sortDirection === \"none\" ? undefined : (sortDirection ?? ariaSort)}\n {...kb(\"table-columnheader\", { align, sticky, sortable: Boolean(onSortChange) }, className)}\n >\n {onSortChange ? (\n <button\n type=\"button\"\n disabled={sortDisabled}\n {...kb(\"table-sort-button\", {}, classNames?.sortButton)}\n onClick={() => onSortChange(direction === \"ascending\" ? \"descending\" : \"ascending\")}\n >\n {children}\n <span aria-hidden=\"true\" {...kb(\"table-sort-icon\", {}, classNames?.sortIcon)}>\n {direction === \"ascending\" ? \"↑\" : direction === \"descending\" ? \"↓\" : \"⇅\"}\n </span>\n </button>\n ) : (\n children\n )}\n </th>\n );\n}\nexport type TableRowHeaderProps = Omit<ComponentProps<\"th\">, \"align\"> & TableCellOptions;\nexport function TableRowHeader({\n align = \"start\",\n sticky,\n scope = \"row\",\n className,\n ...props\n}: TableRowHeaderProps) {\n return <th {...props} scope={scope} {...kb(\"table-rowheader\", { align, sticky }, className)} />;\n}\nexport type TableCellProps = Omit<ComponentProps<\"td\">, \"align\"> & TableCellOptions;\nexport function TableCell({ align = \"start\", sticky, className, ...props }: TableCellProps) {\n return <td {...props} {...kb(\"table-cell\", { align, sticky }, className)} />;\n}\nexport type TableSelectionCheckboxProps = CheckboxProps;\nexport type TableRowActionsProps = ComponentProps<\"div\">;\nexport function TableRowActions({ className, ...props }: TableRowActionsProps) {\n return <div {...props} {...kb(\"table-rowactions\", {}, className)} />;\n}\n\nexport const Table = Object.assign(TableRoot, {\n ScrollContainer: TableScrollContainer,\n Caption: TableCaption,\n Head: TableHead,\n Body: TableBody,\n Foot: TableFoot,\n Row: TableRow,\n ColumnHeader: TableColumnHeader,\n RowHeader: TableRowHeader,\n Cell: TableCell,\n SelectionCheckbox: Checkbox,\n RowActions: TableRowActions,\n});\n","import { Tabs as BaseTabs } from \"@base-ui/react/tabs\";\nimport { clsx as cx } from \"clsx\";\nimport {\n Children,\n type ComponentPropsWithoutRef,\n createContext,\n forwardRef,\n isValidElement,\n type ReactNode,\n useContext,\n} from \"react\";\nimport type { ClassNames } from \"../../utils/kb\";\n\nexport type TabsOrientation = \"horizontal\" | \"vertical\";\nexport type TabsVariant = \"line\" | \"pill\";\nexport type TabsSize = \"sm\" | \"md\";\nexport type TabsClassKey =\n | \"root\"\n | \"list\"\n | \"tab\"\n | \"tabIcon\"\n | \"tabLabel\"\n | \"tabBadge\"\n | \"indicator\"\n | \"panel\";\n\ntype TabsStyleContextValue = {\n variant: TabsVariant;\n size: TabsSize;\n orientation: TabsOrientation;\n classNames?: ClassNames<TabsClassKey> | undefined;\n};\n\nconst TabsStyleContext = createContext<TabsStyleContextValue>({\n variant: \"line\",\n size: \"md\",\n orientation: \"horizontal\",\n});\n\nexport interface TabsProps\n extends Omit<\n ComponentPropsWithoutRef<typeof BaseTabs.Root>,\n \"className\" | \"orientation\" | \"value\" | \"defaultValue\" | \"onValueChange\"\n > {\n /** Controlled active tab value. */\n value?: string | number | null | undefined;\n /** Initial active tab value when uncontrolled. */\n defaultValue?: string | number | null | undefined;\n /** Called when the active tab value changes. */\n onValueChange?:\n | ((value: string | number | null, eventDetails: BaseTabs.Root.ChangeEventDetails) => void)\n | undefined;\n /** Layout axis for the tab list and panels. */\n orientation?: TabsOrientation | undefined;\n /** Visual treatment of the tab list and active indicator. */\n variant?: TabsVariant | undefined;\n /** Control density for tab triggers. */\n size?: TabsSize | undefined;\n /** Additional root class name. */\n className?: string | undefined;\n /** Custom class names for inner anatomy slots. */\n classNames?: ClassNames<TabsClassKey> | undefined;\n}\n\nexport interface TabsListProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.List>, \"className\"> {\n /** Move selection automatically when focus moves between tabs. */\n activateOnFocus?: boolean | undefined;\n /** Wrap arrow-key focus from the last tab back to the first. */\n loopFocus?: boolean | undefined;\n /** Render the sliding active indicator inside the list. */\n showIndicator?: boolean | undefined;\n /** Additional tablist class name. */\n className?: string | undefined;\n}\n\nexport interface TabsTabProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Tab>, \"className\" | \"value\"> {\n /** Unique value matching the associated panel. */\n value: string | number;\n /** Prevent selecting or activating the tab. */\n disabled?: boolean | undefined;\n /** Optional leading icon rendered inside the tab trigger. */\n icon?: ReactNode | undefined;\n /** Optional trailing count or status badge. */\n badge?: ReactNode | undefined;\n /** Additional tab button class name. */\n className?: string | undefined;\n}\n\nexport interface TabsIndicatorProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Indicator>, \"className\"> {\n /** Additional indicator class name. */\n className?: string | undefined;\n}\n\nexport interface TabsPanelProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Panel>, \"className\" | \"value\"> {\n /** Tab value that reveals this panel when active. */\n value: string | number;\n /** Keep inactive panel DOM mounted when hidden. */\n keepMounted?: boolean | undefined;\n /** Additional panel class name. */\n className?: string | undefined;\n}\n\nexport const TabsIndicator = forwardRef<HTMLSpanElement, TabsIndicatorProps>(function TabsIndicator(\n { className, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Indicator\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n className={cx(\"kb-tabs-indicator\", classNames?.indicator, className)}\n />\n );\n});\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList(\n { activateOnFocus = true, loopFocus = true, showIndicator = true, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n const hasExplicitIndicator = Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === TabsIndicator,\n );\n return (\n <BaseTabs.List\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n activateOnFocus={activateOnFocus}\n loopFocus={loopFocus}\n className={cx(\"kb-tabs-list\", classNames?.list, className)}\n >\n {children}\n {showIndicator && !hasExplicitIndicator ? <TabsIndicator /> : null}\n </BaseTabs.List>\n );\n});\n\nexport const TabsTab = forwardRef<HTMLButtonElement, TabsTabProps>(function TabsTab(\n { value, disabled = false, icon, badge, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Tab\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n value={value}\n disabled={disabled}\n className={cx(\"kb-tabs-tab\", classNames?.tab, className)}\n >\n {icon != null ? (\n <span className={cx(\"kb-tabs-tab-icon\", classNames?.tabIcon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className={cx(\"kb-tabs-tab-label\", classNames?.tabLabel)}>{children}</span>\n {badge != null ? (\n <span className={cx(\"kb-tabs-tab-badge\", classNames?.tabBadge)}>{badge}</span>\n ) : null}\n </BaseTabs.Tab>\n );\n});\n\nexport const TabsPanel = forwardRef<HTMLDivElement, TabsPanelProps>(function TabsPanel(\n { value, keepMounted = false, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Panel\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n value={value}\n keepMounted={keepMounted}\n className={cx(\"kb-tabs-panel\", classNames?.panel, className)}\n >\n {children}\n </BaseTabs.Panel>\n );\n});\n\nconst TabsRoot = forwardRef<HTMLDivElement, TabsProps>(function Tabs(\n {\n value,\n defaultValue,\n onValueChange,\n orientation = \"horizontal\",\n variant = \"line\",\n size = \"md\",\n className,\n classNames,\n children,\n ...props\n },\n ref,\n) {\n return (\n <TabsStyleContext.Provider value={{ classNames, variant, size, orientation }}>\n <BaseTabs.Root\n {...props}\n ref={ref}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n orientation={orientation}\n data-variant={variant}\n data-size={size}\n className={cx(\"kb-tabs\", classNames?.root, className)}\n >\n {children}\n </BaseTabs.Root>\n </TabsStyleContext.Provider>\n );\n});\n\nexport const Tabs = Object.assign(TabsRoot, {\n List: TabsList,\n Tab: TabsTab,\n Indicator: TabsIndicator,\n Panel: TabsPanel,\n});\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type TextElement = \"p\" | \"span\" | \"div\";\nexport type TextSize = \"sm\" | \"md\" | \"lg\";\nexport type TextTone = \"default\" | \"muted\";\nexport type TextProps<T extends TextElement = \"p\"> = ComponentProps<T> & {\n /** Native element; use span inside paragraphs and div for block children. */\n as?: T;\n /** Body size; inline links and code inherit surrounding size. */\n size?: TextSize;\n /** Default ink or secondary text with readable contrast. */\n tone?: TextTone;\n};\n\nexport function Text<T extends TextElement = \"p\">({\n as,\n size = \"md\",\n tone = \"default\",\n className,\n ...props\n}: TextProps<T>) {\n return createElement(as ?? \"p\", { ...props, ...kb(\"text\", { size, tone }, className) });\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type TextareaResize = \"vertical\" | \"none\" | \"both\";\nexport type TextareaPart = \"label\" | \"control\" | \"description\" | \"error\";\n\nexport interface TextareaProps extends Omit<ComponentProps<\"textarea\">, \"children\"> {\n /** Visible field label and accessible name. */\n label: string;\n /** Hide the label visually while keeping its accessible name. */\n visuallyHidden?: boolean | undefined;\n /** Supporting helper text below the textarea. */\n description?: string | undefined;\n /** Validation error message; marks the textarea invalid. */\n error?: string | undefined;\n /** Drag-resize axis for the native textarea. */\n resize?: TextareaResize | undefined;\n /** Callback fired with the next string value on change. */\n onValueChange?: ((value: string) => void) | undefined;\n /** Root wrapper class name. */\n className?: string | undefined;\n /** Classes for the label, control, description and error slots. */\n classNames?: ClassNames<TextareaPart> | undefined;\n}\n\n/** Labelled multiline text control with associated helper and error messages. */\nexport const Textarea = ({\n ref,\n id,\n label,\n visuallyHidden,\n description,\n error,\n resize = \"vertical\",\n rows = 4,\n disabled,\n readOnly,\n onChange,\n onValueChange,\n className,\n classNames,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: TextareaProps) => {\n const reactId = useId();\n const controlId = id ?? `kb-textarea-${reactId}`;\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const descriptionId = description ? `${controlId}-description` : undefined;\n const errorId = error ? `${controlId}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n\n return (\n <div {...kb(\"textarea\", { resize, invalid, disabled, readonly: readOnly }, className)}>\n <label\n htmlFor={controlId}\n className={clsx(\"kb-textarea-label\", visuallyHidden && \"kb-sr-only\", classNames?.label)}\n >\n {label}\n </label>\n <textarea\n {...props}\n ref={ref}\n id={controlId}\n rows={rows}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-textarea-control\", classNames?.control)}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n }}\n />\n {description ? (\n <p id={descriptionId} className={clsx(\"kb-textarea-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n {error ? (\n <div id={errorId} className={clsx(\"kb-textarea-error\", classNames?.error)}>\n {error}\n </div>\n ) : null}\n </div>\n );\n};\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Image, type ImageProps } from \"../Image/Image\";\n\nexport type ThumbnailProps = Omit<ComponentProps<\"figure\">, \"children\"> &\n Pick<ImageProps, \"src\" | \"alt\" | \"ratio\" | \"fit\" | \"position\" | \"fallback\"> & {\n /** Visible title; may contain a native link or button. */\n caption?: ReactNode | undefined;\n /** Supporting metadata; remains visible when media fails. */\n description?: ReactNode | undefined;\n /** Native source/loading attributes and Image styling hooks. */\n imageProps?:\n | Omit<ImageProps, \"src\" | \"alt\" | \"ratio\" | \"fit\" | \"position\" | \"fallback\">\n | undefined;\n /** Extra classes for figure, media, caption, title and description. */\n classNames?: ClassNames<\"root\" | \"media\" | \"caption\" | \"title\" | \"description\"> | undefined;\n };\n\nexport function Thumbnail({\n src,\n alt,\n ratio,\n fit,\n position,\n fallback,\n caption,\n description,\n imageProps,\n className,\n classNames,\n ...props\n}: ThumbnailProps) {\n const captionId = useId();\n const hasCaption = caption !== undefined && caption !== null && caption !== false;\n return (\n <figure\n {...props}\n {...kb(\"thumbnail\", {}, classNames?.root ?? className)}\n aria-labelledby={\n props[\"aria-labelledby\"] ??\n (props[\"aria-label\"] ? undefined : hasCaption ? captionId : undefined)\n }\n >\n <Image\n {...imageProps}\n src={src}\n alt={alt}\n ratio={ratio}\n fit={fit}\n position={position}\n fallback={fallback}\n classNames={{\n ...imageProps?.classNames,\n root: clsx(\n \"kb-thumbnail-media\",\n classNames?.media,\n imageProps?.classNames?.root ?? imageProps?.className,\n ),\n }}\n />\n {(hasCaption || description != null) && (\n <figcaption {...kb(\"thumbnail-caption\", {}, classNames?.caption)}>\n {hasCaption && (\n <span id={captionId} {...kb(\"thumbnail-title\", {}, classNames?.title)}>\n {caption}\n </span>\n )}\n {description != null && (\n <span {...kb(\"thumbnail-description\", {}, classNames?.description)}>{description}</span>\n )}\n </figcaption>\n )}\n </figure>\n );\n}\n","import {\n Toast as Base,\n type ToastManagerAddOptions as BaseAddOptions,\n type ToastManagerPromiseOptions as BasePromiseOptions,\n type ToastManager as BaseToastManager,\n type ToastObject as BaseToastObject,\n type ToastManagerUpdateOptions as BaseUpdateOptions,\n type UseToastManagerReturnValue,\n} from \"@base-ui/react/toast\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type ToastPlacement = \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"inline\";\nexport type ToastObject<Data extends object = Record<string, unknown>> = BaseToastObject<Data>;\nexport type ToastManager<Data extends object = Record<string, unknown>> = BaseToastManager<Data>;\nexport type ToastAddOptions<Data extends object = Record<string, unknown>> = BaseAddOptions<Data>;\nexport type ToastUpdateOptions<Data extends object = Record<string, unknown>> =\n BaseUpdateOptions<Data>;\nexport type ToastPromiseOptions<\n Value,\n Data extends object = Record<string, unknown>,\n> = BasePromiseOptions<Value, Data>;\nexport type ToastProviderProps = Base.Provider.Props;\nexport type ToastContentProps = Omit<Base.Content.Props, \"className\"> & {\n /** Extra classes for content. */\n className?: string | undefined;\n};\nexport type ToastTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Extra classes for title. */\n className?: string | undefined;\n};\nexport type ToastDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Extra classes for description. */\n className?: string | undefined;\n};\nexport type ToastActionProps = Omit<Base.Action.Props, \"className\"> & {\n /** Extra classes for action. */\n className?: string | undefined;\n};\nexport type ToastCloseProps = Omit<Base.Close.Props, \"className\"> & {\n /** Extra classes for dismissal control. */\n className?: string | undefined;\n};\nexport type ToastProps<Data extends object = Record<string, unknown>> = Omit<\n Base.Root.Props,\n \"className\" | \"toast\"\n> & {\n /** Message object from the matching provider. */\n toast: ToastObject<Data>;\n /** Extra classes for root. */\n className?: string | undefined;\n /** Visual emphasis; defaults to matching toast.type, with error mapped to danger. */\n tone?: ToastTone | undefined;\n /** Localized accessible name for default dismissal control. */\n closeLabel?: string | undefined;\n /** Classes for default parts; custom children own their part classes. */\n classNames?: ClassNames<\"content\" | \"title\" | \"description\" | \"action\" | \"close\"> | undefined;\n};\nexport type ToastViewportProps<Data extends object = Record<string, unknown>> = Omit<\n Base.Viewport.Props,\n \"className\"\n> & {\n /** Extra classes for viewport. */\n className?: string | undefined;\n /** Logical screen corner; inline participates in surrounding layout without a portal. */\n placement?: ToastPlacement | undefined;\n /** Theme-scoped portal host; defaults to document.body for fixed placements. */\n container?: Base.Portal.Props[\"container\"];\n /** Custom renderer for each message; defaults to a complete Toast with all parts. */\n renderToast?: ((toast: ToastObject<Data>) => ReactNode) | undefined;\n};\n\nexport function createToastManager<\n Data extends object = Record<string, unknown>,\n>(): ToastManager<Data> {\n return Base.createToastManager<Data>();\n}\n\nexport function useToastManager<\n Data extends object = Record<string, unknown>,\n>(): UseToastManagerReturnValue<Data> {\n return Base.useToastManager<Data>();\n}\n\nfunction ToastContent({ className, ...props }: ToastContentProps) {\n return <Base.Content {...props} className={clsx(\"kb-toast-content\", className)} />;\n}\n\nfunction ToastTitle({ className, ...props }: ToastTitleProps) {\n return <Base.Title {...props} className={clsx(\"kb-toast-title\", className)} />;\n}\n\nfunction ToastDescription({ className, ...props }: ToastDescriptionProps) {\n return <Base.Description {...props} className={clsx(\"kb-toast-description\", className)} />;\n}\n\nfunction ToastAction({ className, ...props }: ToastActionProps) {\n return <Base.Action {...props} className={clsx(\"kb-toast-action\", className)} />;\n}\n\nfunction ToastClose({ className, ...props }: ToastCloseProps) {\n return (\n <Base.Close\n aria-label=\"Dismiss notification\"\n aria-hidden={false}\n {...props}\n className={clsx(\"kb-toast-close\", className)}\n />\n );\n}\n\nfunction toastTone(type: string | undefined): ToastTone {\n if (type === \"error\") return \"danger\";\n if (type === \"loading\") return \"info\";\n return type === \"info\" || type === \"success\" || type === \"warning\" || type === \"danger\"\n ? type\n : \"neutral\";\n}\n\nfunction ToastRoot<Data extends object = Record<string, unknown>>({\n toast,\n tone = toastTone(toast.type),\n closeLabel = \"Dismiss notification\",\n classNames,\n className,\n children,\n ...props\n}: ToastProps<Data>) {\n return (\n <Base.Root {...props} toast={toast} {...kb(\"toast\", { tone }, className)}>\n {children === undefined ? (\n <>\n <ToastContent className={classNames?.content}>\n <ToastTitle className={classNames?.title}>\n {toast.title ?? toast.description}\n </ToastTitle>\n {toast.title != null && <ToastDescription className={classNames?.description} />}\n <ToastAction className={classNames?.action} />\n </ToastContent>\n <ToastClose className={classNames?.close} aria-label={closeLabel}>\n <span aria-hidden=\"true\">×</span>\n </ToastClose>\n </>\n ) : (\n children\n )}\n </Base.Root>\n );\n}\n\nfunction ToastViewport<Data extends object = Record<string, unknown>>({\n placement = \"bottom-end\",\n container,\n renderToast,\n className,\n children,\n ...props\n}: ToastViewportProps<Data>) {\n const { toasts } = useToastManager<Data>();\n const viewport = (\n <Base.Viewport {...props} {...kb(\"toast-viewport\", { placement }, className)}>\n {children === undefined\n ? toasts.map((toast) =>\n renderToast ? renderToast(toast) : <ToastRoot key={toast.id} toast={toast} />,\n )\n : children}\n </Base.Viewport>\n );\n return placement === \"inline\" ? (\n viewport\n ) : (\n <Base.Portal container={container}>{viewport}</Base.Portal>\n );\n}\n\nexport const Toast = Object.assign(ToastRoot, {\n Provider: Base.Provider,\n Viewport: ToastViewport,\n Content: ToastContent,\n Title: ToastTitle,\n Description: ToastDescription,\n Action: ToastAction,\n Close: ToastClose,\n});\n","import { Toolbar as Base } from \"@base-ui/react/toolbar\";\nimport { clsx } from \"clsx\";\nimport { Button, type ButtonVariant } from \"../Button/Button\";\n\n/** One tab stop for a row of actions; arrow keys move between them. Name it with aria-label. */\nexport type ToolbarProps = Omit<Base.Root.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type ToolbarGroupProps = Omit<Base.Group.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type ToolbarButtonProps = Omit<Base.Button.Props, \"className\" | \"render\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Button weight; toolbars default to ghost. */\n variant?: ButtonVariant;\n};\nexport type ToolbarSeparatorProps = Omit<Base.Separator.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\n\nfunction ToolbarRoot({ className, ...props }: ToolbarProps) {\n return <Base.Root {...props} className={clsx(\"kb-toolbar\", className)} />;\n}\n\nfunction ToolbarGroup({ className, ...props }: ToolbarGroupProps) {\n return <Base.Group {...props} className={clsx(\"kb-toolbar-group\", className)} />;\n}\n\nfunction ToolbarButton({ variant = \"ghost\", className, ...props }: ToolbarButtonProps) {\n return (\n <Base.Button\n {...props}\n render={<Button variant={variant} size=\"sm\" {...(className ? { className } : {})} />}\n />\n );\n}\n\nfunction ToolbarSeparator({ className, ...props }: ToolbarSeparatorProps) {\n return <Base.Separator {...props} className={clsx(\"kb-toolbar-separator\", className)} />;\n}\n\nexport const Toolbar = Object.assign(ToolbarRoot, {\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Separator: ToolbarSeparator,\n});\n","import { Tooltip as Base } from \"@base-ui/react/tooltip\";\nimport { clsx } from \"clsx\";\nimport type { ReactElement, ReactNode, Ref } from \"react\";\n\n/** A visual hint only; the trigger still needs its own accessible name. */\nexport type TooltipProps = {\n /** Text shown in the popup. */\n content: ReactNode;\n /** The element that shows the tooltip on hover and focus. */\n children: ReactElement;\n /** Portal target for nested consumer themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Plain class on popup slot. */\n className?: string;\n /** Side of the trigger the popup prefers. */\n side?: Base.Positioner.Props[\"side\"];\n /** Hover delay in ms before opening. */\n delay?: number;\n /** Ref forwarded to the popup element. */\n ref?: Ref<HTMLDivElement>;\n};\n\nexport function Tooltip({\n content,\n children,\n side = \"top\",\n delay = 400,\n container,\n className,\n ref,\n}: TooltipProps) {\n return (\n <Base.Root>\n <Base.Trigger delay={delay} render={children} />\n <Base.Portal container={container}>\n <Base.Positioner side={side} sideOffset={6}>\n <Base.Popup ref={ref} className={clsx(\"kb-tooltip\", className)}>\n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ACJ,QAAQ,kBAACkD,GAAD;GAAiB;GAAS,MAAK;GAAK,GAAK3C,IAAY,EAAE,aAAU,IAAI,CAAC;EAAK,CAAA;CACpF,CAAA;AAEL;AAEA,SAASusB,GAAiB,EAAE,cAAW,GAAG9sB,KAAgC;CACxE,OAAO,kBAAC1B,EAAK,WAAN;EAAgB,GAAI0B;EAAO,WAAWK,EAAK,wBAAwBE,CAAS;CAAI,CAAA;AACzF;AAEA,IAAawsB,KAAU,OAAO,OAAOJ,IAAa;CAChD,OAAOC;CACP,QAAQC;CACR,WAAWC;AACb,CAAC;;;AC3BD,SAAgBE,GAAQ,EACtB,YACA,aACA,UAAO,OACP,WAAQ,KACR,cACA,cACA,UACe;CACf,OACE,kBAACzuB,EAAK,MAAN,EAAA,UAAA,CACE,kBAACA,EAAK,SAAN;EAAqB;EAAO,QAAQgN;CAAW,CAAA,GAC/C,kBAAChN,EAAK,QAAN;EAAwB;EACtB,UAAA,kBAACA,EAAK,YAAN;GAAuB;GAAM,YAAY;GACvC,UAAA,kBAACA,EAAK,OAAN;IAAiB;IAAK,WAAW8B,EAAK,cAAcE,CAAS;IAC1D,UAAAigB;GACS,CAAA;EACG,CAAA;CACN,CAAA,CACJ,EAAA,CAAA;AAEf"}
1
+ {"version":3,"file":"index.js","names":["Base","Base","_Fragment","BaseInput","Base","defaultRemoveLabel","Base","Base","Base","_Fragment","Base","headingTags","_Fragment","Base","Separator","Base","Base","Base","BaseGroup","Base","_Fragment","BaseTabs","cx","Base","_Fragment","Base","Base","Accordion$1","Fragment$1","Button$1","Input$1","Select$1","Combobox$1","Dialog$1","Menu$1","Separator$1","NumberField$1","Popover$1","Progress$1","RadioGroup$1","ScrollArea$1","Tabs$1","Toast$1","Toolbar$1","Tooltip$1","CollapsiblePanel","exiting","state","nativeProps","useRender","render","props","isValidElement","cloneElement","kb","out","clsx","name","className","key","value","attrs","resolveInvalid","hasAria","ariaInvalid","invalid","hasError","AccordionRoot","AccordionItem","AccordionHeader","AccordionTrigger","AccordionPanel","Accordion","Image","ImageFrame","hasSource","src","srcSet","setState","useState","intrinsicRatio","width","height","classNames","alt","ratio","style","fallback","position","image","onLoad","event","onError","Avatar","words","letters","word","decorative","initials","Badge","preserveCase","Button","Callout","live","icon","title","actions","Card","createElement","as","Checkbox","providedId","callerAriaInvalid","generated","useId","id","input","useRef","useImperativeHandle","ref","useLayoutEffect","indeterminate","error","described","description","theme","property","checked","readOnly","controlClassName","disabled","onCheckedChange","visuallyHidden","label","useClipboard","feedback","setFeedback","epoch","busy","timer","copy","request","onCopyError","duration","feedbackDuration","onCopy","LANGUAGE_LABELS","formatCodeLanguage","language","TS_KEYWORDS","TS_BUILTIN_TYPES","TS_EXPR_KEYWORDS","TS_TYPE_LEAD_KEYWORDS","CSS_KEYWORDS","SHELL_KEYWORDS","isIdentStart","ch","isIdentChar","scanQuotedString","quote","code","start","allowMultiline","findMatchingBrace","depth","i","openPos","nl","end","tokenizeTsx","tokens","lastWord","prevNonSpaceChar","jsxDepth","push","baseOffset","kind","closeBrace","exprEnd","close","segStart","cursor","c","expr","tagMatch","selfClosing","attrMatch","numMatch","len","identMatch","afterSlice","isCall","isObjKey","opMatch","op","tokenizeCss","braceDepth","inAtRuleHeader","m","propMatch","restAfterColon","nextSemi","nextBrace","fnMatch","varMatch","restToBrace","nextOpenBrace","pseudoMatch","selMatch","wordMatch","tokenizeHtml","isClose","tagStart","tokenizeJson","isKey","kwMatch","tokenizeShell","expectCommand","flagMatch","tokenizeCode","renderLineTokens","lineText","lineEnd","lineStart","nodes","tokStart","tokEnd","Code","collapsedProp","viewportId","uncontrolledCollapsed","setUncontrolledCollapsed","defaultCollapsed","rawCode","children","clipboard","copyState","expandedHeight","setExpandedHeight","preRef","resolvedMinLines","minLines","resolvedCollapsedLines","collapsedLines","collapsible","element","measure","next","observer","hasBlockProps","copyable","lineNumbers","highlightLines","maxHeight","isMultilineString","block","isCollapsed","showCopy","languageLabel","hasMeta","hasActions","showHeader","resolvedTokens","lines","highlightSet","extraLineCount","blockStyle","handleToggleCollapse","onCollapsedChange","resolvedCopyLabel","copyLabel","copyingLabel","copiedLabel","copyErrorLabel","copyAnnouncement","successMessage","errorMessage","offset","lineNumber","startLine","idx","isHighlighted","Fragment","extraOffset","CodeBlock","Input","Field","startContent","endContent","Select","callerDescription","root","trigger","popup","interaction","pointerFocus","setPointerFocus","empty","options","inactive","help","item","onValueChange","details","container","popupClassName","active","option","positiveInteger","collectionPageCount","pageSize","totalItems","useCollection","internal","setInternal","derive","requested","keys","disabledKeys","items","getKey","isItemDisabled","processed","matches","compare","sort","a","b","pageCount","pageItems","selectableKeys","selected","selectedOnPage","context","latest","index","change","current","patch","removed","keysToRemove","CollectionPagination","count","page","sizes","pageSizes","size","onPageSizeChange","onPageChange","CollectionBulkActions","pending","setPending","failed","setFailed","selectedKeys","lock","selection","success","onSuccess","run","action","snapshot","onPendingChange","onClear","CollectionRoot","blocked","loading","collection","columns","column","mode","slot","part","filters","filter","toolbar","selectable","bulkActions","sortable","direction","getItemLabel","Collection","CollectionList","hasSlotContent","CollectionRow","aside","metadata","leading","defaultRemoveLabel$1","chipAriaReset","MultiSelect","forwardRef","ariaDescribedBy","rest","uid","rootRef","inputId","labelId","descId","errId","isInvalid","hasDescription","describedBy","useMemo","o","optionMap","selectedValues","v","selectedOptions","onOpenChange","removeLabel","clearLabel","toggleLabel","emptyMessage","Combobox","_","SingleCombobox","validValue","DialogRoot","DialogTrigger","DialogClose","DialogTitle","DialogDescription","DialogActions","DialogHeader","DialogBody","DialogFooter","DialogContent","hasTitle","heading","layout","Dialog","DEFAULT_ERROR","ConfirmAction","uncontrolledOpen","setUncontrolledOpen","defaultOpen","failure","setFailure","cancel","submitting","succeeded","mounted","isOpen","open","openNow","latestConfirmed","onConfirmed","confirmedCount","setConfirmedCount","useEffect","confirm","onConfirm","n","reason","confirmText","confirmLabel","message","eventDetails","finalFocus","cancelLabel","pendingLabel","Container","gutter","LinkComponentContext","createContext","LinkProvider","component","useLinkComponent","useContext","LinkRoot","Anchor","Link","highlightRanges","terms","highlight","ranges","term","webLinks","links","match","href","last","opener","url","link","CODE_LANGUAGES","detectCopyableLanguage","source","fence","renderCopyableContent","highlights","text","range","from","to","tokenStart","tokenEnd","begin","finish","codeRanges","CopyableText","valueId","codeLanguage","format","disclosure","setDisclosure","expanded","truncate","buttonLabel","linkify","collapseLabel","expandLabel","Dashboard","header","metrics","primary","secondary","DescriptionListRoot","DescriptionListItem","DescriptionListTerm","DescriptionListDetail","DescriptionList","DisclosureRoot","Collapsible","DisclosureTrigger","DisclosurePanel","Disclosure","headingTags$1","EmptyState","HeadingTag","headingLevel","eyebrow","footer","FOCUSABLE_CHILD_SELECTOR","focusTargetByHref","rawId","targetId","doc","focusTarget","ErrorSummary","ariaLabelledBy","reactId","baseId","titleId","descriptionId","labelledBy","seenKeys","baseKey","occurrence","itemKey","onItemSelect","Fieldset","errorId","legend","defaultRemoveLabel","defaultRemovedMessage","defaultSelectionMessage","FileInput","removeButtons","announcement","setAnnouncement","inputRef","triggerRef","removedMessage","onBlurCapture","control","files","onFiles","selectionMessage","triggerClassName","chooseLabel","listClassName","itemClassName","renderItem","node","onRemove","FormActions","Form","actionsAlign","Heading","level","FormSection","Grid","minItemWidth","hasItems","Children","child","GalleryRoot","showEmpty","itemsLabel","GalleryItem","Gallery","Inline","PointerFocus","MenuRoot","keyboard","MenuTrigger","MenuContent","MenuItem","MenuSeparator","Menu","NumberField","inputProps","step","groupClassName","decrementLabel","inputClassName","incrementLabel","headingTags","PageHeader","navigation","meta","NestedContext","CollapsibleContext","DirectionContext","paneBefore","handle","PanelRoot","content","rail","PanelHeader","PanelToolbar","PanelBody","merged","jsx","PanelFooter","PanelWell","PanelToggle","PanelGroup","PanelHandle","row","clamp","max","min","inner","setInner","defaultSize","controls","setControls","dragging","setDragging","restore","fallbackId","target","commit","onSizeChange","handleKeyDown","handlePointerDown","onPointerDown","handlePointerMove","group","length","endDrag","onPointerUp","onPointerCancel","Panel","PopoverRoot","PopoverTrigger","PopoverClose","PopoverTitle","PopoverDescription","PopoverHeader","PopoverBody","PopoverFooter","PopoverContent","positionerProps","Popover","Progress","valueText","formatted","EntryContext","RadioOptions","track","setSelection","segmented","resize","observeItems","changes","RadioControl","entry","update","remove","eligible","customTabIndex","tabIndex","RadioGroupRoot","focused","inside","setInside","markFocused","useCallback","entries","setEntries","previous","data","onFocusCapture","selectionMotion","selectionTone","appearance","RadioGroupItem","Radio","controlProps","RadioGroup","ScrollArea","vars","Separator","orientation","Settings","toDimension","Skeleton","derived","variant","shape","placeholder","inlineSize","blockSize","isAnimated","animated","animation","rootStyle","lineStyle","lineIndices","DOT_CX","BAR_X","Spinner","showLabel","cxPos","xPos","Split","trackClassName","Stack","Stat","StatsRowRoot","glyphs","StatsRowItem","hasTrend","tone","trend","StatsRow","Status","SupportingPane","asideLabelledBy","asideLabel","Switch","offColor","onColor","resolvedOffTone","offTone","resolvedOnTone","onTone","controlId","descriptions","offIcon","onIcon","TableRoot","stickyHeader","revealTableFocus","table","viewport","candidate","bounds","left","top","focusedEdge","cell","visibleLeft","visibleRight","pinnedCells","cellBounds","head","visibleTop","visibleBottom","targetBounds","TableScrollContainer","onFocus","TableCaption","TableHead","TableBody","TableFoot","TableRow","TableColumnHeader","ariaSort","sortDirection","onSortChange","sortDisabled","TableRowHeader","TableCell","TableRowActions","Table","TabsStyleContext","TabsIndicator","TabsList","hasExplicitIndicator","showIndicator","TabsTab","badge","TabsPanel","TabsRoot","Tabs","Text","Textarea","onChange","Thumbnail","captionId","hasCaption","caption","imageProps","createToastManager","useToastManager","ToastContent","ToastTitle","ToastDescription","ToastAction","ToastClose","toastTone","type","ToastRoot","toast","closeLabel","ToastViewport","toasts","renderToast","placement","Toast","ToolbarRoot","ToolbarGroup","ToolbarButton","ToolbarSeparator","Toolbar","Tooltip"],"sources":["../src/utils/CollapsiblePanel.tsx","../src/utils/kb.ts","../src/components/Accordion/Accordion.tsx","../src/components/Image/Image.tsx","../src/components/Avatar/Avatar.tsx","../src/components/Badge/Badge.tsx","../src/components/Button/Button.tsx","../src/components/Callout/Callout.tsx","../src/components/Card/Card.tsx","../src/components/Checkbox/Checkbox.tsx","../src/utils/useClipboard.ts","../src/components/Code/tokenize.ts","../src/components/Code/Code.tsx","../src/components/CodeBlock/CodeBlock.tsx","../src/components/Input/Input.tsx","../src/components/Select/Select.tsx","../src/components/Collection/useCollection.ts","../src/components/Collection/Collection.tsx","../src/components/CollectionList/CollectionList.tsx","../src/components/CollectionRow/CollectionRow.tsx","../src/components/MultiSelect/MultiSelect.tsx","../src/components/Combobox/Combobox.tsx","../src/components/Dialog/Dialog.tsx","../src/components/ConfirmAction/ConfirmAction.tsx","../src/components/Container/Container.tsx","../src/components/Link/Link.tsx","../src/components/CopyableText/content.tsx","../src/components/CopyableText/CopyableText.tsx","../src/components/Dashboard/Dashboard.tsx","../src/components/DescriptionList/DescriptionList.tsx","../src/components/Disclosure/Disclosure.tsx","../src/components/EmptyState/EmptyState.tsx","../src/components/ErrorSummary/ErrorSummary.tsx","../src/components/Fieldset/Fieldset.tsx","../src/components/FileInput/FileInput.tsx","../src/components/FormActions/FormActions.tsx","../src/components/Form/Form.tsx","../src/components/Heading/Heading.tsx","../src/components/FormSection/FormSection.tsx","../src/components/Grid/Grid.tsx","../src/components/Gallery/Gallery.tsx","../src/components/Inline/Inline.tsx","../src/components/Menu/Menu.tsx","../src/components/NumberField/NumberField.tsx","../src/components/PageHeader/PageHeader.tsx","../src/components/Panel/Panel.tsx","../src/components/Popover/Popover.tsx","../src/components/Progress/Progress.tsx","../src/components/RadioGroup/RadioGroup.tsx","../src/components/ScrollArea/ScrollArea.tsx","../src/components/Separator/Separator.tsx","../src/components/Settings/Settings.tsx","../src/components/Skeleton/Skeleton.tsx","../src/components/Spinner/Spinner.tsx","../src/components/Split/Split.tsx","../src/components/Stack/Stack.tsx","../src/components/Stat/Stat.tsx","../src/components/StatsRow/StatsRow.tsx","../src/components/Status/Status.tsx","../src/components/SupportingPane/SupportingPane.tsx","../src/components/Switch/Switch.tsx","../src/components/Table/Table.tsx","../src/components/Tabs/Tabs.tsx","../src/components/Text/Text.tsx","../src/components/Textarea/Textarea.tsx","../src/components/Thumbnail/Thumbnail.tsx","../src/components/Toast/Toast.tsx","../src/components/Toolbar/Toolbar.tsx","../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cloneElement, isValidElement } from \"react\";\n\ntype CollapsiblePanelProps<State> = {\n nativeProps: useRender.ElementProps<\"div\">;\n state: State;\n render?: useRender.RenderProp<State> | undefined;\n};\n\nexport function CollapsiblePanel<State extends { open: boolean }>({\n nativeProps,\n state,\n render,\n}: CollapsiblePanelProps<State>) {\n const exiting = !state.open && !nativeProps.hidden;\n return useRender({\n props: {\n ...nativeProps,\n // Block focus during exit; settled hidden-until-found content stays searchable.\n inert: exiting || nativeProps.inert,\n },\n render:\n typeof render === \"function\"\n ? (props) => render(props, state)\n : exiting && isValidElement<{ inert?: boolean }>(render)\n ? cloneElement(render, { inert: true })\n : render,\n });\n}\n","import { clsx } from \"clsx\";\n\nexport type KbAttrs = Record<string, string | boolean | undefined>;\n// Extra classes per inner part, applied after kbui's own class.\nexport type ClassNames<Slot extends string> = Partial<Record<Slot, string>>;\nexport type KbProps = { className: string } & Record<`data-${string}`, string>;\nexport type AriaInvalid = boolean | \"false\" | \"true\" | \"grammar\" | \"spelling\" | undefined;\n\n// false/undefined vanish so data-disabled=\"false\" can never leak into the DOM.\nexport function kb(name: string, attrs: KbAttrs = {}, className?: string): KbProps {\n const out: KbProps = { className: clsx(`kb-${name}`, className) };\n for (const [key, value] of Object.entries(attrs)) {\n if (value === undefined || value === false) continue;\n out[`data-${key}`] = value === true ? \"\" : value;\n }\n return out;\n}\n\n// Preserves caller aria-invalid tokens (e.g. \"grammar\") while syncing wrapper data-invalid.\nexport function resolveInvalid(\n hasError: boolean,\n ariaInvalid?: AriaInvalid,\n): { invalid: boolean; ariaInvalid: AriaInvalid } {\n const hasAria = ariaInvalid !== undefined && ariaInvalid !== false && ariaInvalid !== \"false\";\n const invalid = hasError || hasAria;\n return { invalid, ariaInvalid: hasAria ? ariaInvalid : invalid ? true : ariaInvalid };\n}\n","import { Accordion as Base } from \"@base-ui/react/accordion\";\nimport { CollapsiblePanel } from \"../../utils/CollapsiblePanel\";\nimport { kb } from \"../../utils/kb\";\n\nexport type AccordionProps<Value = string> = Omit<Base.Root.Props<Value>, \"className\"> & {\n /** Plain class string on root. */\n className?: string | undefined;\n};\nexport type AccordionItemProps = Omit<Base.Item.Props, \"className\"> & {\n /** Plain class string on item. */\n className?: string | undefined;\n};\nexport type AccordionHeaderProps = Omit<Base.Header.Props, \"className\"> & {\n /** Plain class string on heading; use render to set heading rank. */\n className?: string | undefined;\n};\nexport type AccordionTriggerProps = Omit<Base.Trigger.Props, \"className\"> & {\n /** Plain class string on trigger. */\n className?: string | undefined;\n};\nexport type AccordionPanelProps = Omit<Base.Panel.Props, \"className\"> & {\n /** Plain class string on panel. */\n className?: string | undefined;\n};\n\nfunction AccordionRoot<Value = string>({ className, ...props }: AccordionProps<Value>) {\n return <Base.Root {...props} {...kb(\"accordion\", {}, className)} />;\n}\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return <Base.Item {...props} {...kb(\"accordion-item\", {}, className)} />;\n}\nfunction AccordionHeader({ className, ...props }: AccordionHeaderProps) {\n return <Base.Header {...props} {...kb(\"accordion-header\", {}, className)} />;\n}\nfunction AccordionTrigger({ className, ...props }: AccordionTriggerProps) {\n return <Base.Trigger {...props} {...kb(\"accordion-trigger\", {}, className)} />;\n}\nfunction AccordionPanel({ className, children, render, ...props }: AccordionPanelProps) {\n return (\n <Base.Panel\n {...props}\n {...kb(\"accordion-panel\", {}, className)}\n render={(nativeProps, state) => (\n <CollapsiblePanel nativeProps={nativeProps} state={state} render={render} />\n )}\n >\n <div className=\"kb-accordion-panel-content\">{children}</div>\n </Base.Panel>\n );\n}\n\nexport const Accordion = Object.assign(AccordionRoot, {\n Item: AccordionItem,\n Header: AccordionHeader,\n Trigger: AccordionTrigger,\n Panel: AccordionPanel,\n});\n","import { type ComponentProps, type CSSProperties, type ReactNode, useState } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ImageRatio = \"square\" | \"landscape\" | \"portrait\" | \"wide\" | \"auto\";\ntype SourceProps = Pick<\n ComponentProps<\"img\">,\n | \"src\"\n | \"srcSet\"\n | \"sizes\"\n | \"width\"\n | \"height\"\n | \"loading\"\n | \"decoding\"\n | \"crossOrigin\"\n | \"referrerPolicy\"\n | \"fetchPriority\"\n | \"onLoad\"\n | \"onError\"\n>;\nexport type ImageProps = Omit<ComponentProps<\"span\">, \"children\" | \"onLoad\" | \"onError\"> &\n SourceProps & {\n /** Image alternative; empty string marks decorative media. */\n alt: string;\n /** Reserved frame ratio; auto uses width/height, then landscape. */\n ratio?: ImageRatio | undefined;\n /** Crop to fill frame or keep entire image visible. */\n fit?: \"cover\" | \"contain\" | undefined;\n /** Focal point within image frame. */\n position?: CSSProperties[\"objectPosition\"] | undefined;\n /** Non-interactive visual shown while missing, loading or failed. */\n fallback?: ReactNode | undefined;\n /** Extra classes for frame, image and fallback. */\n classNames?: ClassNames<\"root\" | \"image\" | \"fallback\"> | undefined;\n };\n\nexport function Image(props: ImageProps) {\n // New request gets fresh state; late events cannot overwrite another source.\n return <ImageFrame key={JSON.stringify([props.src, props.srcSet, props.sizes])} {...props} />;\n}\n\nfunction ImageFrame({\n src,\n srcSet,\n sizes,\n width,\n height,\n loading,\n decoding = \"async\",\n crossOrigin,\n referrerPolicy,\n fetchPriority,\n onLoad,\n onError,\n alt,\n ratio = \"landscape\",\n fit = \"cover\",\n position,\n fallback,\n className,\n classNames,\n style,\n ...props\n}: ImageProps) {\n const hasSource = Boolean(src?.trim() || srcSet?.trim());\n const [state, setState] = useState<\"loading\" | \"loaded\" | \"error\">(\"loading\");\n const intrinsicRatio =\n Number(width) > 0 && Number(height) > 0 ? `${width} / ${height}` : undefined;\n return (\n <span\n {...props}\n {...kb(\n \"image\",\n { ratio, fit, state: hasSource ? state : \"empty\" },\n classNames?.root ?? className,\n )}\n role=\"img\"\n aria-label={props[\"aria-label\"] ?? (alt || undefined)}\n aria-hidden={alt ? props[\"aria-hidden\"] : true}\n style={{\n ...(ratio === \"auto\" && intrinsicRatio ? { aspectRatio: intrinsicRatio } : {}),\n ...style,\n }}\n >\n <span {...kb(\"image-fallback\", {}, classNames?.fallback)} aria-hidden=\"true\">\n {fallback ?? (\n <svg\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n aria-hidden=\"true\"\n >\n <rect x=\"4\" y=\"5\" width=\"24\" height=\"22\" rx=\"3\" />\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" />\n <path d=\"m5 23 7-7 5 5 4-4 6 6\" />\n </svg>\n )}\n </span>\n {hasSource && (\n <img\n {...kb(\"image-image\", {}, classNames?.image)}\n src={src?.trim() || undefined}\n srcSet={srcSet?.trim() || undefined}\n sizes={sizes}\n width={width}\n height={height}\n loading={loading}\n decoding={decoding}\n crossOrigin={crossOrigin}\n referrerPolicy={referrerPolicy}\n fetchPriority={fetchPriority}\n alt=\"\"\n aria-hidden=\"true\"\n style={{ objectPosition: position }}\n ref={(image) => {\n if (image?.complete && image.naturalWidth > 0) setState(\"loaded\");\n }}\n onLoad={(event) => {\n setState(\"loaded\");\n onLoad?.(event);\n }}\n onError={(event) => {\n setState(\"error\");\n onError?.(event);\n }}\n />\n )}\n </span>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Image, type ImageProps } from \"../Image/Image\";\n\nexport type AvatarShape = \"circle\" | \"square\" | \"rounded\" | \"hexagon\" | \"diamond\";\n\nexport type AvatarProps = Omit<ComponentProps<\"span\">, \"children\" | \"onLoad\" | \"onError\"> &\n Pick<ImageProps, \"src\" | \"srcSet\" | \"sizes\" | \"loading\" | \"onLoad\" | \"onError\"> & {\n /** Full identity; remains accessible when photo fails. */\n name: string;\n /** Caller-owned initials; defaults to first and last name initials. */\n initials?: string | undefined;\n /** Hide duplicate identity beside visible text. */\n decorative?: boolean | undefined;\n /** Fixed identity dimensions. */\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | undefined;\n /** Identity silhouette; photo and initials remain upright. */\n shape?: AvatarShape | undefined;\n /** Extra classes for root, media and initials. */\n classNames?: ClassNames<\"root\" | \"media\" | \"initials\"> | undefined;\n };\n\nexport function Avatar({\n name,\n initials,\n decorative = false,\n size = \"md\",\n shape = \"circle\",\n src,\n srcSet,\n sizes,\n loading,\n onLoad,\n onError,\n className,\n classNames,\n ...props\n}: AvatarProps) {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const letters = [words[0], ...(words.length > 1 ? [words.at(-1)] : [])]\n .map((word) => Array.from(word ?? \"\")[0] ?? \"\")\n .join(\"\")\n .toLocaleUpperCase();\n return (\n <span\n {...props}\n {...kb(\"avatar\", { size, shape }, classNames?.root ?? className)}\n role=\"img\"\n aria-label={\n decorative ? undefined : (props[\"aria-label\"] ?? (name.trim() || \"Unknown person\"))\n }\n aria-hidden={decorative ? true : props[\"aria-hidden\"]}\n >\n <Image\n {...kb(\"avatar-media\", {}, classNames?.media)}\n src={src}\n srcSet={srcSet}\n sizes={sizes}\n loading={loading}\n onLoad={onLoad}\n onError={onError}\n alt=\"\"\n ratio=\"square\"\n fallback={\n <span {...kb(\"avatar-initials\", {}, classNames?.initials)}>\n {initials?.trim() || letters || \"?\"}\n </span>\n }\n />\n </span>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type BadgeTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type BadgeAppearance = \"chip\" | \"plain\";\n\n/** Static metadata label; use Status for a state that changes. */\nexport type BadgeProps = ComponentProps<\"span\"> & {\n /** Ink and tint. */\n tone?: BadgeTone;\n /** Chip draws a tinted ring; plain is inline text. */\n appearance?: BadgeAppearance;\n /** Small uppercase monospace, for identifiers and roles. */\n mono?: boolean;\n /** Keep the text's case and spacing, for case-sensitive values such as branches and paths. */\n preserveCase?: boolean;\n};\n\nexport function Badge({\n tone = \"neutral\",\n appearance = \"chip\",\n mono = false,\n preserveCase = false,\n className,\n ...props\n}: BadgeProps) {\n return (\n <span\n {...props}\n {...kb(\"badge\", { tone, appearance, mono, \"preserve-case\": preserveCase }, className)}\n />\n );\n}\n","import { Button as Base } from \"@base-ui/react/button\";\nimport { kb } from \"../../utils/kb\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\n\ntype ButtonBaseProps = Omit<Base.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Action emphasis: primary main, secondary supporting, ghost quiet, danger destructive. */\n variant?: ButtonVariant;\n};\n\n/** Navigation use: pass render={<a href/>} nativeButton={false} role=\"link\". Icon size needs aria-label. */\nexport type ButtonProps = ButtonBaseProps &\n (\n | {\n /** Height and padding scale; icon is a square for a lone icon. */\n size?: Exclude<ButtonSize, \"icon\">;\n }\n | { size: \"icon\"; \"aria-label\": string }\n );\n\nexport function Button({ variant = \"primary\", size = \"md\", className, ...props }: ButtonProps) {\n return <Base {...props} {...kb(\"button\", { variant, size }, className)} />;\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type CalloutTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\n/** Inline message with optional actions; text carries the meaning, tone only reinforces it. */\nexport type CalloutProps = Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Ink of the edge, tint and icon. */\n tone?: CalloutTone;\n /** Short heading line. */\n title?: ReactNode;\n /** Caller-provided decorative icon. */\n icon?: ReactNode;\n /** Buttons that resolve the message. */\n actions?: ReactNode;\n /** Announce changes: adds role=\"status\" and nothing else. */\n live?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"icon\" | \"content\" | \"title\" | \"body\" | \"actions\">;\n};\n\nexport function Callout({\n classNames,\n tone = \"neutral\",\n title,\n icon,\n actions,\n live = false,\n className,\n children,\n ...props\n}: CalloutProps) {\n return (\n <div {...props} {...(live ? { role: \"status\" } : {})} {...kb(\"callout\", { tone }, className)}>\n {icon != null ? (\n <span className={clsx(\"kb-callout-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <div className={clsx(\"kb-callout-content\", classNames?.content)}>\n {title != null ? (\n <div className={clsx(\"kb-callout-title\", classNames?.title)}>{title}</div>\n ) : null}\n <div className={clsx(\"kb-callout-body\", classNames?.body)}>{children}</div>\n {actions != null ? (\n <div className={clsx(\"kb-callout-actions\", classNames?.actions)}>{actions}</div>\n ) : null}\n </div>\n </div>\n );\n}\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\ntype Container = \"article\" | \"div\" | \"li\";\nexport type CardProps<T extends Container = \"article\"> = ComponentProps<T> & {\n /** Semantic container; links and controls stay caller-owned. */\n as?: T;\n /** Outlined surface or unstyled list content. */\n appearance?: \"outlined\" | \"plain\";\n};\n\nexport function Card<T extends Container = \"article\">({\n as,\n appearance = \"outlined\",\n className,\n ...props\n}: CardProps<T>) {\n return createElement(as ?? \"article\", { ...props, ...kb(\"card\", { appearance }, className) });\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useId, useImperativeHandle, useLayoutEffect, useRef } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type CheckboxProps = Omit<\n ComponentProps<\"input\">,\n \"type\" | \"checked\" | \"defaultChecked\" | \"onChange\" | \"size\"\n> & {\n /** Visible accessible label. */\n label: string;\n /** Controlled checked state. */\n checked: boolean;\n /** Receives next checked state; mixed resolves to checked. */\n onCheckedChange: (checked: boolean) => void;\n /** Announce a mixed aggregate selection. */\n indeterminate?: boolean;\n /** Hide label text visually. */\n visuallyHidden?: boolean;\n /** Helper text associated with the input. */\n description?: string;\n /** Visible error; marks the input invalid. */\n error?: string;\n /** Class on the native input slot. */\n controlClassName?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"control\" | \"label\" | \"mark\" | \"tick\" | \"mixed\" | \"description\" | \"error\"\n >;\n};\nexport function Checkbox({\n classNames,\n label,\n checked,\n onCheckedChange,\n indeterminate = false,\n visuallyHidden,\n description,\n error,\n disabled,\n readOnly,\n className,\n controlClassName,\n id: providedId,\n ref,\n style,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: CheckboxProps) {\n const generated = useId();\n const id = providedId ?? generated;\n const input = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => input.current as HTMLInputElement);\n useLayoutEffect(() => {\n if (input.current) input.current.indeterminate = indeterminate;\n });\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n props[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n const theme = Object.fromEntries(\n Object.entries(style ?? {}).filter(([property]) => property.startsWith(\"--\")),\n );\n return (\n <div {...kb(\"checkbox\", { disabled, invalid }, className)} style={theme}>\n <input\n {...props}\n style={style}\n id={id}\n ref={input}\n type=\"checkbox\"\n checked={checked}\n aria-checked={indeterminate ? \"mixed\" : checked}\n disabled={disabled}\n readOnly={readOnly}\n aria-readonly={readOnly || undefined}\n aria-invalid={ariaInvalid}\n aria-describedby={described}\n className={clsx(\"kb-checkbox-control\", classNames?.control, controlClassName)}\n onChange={(event) => {\n event.target.indeterminate = indeterminate;\n if (!disabled && !readOnly) onCheckedChange(indeterminate ? true : event.target.checked);\n }}\n />\n <span className={clsx(\"kb-checkbox-mark\", classNames?.mark)} aria-hidden=\"true\">\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <path className={clsx(\"kb-checkbox-tick\", classNames?.tick)} d=\"m3 8 3 3 7-7\" />\n <path className={clsx(\"kb-checkbox-mixed\", classNames?.mixed)} d=\"M3 8h10\" />\n </svg>\n </span>\n <label\n htmlFor={id}\n className={clsx(\"kb-checkbox-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-checkbox-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-checkbox-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { useEffect, useRef, useState } from \"react\";\n\nexport type CopyState = \"idle\" | \"pending\" | \"copied\" | \"failed\";\n\nexport type CopyFeedbackProps = {\n /** Disable copying while keeping content selectable. */\n disabled?: boolean | undefined;\n /** Idle copy button text and accessible name. */\n copyLabel?: string | undefined;\n /** Pending copy button text. */\n copyingLabel?: string | undefined;\n /** Successful copy button text. */\n copiedLabel?: string | undefined;\n /** Failed copy button text; activation retries. */\n copyErrorLabel?: string | undefined;\n /** Polite success announcement. */\n successMessage?: string | undefined;\n /** Visible, polite failure message with recovery instructions. */\n errorMessage?: string | undefined;\n /** Success feedback lifetime in milliseconds; zero keeps feedback until next action. */\n feedbackDuration?: number | undefined;\n /** Called after clipboard write succeeds for current content. */\n onCopy?: ((value: string) => void) | undefined;\n /** Called when current clipboard write fails, including unavailable Clipboard API. */\n onCopyError?: ((error: unknown) => void) | undefined;\n};\n\nexport function useClipboard(\n value: string,\n { disabled = false, feedbackDuration = 2000, onCopy, onCopyError }: CopyFeedbackProps,\n) {\n const [feedback, setFeedback] = useState({ value, disabled, status: \"idle\" as CopyState });\n const epoch = useRef(0);\n const busy = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const state =\n feedback.value === value && feedback.disabled === disabled ? feedback.status : \"idle\";\n\n useEffect(() => {\n setFeedback({ value, disabled, status: \"idle\" });\n return () => {\n // Ignore writes completed after content changes, disable, or unmount.\n epoch.current += 1;\n busy.current = false;\n clearTimeout(timer.current);\n };\n }, [value, disabled]);\n\n async function copy() {\n if (disabled || value.length === 0 || busy.current) return;\n const request = ++epoch.current;\n busy.current = true;\n clearTimeout(timer.current);\n setFeedback({ value, disabled, status: \"pending\" });\n try {\n if (typeof navigator === \"undefined\" || !navigator.clipboard?.writeText) {\n throw new Error(\"Clipboard unavailable\");\n }\n await navigator.clipboard.writeText(value);\n } catch (error) {\n if (request !== epoch.current) return;\n busy.current = false;\n setFeedback({ value, disabled, status: \"failed\" });\n onCopyError?.(error);\n return;\n }\n if (request !== epoch.current) return;\n busy.current = false;\n setFeedback({ value, disabled, status: \"copied\" });\n const duration =\n Number.isFinite(feedbackDuration) && feedbackDuration >= 0 ? feedbackDuration : 2000;\n if (duration > 0) {\n timer.current = setTimeout(() => {\n if (request === epoch.current) setFeedback({ value, disabled, status: \"idle\" });\n }, duration);\n }\n // Consumer callback errors must not turn successful writes into copy failures.\n onCopy?.(value);\n }\n\n return { state, copy, disabled: disabled || value.length === 0 };\n}\n","export type CodeLanguage =\n | \"tsx\"\n | \"ts\"\n | \"typescript\"\n | \"jsx\"\n | \"js\"\n | \"javascript\"\n | \"css\"\n | \"html\"\n | \"json\"\n | \"bash\"\n | \"sh\"\n | \"shell\"\n | \"shellscript\"\n | \"plain\"\n | \"text\";\n\nexport type CodeSyntaxKind =\n | \"keyword\"\n | \"string\"\n | \"comment\"\n | \"number\"\n | \"tag\"\n | \"attribute\"\n | \"type\"\n | \"function\"\n | \"operator\"\n | \"property\";\n\nexport type CodeToken = readonly [start: number, end: number, kind: CodeSyntaxKind];\n\nconst LANGUAGE_LABELS: Record<CodeLanguage, string | undefined> = {\n tsx: \"TSX\",\n ts: \"TS\",\n typescript: \"TS\",\n jsx: \"JSX\",\n js: \"JS\",\n javascript: \"JS\",\n css: \"CSS\",\n html: \"HTML\",\n json: \"JSON\",\n bash: \"Shell\",\n sh: \"Shell\",\n shell: \"Shell\",\n shellscript: \"Shell\",\n plain: undefined,\n text: undefined,\n};\n\nexport function formatCodeLanguage(language?: CodeLanguage): string | undefined {\n if (!language) return undefined;\n return language in LANGUAGE_LABELS ? LANGUAGE_LABELS[language] : String(language).toUpperCase();\n}\n\nconst TS_KEYWORDS = new Set([\n \"as\",\n \"async\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"from\",\n \"function\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"infer\",\n \"instanceof\",\n \"interface\",\n \"keyof\",\n \"let\",\n \"new\",\n \"null\",\n \"of\",\n \"private\",\n \"protected\",\n \"public\",\n \"readonly\",\n \"return\",\n \"satisfies\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"type\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n \"yield\",\n]);\n\nconst TS_BUILTIN_TYPES = new Set([\n \"Array\",\n \"Boolean\",\n \"CSSProperties\",\n \"ComponentProps\",\n \"Date\",\n \"Error\",\n \"Exclude\",\n \"Extract\",\n \"HTMLButtonElement\",\n \"HTMLDivElement\",\n \"HTMLElement\",\n \"HTMLInputElement\",\n \"Map\",\n \"NonNullable\",\n \"Number\",\n \"Omit\",\n \"Parameters\",\n \"Partial\",\n \"Pick\",\n \"Promise\",\n \"ReactElement\",\n \"ReactNode\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Ref\",\n \"RegExp\",\n \"Required\",\n \"ReturnType\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"any\",\n \"bigint\",\n \"boolean\",\n \"never\",\n \"number\",\n \"object\",\n \"string\",\n \"symbol\",\n \"unknown\",\n]);\n\nconst TS_EXPR_KEYWORDS = new Set([\n \"await\",\n \"case\",\n \"delete\",\n \"else\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"of\",\n \"return\",\n \"throw\",\n \"typeof\",\n \"void\",\n \"yield\",\n]);\n\nconst TS_TYPE_LEAD_KEYWORDS = new Set([\n \"as\",\n \"class\",\n \"enum\",\n \"extends\",\n \"implements\",\n \"interface\",\n \"satisfies\",\n \"type\",\n]);\n\nconst CSS_KEYWORDS = new Set([\n \"!important\",\n \"absolute\",\n \" anywhere\",\n \"auto\",\n \"baseline\",\n \"block\",\n \"bold\",\n \"border-box\",\n \"both\",\n \"break-spaces\",\n \"center\",\n \"clone\",\n \"column\",\n \"contain\",\n \"content-box\",\n \"currentColor\",\n \"dashed\",\n \"dotted\",\n \"ease\",\n \"ease-in\",\n \"ease-in-out\",\n \"ease-out\",\n \"end\",\n \"fixed\",\n \"flex\",\n \"grid\",\n \"hidden\",\n \"inberg\",\n \"inherit\",\n \"initial\",\n \"inline\",\n \"inline-block\",\n \"inline-flex\",\n \"inset\",\n \"italic\",\n \"linear\",\n \"max-content\",\n \"min-content\",\n \"none\",\n \"normal\",\n \"nowrap\",\n \"pointer\",\n \"relative\",\n \"revert\",\n \"row\",\n \" scroll\",\n \"slice\",\n \"solid\",\n \"space-between\",\n \"start\",\n \"static\",\n \"sticky\",\n \" stretch\",\n \"tabular-nums\",\n \"transparent\",\n \"unset\",\n \"uppercase\",\n \"visible\",\n \"wrap\",\n]);\n\nconst SHELL_KEYWORDS = new Set([\n \"case\",\n \"do\",\n \"done\",\n \"elif\",\n \"else\",\n \"esac\",\n \"exit\",\n \"export\",\n \"false\",\n \"fi\",\n \"for\",\n \"function\",\n \"if\",\n \"in\",\n \"local\",\n \"readonly\",\n \"return\",\n \"set\",\n \"then\",\n \"true\",\n \"unset\",\n \"until\",\n \"while\",\n]);\n\nfunction isIdentStart(ch: string | undefined): boolean {\n return ch !== undefined && /[A-Za-z_$]/.test(ch);\n}\n\nfunction isIdentChar(ch: string | undefined): boolean {\n return ch !== undefined && /[\\w$]/.test(ch);\n}\n\nfunction scanQuotedString(code: string, start: number, allowMultiline: boolean): number {\n const quote = code[start];\n let i = start + 1;\n while (i < code.length) {\n const ch = code[i];\n if (ch === \"\\\\\") {\n i += 2;\n continue;\n }\n if (ch === quote) return i + 1;\n if (!allowMultiline && ch === \"\\n\") return i;\n i += 1;\n }\n return code.length;\n}\n\n// Finds matching '}' while skipping nested braces, strings, and comments.\nfunction findMatchingBrace(code: string, openPos: number): number {\n let depth = 1;\n let i = openPos + 1;\n while (i < code.length && depth > 0) {\n const ch = code[i];\n if (code.startsWith(\"//\", i)) {\n const nl = code.indexOf(\"\\n\", i + 2);\n i = nl === -1 ? code.length : nl + 1;\n continue;\n }\n if (code.startsWith(\"/*\", i)) {\n const end = code.indexOf(\"*/\", i + 2);\n i = end === -1 ? code.length : end + 2;\n continue;\n }\n if (ch === \"'\" || ch === '\"') {\n i = scanQuotedString(code, i, false);\n continue;\n }\n if (ch === \"`\") {\n i = scanQuotedString(code, i, true);\n continue;\n }\n if (ch === \"{\") depth += 1;\n else if (ch === \"}\") depth -= 1;\n i += 1;\n }\n return i - 1;\n}\n\nfunction tokenizeTsx(code: string, baseOffset = 0): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let lastWord = \"\";\n let prevNonSpaceChar = \"\";\n let jsxDepth = 0;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([baseOffset + start, baseOffset + end, kind]);\n };\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (jsxDepth > 0) {\n if (ch === \"{\") {\n const closeBrace = findMatchingBrace(code, i);\n const exprEnd = closeBrace > i ? closeBrace : code.length;\n tokens.push(...tokenizeTsx(code.slice(i + 1, exprEnd), baseOffset + i + 1));\n i = closeBrace < code.length ? closeBrace + 1 : code.length;\n continue;\n }\n if (\n ch !== \"<\" ||\n (code[i + 1] !== \"/\" && code[i + 1] !== \">\" && !isIdentStart(code[i + 1]))\n ) {\n i += 1;\n continue;\n }\n }\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (code.startsWith(\"//\", i)) {\n const nl = code.indexOf(\"\\n\", i + 2);\n const end = nl === -1 ? code.length : nl;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (code.startsWith(\"/*\", i)) {\n const close = code.indexOf(\"*/\", i + 2);\n const end = close === -1 ? code.length : close + 2;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n prevNonSpaceChar = ch;\n lastWord = \"\";\n i = end;\n continue;\n }\n\n if (ch === \"`\") {\n let segStart = i;\n let cursor = i + 1;\n while (cursor < code.length) {\n const c = code[cursor];\n if (c === \"\\\\\") {\n cursor += 2;\n continue;\n }\n if (c === \"`\") {\n cursor += 1;\n break;\n }\n if (c === \"$\" && code[cursor + 1] === \"{\") {\n push(segStart, cursor + 2, \"string\");\n const closeBrace = findMatchingBrace(code, cursor + 1);\n const exprEnd = closeBrace >= cursor + 2 ? closeBrace : code.length;\n const expr = code.slice(cursor + 2, exprEnd);\n tokens.push(...tokenizeTsx(expr, baseOffset + cursor + 2));\n if (closeBrace < code.length && code[closeBrace] === \"}\") {\n segStart = closeBrace;\n cursor = closeBrace + 1;\n } else {\n segStart = code.length;\n cursor = code.length;\n }\n continue;\n }\n cursor += 1;\n }\n if (cursor > segStart) push(segStart, cursor, \"string\");\n prevNonSpaceChar = \"`\";\n lastWord = \"\";\n i = cursor;\n continue;\n }\n\n // JSX fragment opening: <>\n if (ch === \"<\" && code[i + 1] === \">\") {\n push(i, i + 2, \"operator\");\n i += 2;\n jsxDepth += 1;\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n\n // JSX closing tag: </Tag> or </>\n if (ch === \"<\" && code[i + 1] === \"/\") {\n push(i, i + 2, \"operator\");\n i += 2;\n while (i < code.length && /\\s/.test(code.charAt(i))) i += 1;\n const tagMatch = /^[A-Za-z_$][\\w$.-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n while (i < code.length && /\\s/.test(code.charAt(i))) i += 1;\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n }\n jsxDepth = Math.max(0, jsxDepth - 1);\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n\n // JSX opening tag when '<Ident' appears in expression position (not generic call/type).\n if (ch === \"<\" && isIdentStart(code[i + 1])) {\n const isGenericAfterIdent =\n jsxDepth === 0 && isIdentChar(prevNonSpaceChar) && !TS_EXPR_KEYWORDS.has(lastWord);\n if (!isGenericAfterIdent) {\n push(i, i + 1, \"operator\");\n i += 1;\n const tagMatch = /^[A-Za-z_$][\\w$.-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n let selfClosing = false;\n // Scan JSX attributes until closing '>' or '/>'.\n while (i < code.length) {\n if (/\\s/.test(code.charAt(i))) {\n i += 1;\n continue;\n }\n if (code.startsWith(\"/>\", i)) {\n push(i, i + 2, \"operator\");\n i += 2;\n selfClosing = true;\n break;\n }\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n break;\n }\n if (code[i] === \"'\" || code[i] === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n if (code[i] === \"{\") {\n const closeBrace = findMatchingBrace(code, i);\n const exprEnd = closeBrace > i ? closeBrace : code.length;\n tokens.push(...tokenizeTsx(code.slice(i + 1, exprEnd), baseOffset + i + 1));\n i = closeBrace < code.length ? closeBrace + 1 : code.length;\n continue;\n }\n if (code[i] === \"=\") {\n push(i, i + 1, \"operator\");\n i += 1;\n continue;\n }\n const attrMatch = /^[A-Za-z_$][\\w$-]*/.exec(code.slice(i));\n if (attrMatch) {\n push(i, i + attrMatch[0].length, \"attribute\");\n i += attrMatch[0].length;\n continue;\n }\n i += 1;\n }\n if (!selfClosing) jsxDepth += 1;\n prevNonSpaceChar = \">\";\n lastWord = \"\";\n continue;\n }\n }\n\n const numMatch =\n /^(?:0[xX][\\da-fA-F_]+n?|0[bB][01_]+n?|0[oO][0-7_]+n?|\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d[\\d_]*)?n?)/.exec(\n code.slice(i),\n );\n if (numMatch) {\n const len = numMatch[0].length;\n push(i, i + len, \"number\");\n prevNonSpaceChar = code.charAt(i + len - 1);\n lastWord = \"\";\n i += len;\n continue;\n }\n\n if (isIdentStart(ch)) {\n const identMatch = /^[A-Za-z_$][\\w$]*/.exec(code.slice(i));\n const word = identMatch ? identMatch[0] : ch;\n const end = i + word.length;\n const afterSlice = code.slice(end);\n const isCall = /^\\s*(?:<[^>\\n]+>\\s*)?\\(/.test(afterSlice);\n const isObjKey =\n (prevNonSpaceChar === \"{\" || prevNonSpaceChar === \",\") && /^\\s*:(?!:)/.test(afterSlice);\n\n if (prevNonSpaceChar === \".\") {\n push(i, end, isCall ? \"function\" : \"property\");\n } else if (isObjKey) {\n push(i, end, \"property\");\n } else if (TS_KEYWORDS.has(word)) {\n push(i, end, \"keyword\");\n } else if (TS_BUILTIN_TYPES.has(word)) {\n push(i, end, \"type\");\n } else if (\n TS_TYPE_LEAD_KEYWORDS.has(lastWord) ||\n (prevNonSpaceChar === \":\" && /^[A-Z]/.test(word)) ||\n (prevNonSpaceChar === \"<\" && /^[A-Z]/.test(word))\n ) {\n push(i, end, \"type\");\n } else if (isCall) {\n push(i, end, \"function\");\n } else if (/^[A-Z]/.test(word)) {\n push(i, end, \"type\");\n }\n\n prevNonSpaceChar = word.charAt(word.length - 1);\n lastWord = word;\n i = end;\n continue;\n }\n\n const opMatch = /^(?:=>|===|!==|==|!=|<=|>=|&&|\\|\\||\\?\\?|\\?\\.|\\.\\.\\.|[+\\-*/%=<>!&|^~?:])/.exec(\n code.slice(i),\n );\n if (opMatch) {\n const op = opMatch[0];\n push(i, i + op.length, \"operator\");\n prevNonSpaceChar = op.charAt(op.length - 1);\n i += op.length;\n continue;\n }\n\n prevNonSpaceChar = ch;\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeCss(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let braceDepth = 0;\n let inAtRuleHeader = false;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([start, end, kind]);\n };\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (code.startsWith(\"/*\", i)) {\n const close = code.indexOf(\"*/\", i + 2);\n const end = close === -1 ? code.length : close + 2;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n\n if (ch === \"@\") {\n const m = /^@[A-Za-z_-][\\w-]*/.exec(code.slice(i));\n if (m) {\n push(i, i + m[0].length, \"keyword\");\n inAtRuleHeader = true;\n i += m[0].length;\n continue;\n }\n }\n\n if (ch === \"{\") {\n braceDepth += 1;\n inAtRuleHeader = false;\n i += 1;\n continue;\n }\n\n if (ch === \"}\") {\n braceDepth = Math.max(0, braceDepth - 1);\n i += 1;\n continue;\n }\n\n if (ch === \";\") {\n inAtRuleHeader = false;\n i += 1;\n continue;\n }\n\n if (ch === \"[\") {\n const close = code.indexOf(\"]\", i + 1);\n const end = close === -1 ? code.length : close + 1;\n push(i, end, \"attribute\");\n i = end;\n continue;\n }\n\n const numMatch =\n /^(?:#[0-9a-fA-F]{3,8}\\b|-?\\d+(?:\\.\\d+)?(?:px|rem|em|ch|vh|vw|vmin|vmax|%|deg|s|ms|fr)?)/.exec(\n code.slice(i),\n );\n if (numMatch) {\n push(i, i + numMatch[0].length, \"number\");\n i += numMatch[0].length;\n continue;\n }\n\n // Declaration property or media feature before ':'\n const propMatch = /^(--[\\w-]+|[A-Za-z_-][\\w-]*)(?=\\s*:(?!:))/.exec(code.slice(i));\n if (propMatch && (braceDepth > 0 || inAtRuleHeader)) {\n // Distinguish selector pseudo-classes (where '{' comes before ';') from declarations.\n const restAfterColon = code.slice(i + propMatch[0].length).replace(/^\\s*:/, \"\");\n const nextSemi = restAfterColon.indexOf(\";\");\n const nextBrace = restAfterColon.indexOf(\"{\");\n const isDeclaration =\n inAtRuleHeader || (nextSemi !== -1 && (nextBrace === -1 || nextSemi < nextBrace));\n if (isDeclaration) {\n push(i, i + propMatch[0].length, \"attribute\");\n i += propMatch[0].length;\n continue;\n }\n }\n\n const fnMatch = /^[A-Za-z_-][\\w-]*(?=\\()/.exec(code.slice(i));\n if (fnMatch) {\n push(i, i + fnMatch[0].length, \"function\");\n i += fnMatch[0].length;\n continue;\n }\n\n const varMatch = /^--[\\w-]+/.exec(code.slice(i));\n if (varMatch) {\n push(i, i + varMatch[0].length, \"property\");\n i += varMatch[0].length;\n continue;\n }\n\n // Selector tag or class/id outside declarations\n const restToBrace = code.slice(i);\n const nextOpenBrace = restToBrace.indexOf(\"{\");\n const nextSemi = restToBrace.indexOf(\";\");\n const inSelector =\n !inAtRuleHeader && nextOpenBrace !== -1 && (nextSemi === -1 || nextOpenBrace < nextSemi);\n\n if (inSelector) {\n const pseudoMatch = /^::?[A-Za-z_-][\\w-]*/.exec(restToBrace);\n if (pseudoMatch) {\n push(i, i + pseudoMatch[0].length, \"keyword\");\n i += pseudoMatch[0].length;\n continue;\n }\n const selMatch = /^(?:\\.|#)?[A-Za-z_-][\\w-]*/.exec(restToBrace);\n if (selMatch) {\n push(i, i + selMatch[0].length, \"tag\");\n i += selMatch[0].length;\n continue;\n }\n }\n\n const wordMatch = /^!?[A-Za-z_-][\\w-]*/.exec(code.slice(i));\n if (wordMatch) {\n if (CSS_KEYWORDS.has(wordMatch[0])) {\n push(i, i + wordMatch[0].length, \"keyword\");\n }\n i += wordMatch[0].length;\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeHtml(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n\n const push = (start: number, end: number, kind: CodeSyntaxKind) => {\n if (end > start) tokens.push([start, end, kind]);\n };\n\n while (i < code.length) {\n if (code.startsWith(\"<!--\", i)) {\n const close = code.indexOf(\"-->\", i + 4);\n const end = close === -1 ? code.length : close + 3;\n push(i, end, \"comment\");\n i = end;\n continue;\n }\n\n if (/^<!DOCTYPE/i.test(code.slice(i))) {\n const close = code.indexOf(\">\", i + 2);\n const end = close === -1 ? code.length : close + 1;\n push(i, end, \"keyword\");\n i = end;\n continue;\n }\n\n if (code[i] === \"<\" && /^<\\/?[A-Za-z]/.test(code.slice(i))) {\n const isClose = code[i + 1] === \"/\";\n const tagStart = i + (isClose ? 2 : 1);\n push(i, tagStart, \"operator\");\n i = tagStart;\n const tagMatch = /^[A-Za-z][\\w:-]*/.exec(code.slice(i));\n if (tagMatch) {\n push(i, i + tagMatch[0].length, \"tag\");\n i += tagMatch[0].length;\n }\n while (i < code.length) {\n if (/\\s/.test(code.charAt(i))) {\n i += 1;\n continue;\n }\n if (code.startsWith(\"/>\", i)) {\n push(i, i + 2, \"operator\");\n i += 2;\n break;\n }\n if (code[i] === \">\") {\n push(i, i + 1, \"operator\");\n i += 1;\n break;\n }\n if (code[i] === \"'\" || code[i] === '\"') {\n const end = scanQuotedString(code, i, false);\n push(i, end, \"string\");\n i = end;\n continue;\n }\n if (code[i] === \"=\") {\n push(i, i + 1, \"operator\");\n i += 1;\n continue;\n }\n const attrMatch = /^[A-Za-z_:][\\w:.-]*/.exec(code.slice(i));\n if (attrMatch) {\n push(i, i + attrMatch[0].length, \"attribute\");\n i += attrMatch[0].length;\n continue;\n }\n i += 1;\n }\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeJson(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n\n while (i < code.length) {\n const ch = code.charAt(i);\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n if (ch === '\"') {\n const end = scanQuotedString(code, i, false);\n const isKey = /^\\s*:/.test(code.slice(end));\n tokens.push([i, end, isKey ? \"property\" : \"string\"]);\n i = end;\n continue;\n }\n const numMatch = /^-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(code.slice(i));\n if (numMatch) {\n tokens.push([i, i + numMatch[0].length, \"number\"]);\n i += numMatch[0].length;\n continue;\n }\n const kwMatch = /^(?:true|false|null)\\b/.exec(code.slice(i));\n if (kwMatch) {\n tokens.push([i, i + kwMatch[0].length, \"keyword\"]);\n i += kwMatch[0].length;\n continue;\n }\n i += 1;\n }\n\n return tokens;\n}\n\nfunction tokenizeShell(code: string): CodeToken[] {\n const tokens: CodeToken[] = [];\n let i = 0;\n let expectCommand = true;\n\n while (i < code.length) {\n const ch = code.charAt(i);\n\n if (ch === \"\\n\") {\n expectCommand = true;\n i += 1;\n continue;\n }\n\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n\n if (ch === \"#\" && (i === 0 || /[\\s;|&()]/.test(code.charAt(i - 1)))) {\n const nl = code.indexOf(\"\\n\", i + 1);\n const end = nl === -1 ? code.length : nl;\n tokens.push([i, end, \"comment\"]);\n i = end;\n continue;\n }\n\n if (ch === \"'\" || ch === '\"') {\n const end = scanQuotedString(code, i, true);\n tokens.push([i, end, \"string\"]);\n expectCommand = false;\n i = end;\n continue;\n }\n\n const opMatch = /^(?:\\|\\||&&|;;|[|&;><]+|\\$\\()/.exec(code.slice(i));\n if (opMatch) {\n tokens.push([i, i + opMatch[0].length, \"operator\"]);\n expectCommand = true;\n i += opMatch[0].length;\n continue;\n }\n\n const varMatch = /^\\$(?:\\{[A-Za-z_]\\w*\\}|[A-Za-z_]\\w*)/.exec(code.slice(i));\n if (varMatch) {\n tokens.push([i, i + varMatch[0].length, \"property\"]);\n expectCommand = false;\n i += varMatch[0].length;\n continue;\n }\n\n const flagMatch = /^--?[A-Za-z0-9][\\w-]*/.exec(code.slice(i));\n if (flagMatch && (i === 0 || /\\s/.test(code.charAt(i - 1)))) {\n tokens.push([i, i + flagMatch[0].length, \"attribute\"]);\n expectCommand = false;\n i += flagMatch[0].length;\n continue;\n }\n\n const numMatch = /^\\b\\d+(?:\\.\\d+)?\\b/.exec(code.slice(i));\n if (numMatch) {\n tokens.push([i, i + numMatch[0].length, \"number\"]);\n expectCommand = false;\n i += numMatch[0].length;\n continue;\n }\n\n const wordMatch = /^[A-Za-z_][\\w./-]*/.exec(code.slice(i));\n if (wordMatch) {\n const word = wordMatch[0];\n if (SHELL_KEYWORDS.has(word)) {\n tokens.push([i, i + word.length, \"keyword\"]);\n expectCommand = word === \"then\" || word === \"do\" || word === \"else\";\n } else if (expectCommand) {\n tokens.push([i, i + word.length, \"function\"]);\n expectCommand = word === \"sudo\" || word === \"env\" || word === \"npx\" || word === \"bunx\";\n }\n i += word.length;\n continue;\n }\n\n i += 1;\n }\n\n return tokens;\n}\n\nexport function tokenizeCode(code: string, language: CodeLanguage = \"tsx\"): CodeToken[] {\n if (!code || language === \"plain\" || language === \"text\") return [];\n switch (language) {\n case \"css\":\n return tokenizeCss(code);\n case \"html\":\n return tokenizeHtml(code);\n case \"json\":\n return tokenizeJson(code);\n case \"bash\":\n case \"sh\":\n case \"shell\":\n case \"shellscript\":\n return tokenizeShell(code);\n default:\n return tokenizeTsx(code);\n }\n}\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type CSSProperties,\n Fragment,\n type ReactNode,\n type Ref,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { type CopyFeedbackProps, useClipboard } from \"../../utils/useClipboard\";\nimport { type CodeLanguage, type CodeToken, formatCodeLanguage, tokenizeCode } from \"./tokenize\";\n\nexport {\n type CodeLanguage,\n type CodeSyntaxKind,\n type CodeToken,\n tokenizeCode,\n} from \"./tokenize\";\n\nexport type CodePart =\n | \"header\"\n | \"meta\"\n | \"title\"\n | \"language\"\n | \"actions\"\n | \"toggle\"\n | \"copy\"\n | \"feedback\"\n | \"viewport\"\n | \"pre\"\n | \"content\"\n | \"line\"\n | \"lineNumber\"\n | \"lineText\";\n\nexport type CodeProps = Omit<ComponentProps<\"code\">, \"ref\" | \"title\" | \"onCopy\"> &\n CopyFeedbackProps & {\n ref?: Ref<HTMLElement> | undefined;\n block?: boolean | undefined;\n language?: CodeLanguage | undefined;\n title?: string | undefined;\n copyable?: boolean | undefined;\n lineNumbers?: boolean | undefined;\n startLine?: number | undefined;\n highlightLines?: readonly number[] | undefined;\n minLines?: number | undefined;\n collapsible?: boolean | undefined;\n collapsedLines?: number | undefined;\n defaultCollapsed?: boolean | undefined;\n collapsed?: boolean | undefined;\n onCollapsedChange?: ((collapsed: boolean) => void) | undefined;\n maxHeight?: string | number | undefined;\n tokens?: readonly CodeToken[] | undefined;\n classNames?: ClassNames<CodePart> | undefined;\n };\n\nfunction renderLineTokens(\n lineText: string,\n lineStart: number,\n tokens: readonly CodeToken[],\n): ReactNode {\n if (!lineText || tokens.length === 0) return lineText;\n const lineEnd = lineStart + lineText.length;\n const nodes: ReactNode[] = [];\n let cursor = 0;\n\n for (const [tokStart, tokEnd, kind] of tokens) {\n if (tokEnd <= lineStart) continue;\n if (tokStart >= lineEnd) break;\n const start = Math.max(tokStart, lineStart) - lineStart;\n const end = Math.min(tokEnd, lineEnd) - lineStart;\n if (start > cursor) {\n nodes.push(lineText.slice(cursor, start));\n }\n if (end > start) {\n nodes.push(\n <span key={start} data-syntax={kind}>\n {lineText.slice(start, end)}\n </span>,\n );\n cursor = end;\n }\n }\n\n if (cursor === 0) return lineText;\n if (cursor < lineText.length) {\n nodes.push(lineText.slice(cursor));\n }\n return nodes;\n}\n\nexport function Code({\n ref,\n block,\n language,\n title,\n copyable,\n onCopy,\n onCopyError,\n disabled = false,\n feedbackDuration,\n copyLabel = \"Copy code\",\n copyingLabel = \"Copying…\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n successMessage = \"Code copied to clipboard\",\n errorMessage = \"Failed to copy code. Select and copy the text manually.\",\n lineNumbers = false,\n startLine = 1,\n highlightLines,\n minLines,\n collapsible = false,\n collapsedLines,\n defaultCollapsed = false,\n collapsed: collapsedProp,\n onCollapsedChange,\n maxHeight,\n tokens,\n classNames,\n className,\n style,\n children,\n ...props\n}: CodeProps) {\n const viewportId = useId();\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(defaultCollapsed);\n const rawCode = typeof children === \"string\" ? children : \"\";\n const clipboard = useClipboard(rawCode, { disabled, feedbackDuration, onCopy, onCopyError });\n const copyState = clipboard.state;\n const [expandedHeight, setExpandedHeight] = useState<number | undefined>(undefined);\n const preRef = useRef<HTMLPreElement | null>(null);\n\n const resolvedMinLines =\n minLines !== undefined && minLines > 0 ? Math.floor(minLines) : undefined;\n const resolvedCollapsedLines =\n collapsedLines !== undefined && collapsedLines > 0\n ? Math.floor(collapsedLines)\n : collapsible && resolvedMinLines !== undefined\n ? resolvedMinLines\n : undefined;\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: Re-measure when resolvedMinLines changes in non-ResizeObserver environments.\n useEffect(() => {\n if (!collapsible) return;\n const element = preRef.current;\n if (!element) return;\n const measure = () => {\n const next = Math.ceil(element.getBoundingClientRect().height) || element.scrollHeight;\n if (next > 0) setExpandedHeight(next);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [collapsible, resolvedMinLines]);\n\n const hasBlockProps =\n language !== undefined ||\n title !== undefined ||\n copyable !== undefined ||\n lineNumbers ||\n (highlightLines !== undefined && highlightLines.length > 0) ||\n resolvedMinLines !== undefined ||\n collapsible ||\n resolvedCollapsedLines !== undefined ||\n maxHeight !== undefined ||\n tokens !== undefined;\n const isMultilineString = typeof children === \"string\" && children.includes(\"\\n\");\n const isBlock = block ?? (hasBlockProps || isMultilineString);\n\n if (!isBlock) {\n return (\n <code\n {...props}\n ref={ref as Ref<HTMLElement>}\n title={title}\n style={style}\n {...kb(\"code\", {}, className)}\n >\n {children}\n </code>\n );\n }\n\n const isCollapsed = collapsible ? (collapsedProp ?? uncontrolledCollapsed) : false;\n const showCopy = copyable ?? true;\n const languageLabel = formatCodeLanguage(language);\n const hasMeta = Boolean(title || languageLabel);\n const hasActions = Boolean(collapsible || showCopy);\n const showHeader = hasMeta || hasActions;\n\n const resolvedTokens =\n typeof children === \"string\" ? (tokens ?? tokenizeCode(rawCode, language ?? \"tsx\")) : [];\n const lines = typeof children === \"string\" ? rawCode.split(\"\\n\") : [];\n const highlightSet =\n highlightLines && highlightLines.length > 0 ? new Set(highlightLines) : undefined;\n const extraLineCount =\n typeof children === \"string\" &&\n resolvedMinLines !== undefined &&\n resolvedMinLines > lines.length\n ? resolvedMinLines - lines.length\n : 0;\n\n const hasCustomVars =\n maxHeight !== undefined ||\n resolvedMinLines !== undefined ||\n resolvedCollapsedLines !== undefined ||\n (collapsible && expandedHeight !== undefined);\n const blockStyle: CSSProperties | undefined = hasCustomVars\n ? ({\n ...style,\n ...(maxHeight !== undefined\n ? { \"--_code-max-height\": typeof maxHeight === \"number\" ? `${maxHeight}px` : maxHeight }\n : null),\n ...(resolvedMinLines !== undefined\n ? { \"--_code-min-lines\": String(resolvedMinLines) }\n : null),\n ...(resolvedCollapsedLines !== undefined\n ? { \"--_code-collapsed-lines\": String(resolvedCollapsedLines) }\n : null),\n ...(collapsible && expandedHeight !== undefined\n ? { \"--_code-expanded-max-height\": `${expandedHeight}px` }\n : null),\n } as CSSProperties)\n : style;\n\n const handleToggleCollapse = () => {\n const next = !isCollapsed;\n if (collapsedProp === undefined) {\n setUncontrolledCollapsed(next);\n }\n onCollapsedChange?.(next);\n };\n\n const resolvedCopyLabel = {\n idle: copyLabel,\n pending: copyingLabel,\n copied: copiedLabel,\n failed: copyErrorLabel,\n }[copyState];\n const copyAnnouncement =\n copyState === \"copied\"\n ? successMessage\n : copyState === \"failed\"\n ? errorMessage\n : copyState === \"pending\"\n ? copyingLabel\n : \"\";\n\n let offset = 0;\n\n return (\n <div\n {...(props as ComponentProps<\"div\">)}\n ref={ref as Ref<HTMLDivElement>}\n style={blockStyle}\n {...kb(\n \"code\",\n {\n block: true,\n \"line-numbers\": lineNumbers || undefined,\n \"min-lines\": resolvedMinLines !== undefined || undefined,\n collapsible: collapsible || undefined,\n collapsed: isCollapsed || undefined,\n \"collapsed-lines\": resolvedCollapsedLines !== undefined || undefined,\n language: language || undefined,\n },\n className,\n )}\n >\n {showHeader ? (\n <div className={clsx(\"kb-code-header\", classNames?.header)}>\n {hasMeta ? (\n <div className={clsx(\"kb-code-meta\", classNames?.meta)}>\n {title ? (\n <span className={clsx(\"kb-code-title\", classNames?.title)}>{title}</span>\n ) : null}\n {languageLabel ? (\n <span className={clsx(\"kb-code-language\", classNames?.language)}>\n {languageLabel}\n </span>\n ) : null}\n </div>\n ) : null}\n {hasActions ? (\n <div className={clsx(\"kb-code-actions\", classNames?.actions)}>\n {collapsible ? (\n <button\n type=\"button\"\n className={clsx(\"kb-code-toggle\", classNames?.toggle)}\n aria-expanded={!isCollapsed}\n aria-controls={viewportId}\n onClick={handleToggleCollapse}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M4.5 6.25 8 9.75l3.5-3.5\" />\n </svg>\n {isCollapsed ? \"Expand code\" : \"Collapse code\"}\n </button>\n ) : null}\n {showCopy ? (\n <button\n type=\"button\"\n className={clsx(\"kb-code-copy\", classNames?.copy)}\n data-copy-state={copyState}\n disabled={clipboard.disabled}\n aria-disabled={copyState === \"pending\" || undefined}\n onClick={() => void clipboard.copy()}\n >\n {copyState === \"copied\" ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M3.5 8.5 6.5 11.5 12.5 4.5\" />\n </svg>\n ) : copyState === \"failed\" ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <path d=\"M8 4.5v4.5M8 11.75h.01\" />\n </svg>\n ) : (\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\">\n <rect x=\"5.5\" y=\"5.5\" width=\"7.5\" height=\"7.5\" rx=\"1.5\" />\n <path d=\"M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5\" />\n </svg>\n )}\n {resolvedCopyLabel}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n {showCopy ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(\n \"kb-code-feedback\",\n copyState !== \"failed\" && \"kb-sr-only\",\n classNames?.feedback,\n )}\n >\n {copyAnnouncement}\n </span>\n ) : null}\n <section\n id={viewportId}\n aria-label={title || \"Code\"}\n // biome-ignore lint/a11y/noNoninteractiveTabindex: Scrollable source needs keyboard access.\n tabIndex={0}\n className={clsx(\"kb-code-viewport\", classNames?.viewport)}\n >\n <pre ref={preRef} className={clsx(\"kb-code-pre\", classNames?.pre)}>\n <code className={clsx(\"kb-code-content\", classNames?.content)}>\n {typeof children === \"string\" ? (\n <>\n {lines.map((lineText, idx) => {\n const lineStart = offset;\n offset += lineText.length + 1;\n const lineNumber = startLine + idx;\n const isHighlighted = highlightSet?.has(lineNumber) ?? false;\n return (\n <Fragment key={lineNumber}>\n {idx > 0 ? \"\\n\" : null}\n <span\n className={clsx(\"kb-code-line\", classNames?.line)}\n data-highlighted={isHighlighted ? \"\" : undefined}\n >\n {lineNumbers ? (\n <span\n className={clsx(\"kb-code-line-number\", classNames?.lineNumber)}\n data-line-number={String(lineNumber)}\n aria-hidden=\"true\"\n />\n ) : null}\n <span className={clsx(\"kb-code-line-text\", classNames?.lineText)}>\n {renderLineTokens(lineText, lineStart, resolvedTokens)}\n </span>\n </span>\n </Fragment>\n );\n })}\n {extraLineCount > 0\n ? Array.from({ length: extraLineCount }, (_, extraOffset) => {\n const lineNumber = startLine + lines.length + extraOffset;\n const isHighlighted = highlightSet?.has(lineNumber) ?? false;\n return (\n <span\n key={`pad-${lineNumber}`}\n className={clsx(\"kb-code-line\", classNames?.line)}\n data-highlighted={isHighlighted ? \"\" : undefined}\n aria-hidden=\"true\"\n >\n {lineNumbers ? (\n <span\n className={clsx(\"kb-code-line-number\", classNames?.lineNumber)}\n data-line-number={String(lineNumber)}\n aria-hidden=\"true\"\n />\n ) : null}\n <span className={clsx(\"kb-code-line-text\", classNames?.lineText)} />\n </span>\n );\n })\n : null}\n </>\n ) : (\n children\n )}\n </code>\n </pre>\n </section>\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { Ref } from \"react\";\nimport { Code, type CodeProps } from \"../Code/Code\";\n\nexport type CodeBlockProps = Omit<CodeProps, \"block\" | \"children\" | \"ref\"> & {\n /** Exact source string, including whitespace and trailing newlines. */\n children: string;\n /** Root block element. */\n ref?: Ref<HTMLDivElement> | undefined;\n};\n\n/** Explicit block rendering with Code's highlighting, line, and collapse contracts. */\nexport function CodeBlock({ className, ...props }: CodeBlockProps) {\n return <Code {...props} block className={clsx(\"kb-codeblock\", className)} />;\n}\n","import { Field } from \"@base-ui/react/field\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type InputSize = \"sm\" | \"md\" | \"lg\";\n\nexport type InputProps = Omit<BaseInput.Props, \"size\" | \"className\"> & {\n /** Plain class string for the root. */\n className?: string;\n /** Visible label; required for accessibility. */\n label: string;\n /** Hide the label visually, keep it for screen readers. */\n visuallyHidden?: boolean;\n /** Helper text under the control. */\n description?: string;\n /** Error message; when set the field is invalid. */\n error?: string;\n /** Control height scale. */\n size?: InputSize;\n /** Content before control text, such as icons. */\n startContent?: ReactNode;\n /** Content after control text, such as a named action. */\n endContent?: ReactNode;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"label\" | \"shell\" | \"start\" | \"control\" | \"end\" | \"description\" | \"error\"\n >;\n};\n\nexport function Input({\n classNames,\n label,\n visuallyHidden,\n description,\n error,\n size = \"md\",\n disabled,\n className,\n startContent,\n endContent,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: InputProps) {\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n return (\n <Field.Root\n {...kb(\n \"input\",\n {\n size,\n invalid,\n \"start-adornment\": Boolean(startContent),\n \"end-adornment\": Boolean(endContent),\n },\n className,\n )}\n invalid={invalid}\n disabled={Boolean(disabled)}\n >\n <Field.Label\n className={clsx(\"kb-input-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </Field.Label>\n <div className={clsx(\"kb-input-shell\", classNames?.shell)}>\n {startContent && (\n <span className={clsx(\"kb-input-start\", classNames?.start)}>{startContent}</span>\n )}\n <BaseInput\n {...props}\n aria-invalid={ariaInvalid}\n render={\n props.render ??\n (typeof ariaInvalid === \"string\" ? <input aria-invalid={ariaInvalid} /> : undefined)\n }\n className={clsx(\"kb-input-control\", classNames?.control)}\n />\n {endContent && <span className={clsx(\"kb-input-end\", classNames?.end)}>{endContent}</span>}\n </div>\n {description ? (\n <Field.Description className={clsx(\"kb-input-description\", classNames?.description)}>\n {description}\n </Field.Description>\n ) : null}\n {error ? (\n <Field.Error className={clsx(\"kb-input-error\", classNames?.error)} match>\n {error}\n </Field.Error>\n ) : null}\n </Field.Root>\n );\n}\n","import { Select as Base } from \"@base-ui/react/select\";\nimport { clsx } from \"clsx\";\nimport { type ComponentProps, useId, useImperativeHandle, useRef, useState } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type SelectOption = { value: string; label: string; disabled?: boolean };\nexport type SelectProps = Omit<ComponentProps<\"div\">, \"onChange\" | \"children\" | \"defaultValue\"> & {\n /** Visible label for the trigger. */\n label: string;\n /** Controlled selection; null displays the placeholder. */\n value: string | null;\n /** Receives selected value; consumers own domain transitions. */\n onValueChange: (value: string | null) => void;\n /** Unique string-valued options; an empty collection is supported. */\n options: readonly SelectOption[];\n /** Text when value is null. */\n placeholder?: string;\n /** Field helper text. */\n description?: string;\n /** Visible invalid-state message. */\n error?: string;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Preserve value while preventing changes. */\n readOnly?: boolean;\n /** Native form field name. */\n name?: string;\n /** Class on trigger slot. */\n controlClassName?: string;\n /** Class on popup slot. */\n popupClassName?: string;\n /** Portal host; defaults to field root to retain theme. */\n container?: Base.Portal.Props[\"container\"];\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n | \"control\"\n | \"popup\"\n | \"label\"\n | \"icon\"\n | \"portal\"\n | \"positioner\"\n | \"list\"\n | \"item\"\n | \"indicator\"\n | \"empty\"\n | \"description\"\n | \"error\"\n >;\n};\nexport function Select({\n classNames,\n label,\n value,\n onValueChange,\n options,\n placeholder = \"Choose an option\",\n description,\n error,\n disabled = false,\n readOnly = false,\n name,\n className,\n controlClassName,\n popupClassName,\n container,\n ref,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: SelectProps) {\n const id = useId();\n const root = useRef<HTMLDivElement>(null);\n const trigger = useRef<HTMLButtonElement>(null);\n const popup = useRef<HTMLDivElement>(null);\n const interaction = useRef<\"pointer\" | \"keyboard\">(\"keyboard\");\n const [pointerFocus, setPointerFocus] = useState(false);\n useImperativeHandle(ref, () => root.current as HTMLDivElement);\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const empty = options.length === 0;\n const inactive = disabled || empty;\n const help =\n [description, empty && \"No options available\"].filter(Boolean).join(\" \") || undefined;\n const described =\n [help ? `${id}-description` : null, error ? `${id}-error` : null, callerDescription]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <div {...props} ref={root} {...kb(\"select\", { disabled: inactive, invalid }, className)}>\n <Base.Root<string>\n modal={false}\n items={options}\n value={value}\n onValueChange={(next) => {\n if (\n !inactive &&\n !readOnly &&\n (next === null || options.some((item) => item.value === next && !item.disabled))\n )\n onValueChange(next);\n }}\n disabled={inactive}\n readOnly={readOnly}\n onOpenChange={(_open, details) => {\n if (details.event.type.startsWith(\"key\")) interaction.current = \"keyboard\";\n else if (/^(pointer|mouse)/.test(details.event.type)) interaction.current = \"pointer\";\n }}\n {...(name ? { name } : {})}\n >\n <Base.Label className={clsx(\"kb-select-label\", classNames?.label)}>{label}</Base.Label>\n <Base.Trigger\n ref={trigger}\n className={clsx(\"kb-select-control\", classNames?.control, controlClassName)}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n data-pointer-focus={pointerFocus || undefined}\n onPointerDown={() => {\n interaction.current = \"pointer\";\n setPointerFocus(true);\n }}\n onKeyDown={() => {\n interaction.current = \"keyboard\";\n setPointerFocus(false);\n }}\n onBlur={() => setPointerFocus(false)}\n >\n <Base.Value placeholder={placeholder} />\n <Base.Icon className={clsx(\"kb-select-icon\", classNames?.icon)} aria-hidden=\"true\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </svg>\n </Base.Icon>\n </Base.Trigger>\n <Base.Portal\n container={container ?? root}\n className={clsx(\"kb-select-portal\", classNames?.portal)}\n >\n <Base.Positioner\n className={clsx(\"kb-select-positioner\", classNames?.positioner)}\n sideOffset={6}\n alignItemWithTrigger={false}\n >\n <Base.Popup\n ref={popup}\n className={clsx(\"kb-select-popup\", classNames?.popup, popupClassName)}\n onPointerDownCapture={() => {\n interaction.current = \"pointer\";\n }}\n onKeyDownCapture={() => {\n interaction.current = \"keyboard\";\n }}\n finalFocus={() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== document.body &&\n active !== trigger.current &&\n !popup.current?.contains(active) &&\n !active.hasAttribute(\"data-base-ui-focus-guard\")\n ) {\n setPointerFocus(false);\n return false;\n }\n setPointerFocus(interaction.current === \"pointer\");\n return true;\n }}\n >\n <Base.List className={clsx(\"kb-select-list\", classNames?.list)} aria-label={label}>\n {options.length ? (\n options.map((option) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-select-item\", classNames?.item)}\n >\n <Base.ItemText>{option.label}</Base.ItemText>\n <Base.ItemIndicator\n className={clsx(\"kb-select-indicator\", classNames?.indicator)}\n aria-hidden=\"true\"\n >\n ✓\n </Base.ItemIndicator>\n </Base.Item>\n ))\n ) : (\n <Base.Item\n value=\"\"\n disabled\n className={clsx(\n \"kb-select-item kb-select-empty\",\n classNames?.item,\n classNames?.empty,\n )}\n >\n <Base.ItemText>No options available</Base.ItemText>\n </Base.Item>\n )}\n </Base.List>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n </Base.Root>\n {help && (\n <p\n className={clsx(\"kb-select-description\", classNames?.description)}\n id={`${id}-description`}\n >\n {help}\n </p>\n )}\n {error && (\n <p className={clsx(\"kb-select-error\", classNames?.error)} id={`${id}-error`}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { useLayoutEffect, useRef, useState } from \"react\";\n\nexport type CollectionSort = {\n /** Column identifier. */\n key: string;\n /** Comparison direction. */\n direction: \"ascending\" | \"descending\";\n};\nexport type CollectionState = {\n /** Search text, interpreted by matches or the server. */\n query: string;\n /** Facet values; empty values mean no constraint. */\n filters: Readonly<Record<string, string>>;\n /** Active sort; null preserves input order. */\n sort: CollectionSort | null;\n /** One-based page. */\n page: number;\n /** Positive integer records per page. */\n pageSize: number;\n /** Explicit record IDs; never an implicit all-results selection. */\n selectedKeys: readonly string[];\n};\nexport type CollectionData<T> = {\n /** Complete local dataset or one server page. */\n items: readonly T[];\n /** Unique, stable identity across pages and updates. */\n getKey: (item: T) => string;\n /** Disable selection for an ineligible record. */\n isItemDisabled?: ((item: T) => boolean) | undefined;\n /** Client search and facet predicate; server mode ignores it. */\n matches?: ((item: T, query: string, filters: CollectionState[\"filters\"]) => boolean) | undefined;\n /** Client comparison for the requested sort; server mode ignores it. */\n compare?: ((a: T, b: T, sort: CollectionSort) => number) | undefined;\n} & ({ mode?: \"client\" | undefined; totalItems?: never } | { mode: \"server\"; totalItems: number });\nexport type UseCollectionOptions<T> = CollectionData<T> & {\n /** Controlled workflow state; owner must apply changes. */\n state?: CollectionState | undefined;\n /** Initial uncontrolled workflow state. */\n defaultState?: Partial<CollectionState> | undefined;\n /** Receives complete next state for URL, server or external ownership. */\n onStateChange?: ((state: CollectionState) => void) | undefined;\n};\n\nexport function positiveInteger(value: number, name: string): number {\n if (!Number.isSafeInteger(value) || value < 1)\n throw new RangeError(`${name} must be a positive safe integer`);\n return value;\n}\nexport function collectionPageCount(totalItems: number, pageSize: number): number {\n positiveInteger(pageSize, \"pageSize\");\n if (!Number.isSafeInteger(totalItems) || totalItems < 0)\n throw new RangeError(\"totalItems must be a non-negative safe integer\");\n return Math.max(1, Math.ceil(totalItems / pageSize));\n}\n\nexport function useCollection<T>(options: UseCollectionOptions<T>) {\n const { items, getKey, isItemDisabled, matches, compare } = options;\n const [internal, setInternal] = useState<CollectionState>(() => ({\n query: \"\",\n filters: {},\n sort: null,\n page: 1,\n pageSize: 10,\n selectedKeys: [],\n ...options.defaultState,\n }));\n const derive = (requested: CollectionState) => {\n positiveInteger(requested.page, \"page\");\n positiveInteger(requested.pageSize, \"pageSize\");\n const keys = new Set<string>();\n const disabledKeys = new Set<string>();\n for (const item of items) {\n const key = getKey(item);\n if (keys.has(key)) throw new Error(\"Collection record keys must be unique\");\n keys.add(key);\n if (isItemDisabled?.(item)) disabledKeys.add(key);\n }\n let processed = items;\n if (options.mode !== \"server\") {\n processed = matches\n ? items.filter((item) => matches(item, requested.query, requested.filters))\n : items;\n if (requested.sort && compare) {\n const sort = requested.sort;\n processed = [...processed].sort(\n (a, b) => compare(a, b, sort) * (sort.direction === \"ascending\" ? 1 : -1),\n );\n }\n }\n const totalItems = options.mode === \"server\" ? options.totalItems : processed.length;\n const pageCount = collectionPageCount(totalItems, requested.pageSize);\n const state: CollectionState = {\n ...requested,\n page: Math.min(requested.page, pageCount),\n selectedKeys: [...new Set(requested.selectedKeys)].filter(\n (key) => !disabledKeys.has(key) && (options.mode === \"server\" || keys.has(key)),\n ),\n };\n const pageItems =\n options.mode === \"server\"\n ? items\n : processed.slice((state.page - 1) * state.pageSize, state.page * state.pageSize);\n const selectableKeys = pageItems.map(getKey).filter((key) => !disabledKeys.has(key));\n const selected = new Set(state.selectedKeys);\n const selectedOnPage = selectableKeys.filter((key) => selected.has(key)).length;\n const pageSelection: \"none\" | \"some\" | \"all\" =\n selectedOnPage === 0 ? \"none\" : selectedOnPage === selectableKeys.length ? \"all\" : \"some\";\n return {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableKeys,\n keys,\n disabledKeys,\n };\n };\n const {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableKeys,\n keys,\n disabledKeys,\n } = derive(options.state ?? internal);\n const requested = options.state ?? internal;\n const context = {\n state,\n derive,\n keys,\n disabledKeys,\n controlled: options.state !== undefined,\n onStateChange: options.onStateChange,\n };\n const latest = useRef(context);\n useLayoutEffect(() => {\n latest.current = context;\n if (\n options.state === undefined &&\n (requested.page !== state.page ||\n requested.selectedKeys.length !== state.selectedKeys.length ||\n requested.selectedKeys.some((key, index) => key !== state.selectedKeys[index]))\n )\n setInternal(state);\n });\n const change = (\n patch: Partial<CollectionState> | ((current: CollectionState) => Partial<CollectionState>),\n ) => {\n const current = latest.current;\n const next = current.derive({\n ...current.state,\n ...(typeof patch === \"function\" ? patch(current.state) : patch),\n }).state;\n if (!current.controlled) {\n current.state = next;\n setInternal(next);\n }\n current.onStateChange?.(next);\n };\n return {\n state,\n items: pageItems,\n totalItems,\n pageCount,\n pageSelection,\n selectableCount: selectableKeys.length,\n setQuery: (query: string) => change({ query, page: 1, selectedKeys: [] }),\n setFilter: (key: string, value: string) =>\n change((current) => ({\n filters: { ...current.filters, [key]: value },\n page: 1,\n selectedKeys: [],\n })),\n setSort: (sort: CollectionSort | null) => change({ sort, page: 1 }),\n setPage: (page: number) => change({ page }),\n setPageSize: (pageSize: number) => change({ pageSize, page: 1 }),\n toggle: (key: string, checked: boolean) => {\n const current = latest.current;\n if (!current.keys.has(key) || current.disabledKeys.has(key)) return;\n change((current) => {\n const next = new Set(current.selectedKeys);\n if (checked) next.add(key);\n else next.delete(key);\n return { selectedKeys: [...next] };\n });\n },\n selectPage: (checked: boolean) => {\n change((current) => {\n const next = new Set(current.selectedKeys);\n for (const key of latest.current.derive(current).selectableKeys) {\n if (checked) next.add(key);\n else next.delete(key);\n }\n return { selectedKeys: [...next] };\n });\n },\n clearSelection: () => change({ selectedKeys: [] }),\n removeSelection: (keysToRemove: readonly string[]) => {\n const removed = new Set(keysToRemove);\n change((current) => ({\n selectedKeys: current.selectedKeys.filter((key) => !removed.has(key)),\n }));\n },\n };\n}\nexport type CollectionController<T> = ReturnType<typeof useCollection<T>>;\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type ReactNode,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Button } from \"../Button/Button\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { Input } from \"../Input/Input\";\nimport { Select } from \"../Select/Select\";\nimport {\n collectionPageCount,\n positiveInteger,\n type UseCollectionOptions,\n useCollection,\n} from \"./useCollection\";\n\nexport type CollectionColumn<T> = {\n /** Unique column identity used in sort requests. */\n key: string;\n /** Visible column label. */\n header: string;\n /** Record cell content. */\n cell: (item: T) => ReactNode;\n /** Ascending comparator; enables sorting in client mode. */\n compare?: ((a: T, b: T) => number) | undefined;\n /** Enable a server-owned sortable column without a local comparator. */\n sortable?: boolean | undefined;\n};\nexport type CollectionFilter = {\n /** State filter key. */\n key: string;\n /** Visible select label. */\n label: string;\n /** Nonempty facet values and their visible labels. */\n options: readonly { value: string; label: string }[];\n};\nexport type CollectionBulkAction = {\n /** Unique action identity. */\n key: string;\n /** Visible action label. */\n label: string;\n /** Receives explicit ID snapshot; rejection preserves selection. */\n onAction: (keys: readonly string[]) => void | Promise<void>;\n /** Caller-owned permission or availability constraint. */\n disabled?: boolean | undefined;\n};\nexport type CollectionPaginationProps = Omit<ComponentProps<\"nav\">, \"onChange\"> & {\n /** One-based current page; clamped to available pages. */\n page: number;\n /** Positive integer page size. */\n pageSize: number;\n /** Known non-negative total after filtering. */\n totalItems: number;\n /** Receives bounded one-based page requests. */\n onPageChange: (page: number) => void;\n /** Receives page-size requests; caller also resets page to one. */\n onPageSizeChange?: ((pageSize: number) => void) | undefined;\n /** Positive integer page-size choices. */\n pageSizes?: readonly number[] | undefined;\n /** Disable navigation while data or actions are pending. */\n disabled?: boolean | undefined;\n};\nexport function CollectionPagination({\n page,\n pageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n pageSizes = [10, 25, 50],\n disabled,\n className,\n ...props\n}: CollectionPaginationProps) {\n const count = collectionPageCount(totalItems, pageSize);\n const current = Math.min(positiveInteger(page, \"page\"), count);\n const sizes = [...new Set([pageSize, ...pageSizes])].sort((a, b) => a - b);\n for (const size of sizes) positiveInteger(size, \"pageSizes\");\n return (\n <nav\n {...props}\n {...kb(\"collection-pagination\", {}, className)}\n aria-label={props[\"aria-label\"] ?? \"Collection pagination\"}\n >\n <div>\n <span>\n {totalItems ? (current - 1) * pageSize + 1 : 0}–{Math.min(current * pageSize, totalItems)}{\" \"}\n of {totalItems}\n </span>\n {onPageSizeChange && (\n <Select\n label=\"Rows per page\"\n disabled={Boolean(disabled)}\n value={String(pageSize)}\n options={sizes.map((size) => ({ value: String(size), label: String(size) }))}\n onValueChange={(value) => {\n if (value !== null) onPageSizeChange(Number(value));\n }}\n />\n )}\n </div>\n <div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || current === 1}\n onClick={() => onPageChange(current - 1)}\n aria-label=\"Previous page\"\n >\n Previous\n </Button>\n <span aria-live=\"polite\" aria-atomic=\"true\">\n Page {current} of {count}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || current === count}\n onClick={() => onPageChange(current + 1)}\n aria-label=\"Next page\"\n >\n Next\n </Button>\n </div>\n </nav>\n );\n}\nexport type CollectionBulkActionsProps = ComponentProps<\"fieldset\"> & {\n /** Explicit selected record IDs, including off-page selection. */\n selectedKeys: readonly string[];\n /** Available application-owned operations. */\n actions: readonly CollectionBulkAction[];\n /** Clear current selection on request. */\n onClear: () => void;\n /** Remove successfully submitted IDs; omitted preserves selection. */\n onSuccess?: ((keys: readonly string[]) => void) | undefined;\n /** Lock surrounding collection controls during an operation. */\n onPendingChange?: ((pending: boolean) => void) | undefined;\n /** Disable actions while parent data is unavailable. */\n disabled?: boolean | undefined;\n};\nexport function CollectionBulkActions({\n selectedKeys,\n actions,\n onClear,\n onSuccess,\n onPendingChange,\n disabled,\n className,\n ...props\n}: CollectionBulkActionsProps) {\n const [pending, setPending] = useState<string | null>(null);\n const [failed, setFailed] = useState(false);\n useEffect(() => {\n if (failed && selectedKeys.length === 0) setFailed(false);\n }, [failed, selectedKeys.length]);\n const lock = useRef(false);\n const selection = [...new Set(selectedKeys)];\n const success = useRef(onSuccess);\n useLayoutEffect(() => {\n success.current = onSuccess;\n });\n const run = async (action: CollectionBulkAction) => {\n if (lock.current || disabled || action.disabled || !selection.length) return;\n lock.current = true;\n const snapshot = [...selection];\n setFailed(false);\n setPending(action.key);\n onPendingChange?.(true);\n try {\n await action.onAction(snapshot);\n success.current?.(snapshot);\n } catch {\n setFailed(true);\n } finally {\n lock.current = false;\n setPending(null);\n onPendingChange?.(false);\n }\n };\n return (\n <fieldset\n {...props}\n {...kb(\"collection-bulk\", { pending: pending !== null }, className)}\n aria-label={props[\"aria-label\"] ?? \"Selection actions\"}\n >\n <span role=\"status\">{selection.length} selected</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || pending !== null || !selection.length}\n onClick={() => {\n setFailed(false);\n onClear();\n }}\n >\n Clear selection\n </Button>\n {actions.map((action) => (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n key={action.key}\n disabled={disabled || pending !== null || action.disabled || !selection.length}\n onClick={() => void run(action)}\n >\n {action.label}\n </Button>\n ))}\n <span role=\"status\">{pending !== null ? \"Action in progress\" : \"\"}</span>\n {failed && selectedKeys.length > 0 && (\n <span role=\"alert\">Action failed. Selection kept; try again.</span>\n )}\n </fieldset>\n );\n}\n\ntype CollectionPart =\n | \"toolbar\"\n | \"filters\"\n | \"viewport\"\n | \"table\"\n | \"caption\"\n | \"head\"\n | \"cell\"\n | \"row\"\n | \"empty\"\n | \"status\"\n | \"bulk\"\n | \"pagination\";\nexport type CollectionProps<T> = UseCollectionOptions<T> &\n Omit<ComponentProps<\"section\">, \"children\" | \"defaultValue\"> & {\n /** Accessible region name and visible table caption. */\n label: string;\n /** Stable accessible record name used by selection controls. */\n getItemLabel: (item: T) => string;\n /** Ordered table columns. */\n columns: readonly CollectionColumn<T>[];\n /** Facet controls; matches applies their values in client mode. */\n filters?: readonly CollectionFilter[] | undefined;\n /** Application-owned operations on explicit selected IDs. */\n bulkActions?: readonly CollectionBulkAction[] | undefined;\n /** Hide selection controls for read-only collections. */\n selectable?: boolean | undefined;\n /** Suppress rows and lock controls while fetching. */\n loading?: boolean | undefined;\n /** Caller-owned fetch failure and recovery content. */\n error?: ReactNode | undefined;\n /** Content shown when no records match. */\n empty?: ReactNode | undefined;\n /** Additional named controls or recovery actions. */\n toolbar?: ReactNode | undefined;\n /** Classes for collection slots. */\n classNames?: ClassNames<CollectionPart> | undefined;\n };\nfunction CollectionRoot<T>({\n label,\n getItemLabel,\n columns,\n filters = [],\n bulkActions = [],\n selectable = true,\n loading = false,\n error,\n empty = \"No matching records\",\n toolbar,\n classNames,\n className,\n items,\n getKey,\n isItemDisabled,\n matches,\n compare,\n mode,\n totalItems,\n state,\n defaultState,\n onStateChange,\n ...props\n}: CollectionProps<T>) {\n const [pending, setPending] = useState(false);\n const blocked = loading || Boolean(error) || pending;\n const collection = useCollection<T>({\n items,\n getKey,\n isItemDisabled,\n matches,\n compare:\n compare ??\n ((a, b, sort) => columns.find((column) => column.key === sort.key)?.compare?.(a, b) ?? 0),\n ...(mode === \"server\" ? { mode, totalItems: totalItems as number } : { mode: \"client\" }),\n state,\n defaultState,\n onStateChange,\n });\n const id = useId();\n const slot = (part: CollectionPart) => clsx(`kb-collection-${part}`, classNames?.[part]);\n const { state: current } = collection;\n const selectedKeys = new Set(current.selectedKeys);\n return (\n <section\n {...props}\n {...kb(\"collection\", { loading, pending }, className)}\n aria-label={label}\n aria-busy={loading}\n >\n <div className={slot(\"toolbar\")}>\n {(matches || mode === \"server\") && (\n <Input\n type=\"search\"\n label={`Search ${label}`}\n value={current.query}\n disabled={blocked}\n onChange={(event) => collection.setQuery(event.target.value)}\n />\n )}\n <div className={slot(\"filters\")}>\n {filters.map((filter) => (\n <Select\n key={filter.key}\n label={filter.label}\n disabled={blocked}\n value={current.filters[filter.key] ? `option:${current.filters[filter.key]}` : \"all\"}\n options={[\n { value: \"all\", label: \"All\" },\n ...filter.options.map((option) => ({ ...option, value: `option:${option.value}` })),\n ]}\n onValueChange={(value) =>\n collection.setFilter(\n filter.key,\n value && value !== \"all\" ? value.slice(\"option:\".length) : \"\",\n )\n }\n />\n ))}\n </div>\n {toolbar}\n </div>\n {selectable && (\n <CollectionBulkActions\n className={classNames?.bulk}\n selectedKeys={current.selectedKeys}\n actions={bulkActions}\n onClear={collection.clearSelection}\n onSuccess={collection.removeSelection}\n onPendingChange={setPending}\n disabled={blocked}\n />\n )}\n <p className={slot(\"status\")} role=\"status\" aria-atomic=\"true\">\n {loading\n ? \"Loading records\"\n : error\n ? \"Records unavailable\"\n : `${collection.totalItems} records`}\n </p>\n {error ? (\n <div role=\"alert\">{error}</div>\n ) : (\n // biome-ignore lint/a11y/noNoninteractiveTabindex: Keyboard users must scroll wide tables.\n <section className={slot(\"viewport\")} tabIndex={0} aria-label={`${label} table`}>\n <table className={slot(\"table\")}>\n <caption className={slot(\"caption\")}>{label}</caption>\n <thead>\n <tr>\n {selectable && (\n <th className={slot(\"head\")} scope=\"col\">\n <Checkbox\n label=\"Select this page\"\n visuallyHidden\n checked={collection.pageSelection === \"all\"}\n indeterminate={collection.pageSelection === \"some\"}\n disabled={blocked || collection.selectableCount === 0}\n onCheckedChange={collection.selectPage}\n />\n </th>\n )}\n {columns.map((column) => {\n const sortable = Boolean(\n column.compare || (mode === \"server\" && column.sortable),\n );\n const direction =\n current.sort?.key === column.key ? current.sort.direction : \"none\";\n return (\n <th\n key={column.key}\n scope=\"col\"\n className={slot(\"head\")}\n aria-sort={sortable ? direction : undefined}\n >\n {sortable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Sort by ${column.header}`}\n disabled={blocked}\n onClick={() =>\n collection.setSort(\n direction === \"descending\"\n ? null\n : {\n key: column.key,\n direction: direction === \"none\" ? \"ascending\" : \"descending\",\n },\n )\n }\n >\n {column.header}{\" \"}\n <span aria-hidden=\"true\">\n {direction === \"ascending\"\n ? \"↑\"\n : direction === \"descending\"\n ? \"↓\"\n : \"↕\"}\n </span>\n </Button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {!loading &&\n collection.items.map((item) => {\n const key = getKey(item);\n const selected = selectedKeys.has(key);\n return (\n <tr key={key} className={slot(\"row\")} data-selected={selected || undefined}>\n {selectable && (\n <td className={slot(\"cell\")}>\n <Checkbox\n label={`Select ${getItemLabel(item)}`}\n visuallyHidden\n checked={selected}\n disabled={blocked || isItemDisabled?.(item)}\n onCheckedChange={(checked) => collection.toggle(key, checked)}\n />\n </td>\n )}\n {columns.map((column) => (\n <td className={slot(\"cell\")} key={column.key}>\n {column.cell(item)}\n </td>\n ))}\n </tr>\n );\n })}\n {(loading || collection.items.length === 0) && (\n <tr>\n <td className={slot(\"empty\")} colSpan={columns.length + (selectable ? 1 : 0)}>\n {loading ? \"Loading records…\" : empty}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </section>\n )}\n <CollectionPagination\n id={`${id}-pagination`}\n className={classNames?.pagination}\n aria-label={`${label} pagination`}\n page={current.page}\n pageSize={current.pageSize}\n totalItems={collection.totalItems}\n onPageChange={collection.setPage}\n onPageSizeChange={collection.setPageSize}\n disabled={blocked}\n />\n </section>\n );\n}\n\nexport const Collection = Object.assign(CollectionRoot, {\n Pagination: CollectionPagination,\n BulkActions: CollectionBulkActions,\n});\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type CollectionListElement = \"ul\" | \"ol\";\nexport type CollectionListProps<T extends CollectionListElement = \"ul\"> = ComponentProps<T> & {\n as?: T | undefined;\n density?: \"comfortable\" | \"dense\" | undefined;\n dividers?: boolean | undefined;\n};\nexport function CollectionList<T extends CollectionListElement = \"ul\">({\n as,\n density = \"comfortable\",\n dividers = true,\n className,\n ...props\n}: CollectionListProps<T>) {\n return createElement(as ?? \"ul\", {\n ...props,\n role: props.role ?? \"list\",\n ...kb(\"collectionlist\", { density, dividers, ordered: as === \"ol\" }, className),\n });\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type CollectionRowProps = Omit<ComponentProps<\"li\">, \"title\" | \"children\"> & {\n /** Primary record name; compose a named link for navigation. */\n title: ReactNode;\n /** Supporting detail; rich content and zero values remain intact. */\n description?: ReactNode | undefined;\n /** Leading icon, avatar or independent selection control. */\n leading?: ReactNode | undefined;\n metadata?: ReactNode | undefined;\n /** Independent named links, Buttons or Menu composition. */\n actions?: ReactNode | undefined;\n /** Visual selection; selection control supplies accessible state. */\n selected?: boolean | undefined;\n classNames?:\n | ClassNames<\n | \"layout\"\n | \"leading\"\n | \"content\"\n | \"title\"\n | \"description\"\n | \"aside\"\n | \"metadata\"\n | \"actions\"\n >\n | undefined;\n};\nfunction hasSlotContent(value: ReactNode): boolean {\n return value != null && typeof value !== \"boolean\" && value !== \"\";\n}\n\nexport function CollectionRow({\n title,\n description,\n leading,\n metadata,\n actions,\n selected = false,\n classNames,\n className,\n ...props\n}: CollectionRowProps) {\n const aside = hasSlotContent(metadata) || hasSlotContent(actions);\n return (\n <li\n {...props}\n {...kb(\"collectionrow\", { selected, leading: hasSlotContent(leading), aside }, className)}\n >\n <div className={clsx(\"kb-collectionrow-layout\", classNames?.layout)}>\n {hasSlotContent(leading) && (\n <div className={clsx(\"kb-collectionrow-leading\", classNames?.leading)}>{leading}</div>\n )}\n <div className={clsx(\"kb-collectionrow-content\", classNames?.content)}>\n <div className={clsx(\"kb-collectionrow-title\", classNames?.title)}>{title}</div>\n {hasSlotContent(description) && (\n <div className={clsx(\"kb-collectionrow-description\", classNames?.description)}>\n {description}\n </div>\n )}\n </div>\n {aside && (\n <div className={clsx(\"kb-collectionrow-aside\", classNames?.aside)}>\n {hasSlotContent(metadata) && (\n <div className={clsx(\"kb-collectionrow-metadata\", classNames?.metadata)}>\n {metadata}\n </div>\n )}\n {hasSlotContent(actions) && (\n <div className={clsx(\"kb-collectionrow-actions\", classNames?.actions)}>{actions}</div>\n )}\n </div>\n )}\n </div>\n </li>\n );\n}\n","import { Combobox as Base } from \"@base-ui/react/combobox\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\n/** Single selectable option in a MultiSelect list. */\nexport interface MultiSelectOption {\n /** Option value included in `value` and passed to `onValueChange`. */\n value: string;\n /** Visible option label shown in the popup list and selection chip. */\n label: string;\n /** Prevent selecting or deselecting this option in the list. */\n disabled?: boolean;\n}\n\n/** Styleable inner anatomy slots of MultiSelect. */\nexport type MultiSelectSlot =\n | \"label\"\n | \"shell\"\n | \"chips\"\n | \"chip\"\n | \"chipLabel\"\n | \"chipRemove\"\n | \"input\"\n | \"actions\"\n | \"clear\"\n | \"trigger\"\n | \"positioner\"\n | \"popup\"\n | \"list\"\n | \"option\"\n | \"optionIndicator\"\n | \"optionLabel\"\n | \"empty\"\n | \"description\"\n | \"error\";\n\n/** Props for the searchable multi-select component with removable chips. */\nexport interface MultiSelectProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"defaultValue\" | \"onChange\"> {\n /** Visible label naming the multiselect input. */\n label: string;\n /** Selectable options shown and filtered in the popup list. */\n options: readonly MultiSelectOption[];\n /** Selected option values rendered as removable chips. */\n value: readonly string[];\n /** Called when the user adds, removes, or clears selected values. */\n onValueChange: (value: string[]) => void;\n /** Placeholder text shown when the input is empty. */\n placeholder?: string;\n /** Message announced and shown when no options match the query. */\n emptyMessage?: ReactNode;\n /** Control height and typography scale. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Supporting helper text linked through `aria-describedby`. */\n description?: ReactNode;\n /** Validation error message; marks the control invalid when truthy. */\n error?: ReactNode;\n /** Mark the control invalid without an error message. */\n invalid?: boolean;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Allow focus and inspection while preventing value changes. */\n readOnly?: boolean;\n /** Require at least one selection for form validation. */\n required?: boolean;\n /** Form field name for native form submission. */\n name?: string;\n /** Controlled popup open state. */\n open?: boolean;\n /** Initial popup open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the popup opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Controlled search query text inside the input. */\n inputValue?: string;\n /** Called when the search query text changes. */\n onInputValueChange?: (inputValue: string) => void;\n /** Accessible name builder for each chip remove button (defaults to `\"Remove {option.label}\"`). */\n removeLabel?: (option: MultiSelectOption) => string;\n /** Accessible name for the clear-all button (defaults to `\"Clear {label}\"`). */\n clearLabel?: string;\n /** Accessible name for the popup toggle button (defaults to `\"Toggle {label} options\"`). */\n toggleLabel?: string;\n /** Portal host; defaults to field root to retain nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Extra classes for inner parts, keyed by slot name. */\n classNames?: ClassNames<MultiSelectSlot>;\n}\n\nconst defaultRemoveLabel = (option: MultiSelectOption) => `Remove ${option.label}`;\n// Strip prohibited aria-readonly/aria-disabled emitted by Base UI on generic chip div.\nconst chipAriaReset: Record<string, undefined> = {\n \"aria-readonly\": undefined,\n \"aria-disabled\": undefined,\n};\n\n/** Searchable multi-choice selection control with removable selection chips. */\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(function MultiSelect(\n {\n label,\n options,\n value,\n onValueChange,\n placeholder,\n emptyMessage = \"No matching options\",\n size = \"md\",\n description,\n error,\n invalid,\n disabled = false,\n readOnly = false,\n required = false,\n name,\n open,\n defaultOpen,\n onOpenChange,\n inputValue,\n onInputValueChange,\n removeLabel = defaultRemoveLabel,\n clearLabel,\n toggleLabel,\n container,\n className,\n classNames,\n id,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...rest\n },\n ref,\n) {\n const uid = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputId = id ?? `${uid}-input`;\n const labelId = `${uid}-label`;\n const descId = `${uid}-desc`;\n const errId = `${uid}-err`;\n const hasError = Boolean(error);\n const { invalid: isInvalid, ariaInvalid } = resolveInvalid(\n Boolean(invalid) || hasError,\n callerAriaInvalid,\n );\n const hasDescription = Boolean(description);\n const describedBy =\n [hasDescription ? descId : null, hasError ? errId : null, ariaDescribedBy]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const collection = useMemo(\n () => Base.createItems(options, { getValue: (o) => o.value, getLabel: (o) => o.label }),\n [options],\n );\n\n const optionMap = useMemo(() => new Map(options.map((o) => [o.value, o])), [options]);\n\n const selectedValues = useMemo(\n () => value.filter((v, idx) => optionMap.has(v) && value.indexOf(v) === idx),\n [value, optionMap],\n );\n\n const selectedOptions = useMemo(\n () =>\n selectedValues\n .map((v) => optionMap.get(v))\n .filter((o): o is MultiSelectOption => o !== undefined),\n [selectedValues, optionMap],\n );\n\n return (\n <Base.Root<string, true, MultiSelectOption>\n multiple\n items={collection}\n value={selectedValues}\n onValueChange={(next) => {\n if (disabled || readOnly) return;\n onValueChange(next ?? []);\n }}\n inputValue={inputValue}\n onInputValueChange={(next) => {\n onInputValueChange?.(next);\n }}\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next, details) => {\n if (!next && details.reason === \"item-press\") {\n details.cancel();\n return;\n }\n onOpenChange?.(next);\n }}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n >\n <div\n {...rest}\n ref={rootRef}\n {...kb(\n \"multiselect\",\n {\n size,\n invalid: isInvalid,\n disabled,\n readonly: readOnly,\n required,\n },\n className,\n )}\n >\n <label\n id={labelId}\n htmlFor={inputId}\n className={clsx(\"kb-multiselect-label\", classNames?.label)}\n >\n {label}\n </label>\n <Base.InputGroup\n aria-labelledby={labelId}\n className={clsx(\"kb-multiselect-shell\", classNames?.shell)}\n >\n <Base.Chips\n aria-label={`${label} selections`}\n className={clsx(\"kb-multiselect-chips\", classNames?.chips)}\n >\n {selectedOptions.map((option) => (\n <Base.Chip\n key={option.value}\n {...chipAriaReset}\n className={clsx(\"kb-multiselect-chip\", classNames?.chip)}\n >\n <span className={clsx(\"kb-multiselect-chip-label\", classNames?.chipLabel)}>\n {option.label}\n </span>\n <Base.ChipRemove\n aria-label={removeLabel(option)}\n disabled={disabled || readOnly}\n className={clsx(\"kb-multiselect-chip-remove\", classNames?.chipRemove)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.ChipRemove>\n </Base.Chip>\n ))}\n <Base.Input\n ref={ref}\n id={inputId}\n placeholder={placeholder}\n aria-labelledby={labelId}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-multiselect-input\", classNames?.input)}\n />\n </Base.Chips>\n <div className={clsx(\"kb-multiselect-actions\", classNames?.actions)}>\n <Base.Clear\n aria-label={clearLabel ?? `Clear ${label}`}\n disabled={disabled || readOnly}\n className={clsx(\"kb-multiselect-clear\", classNames?.clear)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.Clear>\n <Base.Trigger\n aria-label={toggleLabel ?? `Toggle ${label} options`}\n disabled={disabled}\n className={clsx(\"kb-multiselect-trigger\", classNames?.trigger)}\n >\n <span aria-hidden=\"true\">▾</span>\n </Base.Trigger>\n </div>\n </Base.InputGroup>\n <Base.Portal container={container ?? rootRef}>\n <Base.Positioner\n sideOffset={6}\n className={clsx(\"kb-multiselect-positioner\", classNames?.positioner)}\n >\n <Base.Popup className={clsx(\"kb-multiselect-popup\", classNames?.popup)}>\n <Base.List\n aria-labelledby={labelId}\n className={clsx(\"kb-multiselect-list\", classNames?.list)}\n >\n {(option: MultiSelectOption) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-multiselect-option\", classNames?.option)}\n >\n <Base.ItemIndicator\n keepMounted\n className={clsx(\n \"kb-multiselect-option-indicator\",\n classNames?.optionIndicator,\n )}\n >\n ✓\n </Base.ItemIndicator>\n <span className={clsx(\"kb-multiselect-option-label\", classNames?.optionLabel)}>\n {option.label}\n </span>\n </Base.Item>\n )}\n </Base.List>\n <Base.Empty className={clsx(\"kb-multiselect-empty\", classNames?.empty)}>\n {emptyMessage}\n </Base.Empty>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n {hasDescription && (\n <p id={descId} className={clsx(\"kb-multiselect-description\", classNames?.description)}>\n {description}\n </p>\n )}\n {hasError && (\n <p id={errId} className={clsx(\"kb-multiselect-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n </Base.Root>\n );\n});\n","import { Combobox as Base } from \"@base-ui/react/combobox\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nimport { MultiSelect, type MultiSelectProps } from \"../MultiSelect/MultiSelect\";\n\n/** Single selectable option in a Combobox list. */\nexport interface ComboboxOption {\n /** Option value committed to `onValueChange`. */\n value: string;\n /** Visible option label used for display and filtering. */\n label: string;\n /** Prevent selecting this option while keeping it visible. */\n disabled?: boolean;\n}\n\n/** Styleable inner anatomy slots of Combobox. */\nexport type ComboboxSlot =\n | \"label\"\n | \"shell\"\n | \"input\"\n | \"actions\"\n | \"clear\"\n | \"trigger\"\n | \"positioner\"\n | \"popup\"\n | \"list\"\n | \"option\"\n | \"optionIndicator\"\n | \"optionLabel\"\n | \"empty\"\n | \"description\"\n | \"error\";\n\n/** Props for the searchable single-select Combobox component. */\nexport interface ComboboxProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"defaultValue\" | \"onChange\"> {\n /** Choose one option; omit for single selection. */\n multiple?: false | undefined;\n /** Visible label naming the combobox input. */\n label: string;\n /** Selectable options shown and filtered in the popup list. */\n options: readonly ComboboxOption[];\n /** Selected option value, or `null` when nothing is selected. */\n value: string | null;\n /** Called when the user selects or clears an option. */\n onValueChange: (value: string | null) => void;\n /** Placeholder text shown when the input is empty. */\n placeholder?: string;\n /** Message announced and shown when no options match the query. */\n emptyMessage?: ReactNode;\n /** Control height and typography scale. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Supporting helper text linked through `aria-describedby`. */\n description?: ReactNode;\n /** Validation error message; marks the control invalid when truthy. */\n error?: ReactNode;\n /** Mark the control invalid without an error message. */\n invalid?: boolean;\n /** Disable interaction and form submission. */\n disabled?: boolean;\n /** Allow focus and inspection while preventing value changes. */\n readOnly?: boolean;\n /** Require a selection for form validation. */\n required?: boolean;\n /** Form field name for native form submission. */\n name?: string;\n /** Controlled popup open state. */\n open?: boolean;\n /** Initial popup open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the popup opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Controlled search query text inside the input. */\n inputValue?: string;\n /** Called when the search query text changes. */\n onInputValueChange?: (inputValue: string) => void;\n /** Accessible name for the clear button (defaults to `\"Clear {label}\"`). */\n clearLabel?: string;\n /** Accessible name for the popup toggle button (defaults to `\"Toggle {label} options\"`). */\n toggleLabel?: string;\n /** Portal host; defaults to field root to retain nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Extra classes for inner parts, keyed by slot name. */\n classNames?: ClassNames<ComboboxSlot>;\n}\n\n/** Multiple-choice combobox props; shares MultiSelect behavior and styling. */\nexport interface ComboboxMultipleProps extends MultiSelectProps {\n /** Enable multiple selections with removable chips. */\n multiple: true;\n}\n\n/** Explicit single-selection props; preserves existing ComboboxProps contract. */\nexport type ComboboxSingleProps = ComboboxProps;\n\ntype ComboboxSelectionProps = ComboboxProps | ComboboxMultipleProps;\n\n/** Searchable single or multiple selection with removable values. */\nexport const Combobox = forwardRef<HTMLInputElement, ComboboxSelectionProps>(\n function Combobox(props, ref) {\n if (props.multiple) {\n const { multiple: _, ...rest } = props;\n return <MultiSelect {...rest} ref={ref} />;\n }\n return <SingleCombobox {...props} ref={ref} />;\n },\n);\n\nconst SingleCombobox = forwardRef<HTMLInputElement, ComboboxSingleProps>(function SingleCombobox(\n {\n label,\n options,\n value,\n onValueChange,\n placeholder,\n emptyMessage = \"No matching options\",\n size = \"md\",\n description,\n error,\n invalid,\n disabled = false,\n readOnly = false,\n required = false,\n name,\n open,\n defaultOpen,\n onOpenChange,\n inputValue,\n onInputValueChange,\n clearLabel,\n toggleLabel,\n container,\n className,\n classNames,\n id,\n multiple: _,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...rest\n },\n ref,\n) {\n const uid = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputId = id ?? `${uid}-input`;\n const labelId = `${uid}-label`;\n const descId = `${uid}-desc`;\n const errId = `${uid}-err`;\n const hasError = Boolean(error);\n const { invalid: isInvalid, ariaInvalid } = resolveInvalid(\n Boolean(invalid) || hasError,\n callerAriaInvalid,\n );\n const hasDescription = Boolean(description);\n const describedBy =\n [hasDescription ? descId : null, hasError ? errId : null, ariaDescribedBy]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const collection = useMemo(\n () => Base.createItems(options, { getValue: (o) => o.value, getLabel: (o) => o.label }),\n [options],\n );\n\n const validValue = useMemo(\n () => (value !== null && options.some((o) => o.value === value) ? value : null),\n [value, options],\n );\n\n return (\n <Base.Root<string, false, ComboboxOption>\n items={collection}\n value={validValue}\n onValueChange={(next) => {\n if (disabled || readOnly) return;\n onValueChange(next ?? null);\n }}\n inputValue={inputValue}\n onInputValueChange={(next) => {\n onInputValueChange?.(next);\n }}\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={(next) => {\n onOpenChange?.(next);\n }}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n >\n <div\n {...rest}\n ref={rootRef}\n {...kb(\n \"combobox\",\n {\n size,\n invalid: isInvalid,\n disabled,\n readonly: readOnly,\n required,\n },\n className,\n )}\n >\n <label\n id={labelId}\n htmlFor={inputId}\n className={clsx(\"kb-combobox-label\", classNames?.label)}\n >\n {label}\n </label>\n <Base.InputGroup\n aria-labelledby={labelId}\n className={clsx(\"kb-combobox-shell\", classNames?.shell)}\n >\n <Base.Input\n ref={ref}\n id={inputId}\n placeholder={placeholder}\n aria-labelledby={labelId}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-combobox-input\", classNames?.input)}\n />\n <div className={clsx(\"kb-combobox-actions\", classNames?.actions)}>\n <Base.Clear\n aria-label={clearLabel ?? `Clear ${label}`}\n disabled={disabled || readOnly}\n className={clsx(\"kb-combobox-clear\", classNames?.clear)}\n >\n <span aria-hidden=\"true\">×</span>\n </Base.Clear>\n <Base.Trigger\n aria-label={toggleLabel ?? `Toggle ${label} options`}\n disabled={disabled}\n className={clsx(\"kb-combobox-trigger\", classNames?.trigger)}\n >\n <span aria-hidden=\"true\">▾</span>\n </Base.Trigger>\n </div>\n </Base.InputGroup>\n <Base.Portal container={container ?? rootRef}>\n <Base.Positioner\n sideOffset={6}\n className={clsx(\"kb-combobox-positioner\", classNames?.positioner)}\n >\n <Base.Popup className={clsx(\"kb-combobox-popup\", classNames?.popup)}>\n <Base.List\n aria-labelledby={labelId}\n className={clsx(\"kb-combobox-list\", classNames?.list)}\n >\n {(option: ComboboxOption) => (\n <Base.Item\n key={option.value}\n value={option.value}\n disabled={Boolean(option.disabled)}\n className={clsx(\"kb-combobox-option\", classNames?.option)}\n >\n <Base.ItemIndicator\n keepMounted\n className={clsx(\"kb-combobox-option-indicator\", classNames?.optionIndicator)}\n >\n ✓\n </Base.ItemIndicator>\n <span className={clsx(\"kb-combobox-option-label\", classNames?.optionLabel)}>\n {option.label}\n </span>\n </Base.Item>\n )}\n </Base.List>\n <Base.Empty className={clsx(\"kb-combobox-empty\", classNames?.empty)}>\n {emptyMessage}\n </Base.Empty>\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n {hasDescription && (\n <p id={descId} className={clsx(\"kb-combobox-description\", classNames?.description)}>\n {description}\n </p>\n )}\n {hasError && (\n <p id={errId} className={clsx(\"kb-combobox-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n </Base.Root>\n );\n});\n","import { Dialog as Base } from \"@base-ui/react/dialog\";\nimport { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport type { ClassNames } from \"../../utils/kb\";\n\nexport type DialogProps = Base.Root.Props;\nexport type DialogTriggerProps = Base.Trigger.Props;\nexport type DialogCloseProps = Base.Close.Props;\nexport type DialogTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type DialogDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type DialogActionsProps = ComponentProps<\"div\">;\nexport type DialogSectionProps = ComponentProps<\"div\">;\n\nexport type DialogContentProps = Omit<Base.Popup.Props, \"className\" | \"title\"> & {\n /** Centered dialog or inline-end drawer with independently scrolling Body. */\n layout?: \"center\" | \"drawer\";\n /** Accessible name; mutually exclusive with a composed Dialog.Title. */\n title?: ReactNode;\n /** Accessible description; mutually exclusive with a composed Dialog.Description. */\n description?: ReactNode;\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Portal target; defaults to document.body. */\n container?: Base.Portal.Props[\"container\"];\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"backdrop\">;\n};\n\nfunction DialogRoot(props: DialogProps) {\n return <Base.Root {...props} />;\n}\n\nfunction DialogTrigger(props: DialogTriggerProps) {\n return <Base.Trigger {...props} />;\n}\n\nfunction DialogClose(props: DialogCloseProps) {\n return <Base.Close {...props} />;\n}\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return <Base.Title {...props} className={clsx(\"kb-dialog-title\", className)} />;\n}\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return <Base.Description {...props} className={clsx(\"kb-dialog-description\", className)} />;\n}\n\nfunction DialogActions({ className, ...props }: DialogActionsProps) {\n return <div {...props} className={clsx(\"kb-dialog-actions\", className)} />;\n}\n\nfunction DialogHeader({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-header\", className)} />;\n}\nfunction DialogBody({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-body\", className)} />;\n}\nfunction DialogFooter({ className, ...props }: DialogSectionProps) {\n return <div {...props} className={clsx(\"kb-dialog-footer\", className)} />;\n}\n\nfunction DialogContent({\n layout = \"center\",\n classNames,\n title,\n description,\n container,\n children,\n className,\n ...props\n}: DialogContentProps) {\n const hasTitle = title != null && title !== \"\";\n const hasDescription = description != null && description !== \"\";\n const heading = (\n <>\n {hasTitle ? <DialogTitle>{title}</DialogTitle> : null}\n {hasDescription ? <DialogDescription>{description}</DialogDescription> : null}\n </>\n );\n return (\n <Base.Portal container={container}>\n <Base.Backdrop className={clsx(\"kb-dialog-backdrop\", classNames?.backdrop)} />\n <Base.Popup {...props} data-layout={layout} className={clsx(\"kb-dialog-popup\", className)}>\n {layout === \"drawer\" && (hasTitle || hasDescription) ? (\n <DialogHeader>{heading}</DialogHeader>\n ) : (\n heading\n )}\n {children}\n </Base.Popup>\n </Base.Portal>\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Actions: DialogActions,\n Header: DialogHeader,\n Body: DialogBody,\n Footer: DialogFooter,\n});\n","import { clsx } from \"clsx\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Button } from \"../Button/Button\";\nimport { Callout } from \"../Callout/Callout\";\nimport { Dialog, type DialogContentProps, type DialogTriggerProps } from \"../Dialog/Dialog\";\n\nexport type ConfirmActionSlot = \"popup\" | \"backdrop\" | \"details\" | \"error\";\n\n/** Destructive action behind a modal confirmation; the trigger only opens it. */\nexport type ConfirmActionProps = Omit<\n DialogTriggerProps,\n \"className\" | \"title\" | \"children\" | \"handle\" | \"payload\"\n> & {\n /** Trigger text; also the confirm button text unless confirmLabel is set. */\n children: ReactNode;\n /** Plain class string for the trigger. */\n className?: string | undefined;\n /** Dialog heading and accessible name; ask the question the action settles. */\n title: ReactNode;\n /** Consequence of confirming; the dialog's accessible description. */\n description?: ReactNode | undefined;\n /** Further consequence detail, such as what else is removed. */\n details?: ReactNode | undefined;\n /** Runs the action. Throw or reject to keep the dialog open with an error. */\n onConfirm: () => unknown;\n /** Runs once after success, after the dialog has closed; remove the trigger here. */\n onConfirmed?: (() => void) | undefined;\n /** Confirm button text; defaults to the trigger's children. */\n confirmLabel?: ReactNode | undefined;\n /** Confirm button text while the action runs; defaults to confirmLabel. */\n pendingLabel?: ReactNode | undefined;\n /** Cancel button text. */\n cancelLabel?: ReactNode | undefined;\n /** Alert shown after a failure; a function receives the thrown reason. */\n errorMessage?: ReactNode | ((error: unknown) => ReactNode) | undefined;\n /** Controlled visibility. */\n open?: boolean | undefined;\n /** Initial visibility when uncontrolled. */\n defaultOpen?: boolean | undefined;\n /** Receives each requested visibility change, including the close after success. */\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** Focus target after closing; set it when success removes the trigger. */\n finalFocus?: DialogContentProps[\"finalFocus\"] | undefined;\n /** Portal target; defaults to document.body. */\n container?: DialogContentProps[\"container\"] | undefined;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<ConfirmActionSlot> | undefined;\n};\n\nconst DEFAULT_ERROR = \"The action did not complete. Try again.\";\n\nexport function ConfirmAction({\n title,\n description,\n details,\n onConfirm,\n onConfirmed,\n confirmLabel,\n pendingLabel,\n cancelLabel = \"Cancel\",\n errorMessage = DEFAULT_ERROR,\n open,\n defaultOpen = false,\n onOpenChange,\n finalFocus,\n container,\n classNames,\n className,\n children,\n render = <Button variant=\"danger\" />,\n ...props\n}: ConfirmActionProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const [pending, setPending] = useState(false);\n const [failure, setFailure] = useState<{ reason: unknown } | null>(null);\n const cancel = useRef<HTMLButtonElement>(null);\n // Guards repeat activation before React commits `pending`.\n const submitting = useRef(false);\n const succeeded = useRef(false);\n const mounted = useRef(true);\n const isOpen = open ?? uncontrolledOpen;\n const openNow = useRef(isOpen);\n const latestConfirmed = useRef(onConfirmed);\n const [confirmedCount, setConfirmedCount] = useState(0);\n useEffect(() => {\n openNow.current = isOpen;\n latestConfirmed.current = onConfirmed;\n });\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n // An effect, so the popup has unmounted before the caller removes the trigger.\n useEffect(() => {\n if (confirmedCount > 0) latestConfirmed.current?.();\n }, [confirmedCount]);\n\n function change(next: boolean) {\n if (open === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n }\n\n async function confirm() {\n if (submitting.current) return;\n submitting.current = true;\n setPending(true);\n setFailure(null);\n try {\n await onConfirm();\n if (!mounted.current) return;\n if (openNow.current) {\n succeeded.current = true;\n change(false);\n } else {\n setConfirmedCount((n) => n + 1);\n }\n } catch (reason) {\n if (mounted.current) setFailure({ reason });\n } finally {\n submitting.current = false;\n if (mounted.current) setPending(false);\n }\n }\n\n const confirmText = confirmLabel ?? children;\n const message =\n failure && (typeof errorMessage === \"function\" ? errorMessage(failure.reason) : errorMessage);\n\n return (\n <Dialog\n open={isOpen}\n disablePointerDismissal\n onOpenChange={(next, eventDetails) => {\n if (submitting.current) {\n eventDetails.cancel();\n return;\n }\n succeeded.current = false;\n setFailure(null);\n change(next);\n }}\n onOpenChangeComplete={(next) => {\n if (!succeeded.current) return;\n succeeded.current = false;\n if (!next) setConfirmedCount((n) => n + 1);\n }}\n >\n <Dialog.Trigger {...props} render={render} className={className}>\n {children}\n </Dialog.Trigger>\n <Dialog.Content\n title={title}\n description={description}\n initialFocus={cancel}\n aria-busy={pending || undefined}\n {...(finalFocus === undefined ? {} : { finalFocus })}\n {...(container === undefined ? {} : { container })}\n {...(classNames?.backdrop ? { classNames: { backdrop: classNames.backdrop } } : {})}\n {...kb(\"confirmaction\", { pending }, classNames?.popup)}\n >\n {details != null ? (\n <div className={clsx(\"kb-confirmaction-details\", classNames?.details)}>{details}</div>\n ) : null}\n {failure ? (\n <Callout\n tone=\"danger\"\n role=\"alert\"\n className={clsx(\"kb-confirmaction-error\", classNames?.error)}\n >\n {message}\n </Callout>\n ) : null}\n <Dialog.Actions>\n <Dialog.Close\n ref={cancel}\n render={<Button variant=\"ghost\" disabled={pending} focusableWhenDisabled />}\n >\n {cancelLabel}\n </Dialog.Close>\n <Button\n variant=\"danger\"\n disabled={pending}\n focusableWhenDisabled\n onClick={() => void confirm()}\n >\n {pending ? (pendingLabel ?? confirmText) : confirmText}\n </Button>\n </Dialog.Actions>\n </Dialog.Content>\n </Dialog>\n );\n}\n","import { createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutElementProps } from \"../../utils/layout\";\n\nexport type ContainerElement =\n | \"div\"\n | \"main\"\n | \"section\"\n | \"article\"\n | \"aside\"\n | \"header\"\n | \"footer\";\nexport type ContainerSize = \"sm\" | \"md\" | \"lg\" | \"full\";\nexport type ContainerProps<T extends ContainerElement = \"div\"> = LayoutElementProps<T> & {\n /** Maximum outer width, including gutters. */\n size?: ContainerSize;\n /** Shared responsive gutters; disable when the parent owns padding. */\n gutter?: boolean;\n};\n\nexport function Container<T extends ContainerElement = \"div\">({\n as,\n size = \"lg\",\n gutter = true,\n className,\n ...props\n}: ContainerProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n \"data-gutter\": undefined,\n ...kb(\"container\", { size, gutter: gutter ? undefined : \"none\" }, className),\n });\n}\n","import {\n type ComponentProps,\n type ComponentType,\n createContext,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type LinkProps = ComponentProps<\"a\"> & {\n /** Navigation destination; use Button for actions. */\n href: string;\n};\n\n/** Router adapter contract: render an anchor with href; pass other props and ref through. */\nexport type LinkComponent = \"a\" | ComponentType<LinkProps>;\n\nconst LinkComponentContext = createContext<LinkComponent>(\"a\");\n\nexport type LinkProviderProps = {\n /** Renders every kbui anchor below it; adapt your router's link here. */\n component: LinkComponent;\n children?: ReactNode;\n};\n\nfunction LinkProvider({ component, children }: LinkProviderProps) {\n return (\n <LinkComponentContext.Provider value={component}>{children}</LinkComponentContext.Provider>\n );\n}\n\nexport function useLinkComponent(): LinkComponent {\n return useContext(LinkComponentContext);\n}\n\nfunction LinkRoot({ className, ...props }: LinkProps) {\n const Anchor = useLinkComponent();\n return <Anchor {...props} {...kb(\"link\", {}, className)} />;\n}\n\nexport const Link = Object.assign(LinkRoot, { Provider: LinkProvider });\n","import { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type CodeLanguage, tokenizeCode } from \"../Code/tokenize\";\nimport { Link } from \"../Link/Link\";\n\ntype Range = { start: number; end: number };\ntype WebLink = Range & { href: string };\ntype ContentOptions = {\n highlight?: string | readonly string[] | undefined;\n linkify: boolean;\n detectCode: boolean;\n codeLanguage?: CodeLanguage | undefined;\n codeClassName?: string | undefined;\n highlightClassName?: string | undefined;\n linkClassName?: string | undefined;\n};\n\nfunction highlightRanges(value: string, highlight: ContentOptions[\"highlight\"]): Range[] {\n const terms = (typeof highlight === \"string\" ? [highlight] : (highlight ?? [])).filter(Boolean);\n const ranges: Range[] = [];\n let cursor = 0;\n while (cursor < value.length) {\n let next: Range | undefined;\n for (const term of terms) {\n const start = value.indexOf(term, cursor);\n if (start < 0) continue;\n const end = start + term.length;\n if (!next || start < next.start || (start === next.start && end > next.end)) {\n next = { start, end };\n }\n }\n if (!next) break;\n ranges.push(next);\n cursor = next.end;\n }\n return ranges;\n}\n\nfunction webLinks(value: string): WebLink[] {\n const links: WebLink[] = [];\n for (const match of value.matchAll(\n /(?:https?:\\/\\/|www\\.)[^\\s<>\"'`\\p{Cc}\\u2018\\u2019\\u201c\\u201d]+/giu,\n )) {\n if (/[a-z0-9@_.-]/i.test(value[match.index - 1] ?? \"\")) continue;\n let href = match[0];\n // Keep balanced URL delimiters; leave sentence punctuation outside anchor.\n while (href) {\n const last = href.at(-1) ?? \"\";\n const opener = ({ \")\": \"(\", \"]\": \"[\", \"}\": \"{\" } as Record<string, string>)[last];\n if (\n /[.,!?;:]/.test(last) ||\n (opener && href.split(last).length > href.split(opener).length)\n ) {\n href = href.slice(0, -1);\n } else break;\n }\n try {\n const url = new URL(/^www\\./i.test(href) ? `https://${href}` : href);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") continue;\n links.push({\n start: match.index,\n end: match.index + href.length,\n href: /^www\\./i.test(href) ? `https://${href}` : href,\n });\n } catch {\n // Invalid web candidates remain literal text.\n }\n }\n for (const match of value.matchAll(\n /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+/giu,\n )) {\n const start = match.index;\n const end = start + match[0].length;\n if (/[a-z0-9.!#$%&'*+/=?^_`{|}~@-]/i.test(value[start - 1] ?? \"\")) continue;\n if (links.some((link) => start < link.end && end > link.start)) continue;\n links.push({\n start,\n end,\n href: `mailto:${encodeURIComponent(match[0]).replaceAll(\"%40\", \"@\")}`,\n });\n }\n return links.sort((a, b) => a.start - b.start);\n}\n\nconst CODE_LANGUAGES: Record<string, CodeLanguage> = {\n ts: \"ts\",\n tsx: \"tsx\",\n typescript: \"ts\",\n js: \"js\",\n jsx: \"jsx\",\n javascript: \"js\",\n json: \"json\",\n css: \"css\",\n html: \"html\",\n sh: \"bash\",\n bash: \"bash\",\n shell: \"bash\",\n text: \"plain\",\n plain: \"plain\",\n};\n\nexport function detectCopyableLanguage(value: string): CodeLanguage | undefined {\n const source = value.trim();\n const fence = /^```([^\\s`]*)[^\\S\\r\\n]*\\r?\\n[\\s\\S]*\\r?\\n```$/.exec(source);\n if (fence) {\n const language = fence[1]?.toLowerCase() ?? \"\";\n return Object.hasOwn(CODE_LANGUAGES, language) ? CODE_LANGUAGES[language] : \"plain\";\n }\n if (/^[{[]/.test(source)) {\n try {\n JSON.parse(source);\n return \"json\";\n } catch {\n /* Continue with conservative source patterns. */\n }\n }\n if (\n /^(?:(?:export\\s+(?:default\\s+)?)?(?:const|let|var)\\s+[\\w$]+\\s*[:=]|(?:export\\s+)?(?:async\\s+)?function\\s+[\\w$]+\\s*\\(|(?:export\\s+)?(?:class|interface|enum)\\s+\\w+|(?:export\\s+)?type\\s+\\w+\\s*=|import\\s+(?:.+\\s+from\\s+[\"']|[\"']))/.test(\n source,\n )\n )\n return \"ts\";\n if (/^<(?:[A-Z][\\w.]*)[\\s/>]/.test(source)) return \"tsx\";\n if (/^<(?:!doctype\\s+html|[a-z][\\w-]*(?:\\s[^<>]*)?)[\\s/>]/i.test(source)) return \"html\";\n if (\n /^(?:(?:\\$\\s+)?(?:bun|npm|pnpm|yarn)\\s+(?:add|install|run|test|exec|dlx|build)\\b|(?:\\$\\s+)?git\\s+(?:status|diff|log|add|commit|push|pull|fetch|checkout|switch|clone)\\b|(?:\\$\\s+)?curl\\s+(?:-|https?:\\/\\/))/.test(\n source,\n )\n )\n return \"bash\";\n if (/^(?:[.#@][\\w-]|[a-z][\\w-]*[\\s:#.])[\\s\\S]*\\{\\s*[\\w-]+\\s*:/i.test(source)) return \"css\";\n return undefined;\n}\n\nexport function renderCopyableContent(value: string, options: ContentOptions): ReactNode {\n const highlights = highlightRanges(value, options.highlight);\n if (!options.linkify && !options.detectCode && !options.codeLanguage && highlights.length === 0)\n return value;\n const text = (start: number, end: number): ReactNode => {\n if (start >= end) return null;\n const nodes: ReactNode[] = [];\n let cursor = start;\n for (const range of highlights) {\n if (range.end <= start) continue;\n if (range.start >= end) break;\n const from = Math.max(cursor, range.start);\n const to = Math.min(end, range.end);\n if (from > cursor) nodes.push(value.slice(cursor, from));\n nodes.push(\n <mark key={from} className={clsx(\"kb-copyabletext-highlight\", options.highlightClassName)}>\n {value.slice(from, to)}\n </mark>,\n );\n cursor = to;\n }\n if (cursor < end) nodes.push(value.slice(cursor, end));\n return nodes;\n };\n const code = (start: number, end: number, language: CodeLanguage): ReactNode => {\n let from = start;\n let to = end;\n const source = value.slice(start, end);\n if (source.trim().startsWith(\"```\") && source.includes(\"\\n\")) {\n from = start + source.indexOf(\"\\n\") + 1;\n to = start + source.lastIndexOf(\"```\");\n } else if (source.startsWith(\"`\") && source.endsWith(\"`\")) {\n from += 1;\n to -= 1;\n }\n const nodes: ReactNode[] = [text(start, from)];\n let cursor = from;\n for (const [tokenStart, tokenEnd, kind] of tokenizeCode(value.slice(from, to), language)) {\n const begin = from + tokenStart;\n const finish = from + tokenEnd;\n if (begin > cursor) nodes.push(text(cursor, begin));\n nodes.push(\n <span key={begin} data-syntax={kind}>\n {text(begin, finish)}\n </span>,\n );\n cursor = finish;\n }\n nodes.push(text(cursor, end));\n return (\n <code\n key={`code-${start}`}\n className={clsx(\"kb-code\", \"kb-copyabletext-code\", options.codeClassName)}\n data-language={language}\n >\n {nodes}\n </code>\n );\n };\n if (options.codeLanguage) return code(0, value.length, options.codeLanguage);\n const codeRanges = options.detectCode\n ? [...value.matchAll(/`([^`\\r\\n]+)`/g)].map((match) => ({\n start: match.index,\n end: match.index + match[0].length,\n }))\n : [];\n const links = options.linkify\n ? webLinks(value).filter(\n (link) => !codeRanges.some((range) => link.start < range.end && link.end > range.start),\n )\n : [];\n const ranges = [\n ...codeRanges.map((range) => ({ ...range, kind: \"code\" as const })),\n ...links.map((link) => ({ ...link, kind: \"link\" as const })),\n ].sort((a, b) => a.start - b.start);\n const nodes: ReactNode[] = [];\n let cursor = 0;\n for (const range of ranges) {\n nodes.push(text(cursor, range.start));\n if (range.kind === \"code\") {\n nodes.push(\n code(\n range.start,\n range.end,\n detectCopyableLanguage(value.slice(range.start + 1, range.end - 1)) ?? \"plain\",\n ),\n );\n } else {\n nodes.push(\n <Link\n key={range.start}\n href={range.href}\n className={clsx(\"kb-copyabletext-link\", options.linkClassName)}\n >\n {text(range.start, range.end)}\n </Link>,\n );\n }\n cursor = range.end;\n }\n nodes.push(text(cursor, value.length));\n return nodes;\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useEffect, useId, useState } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { type CopyFeedbackProps, useClipboard } from \"../../utils/useClipboard\";\nimport type { CodeLanguage } from \"../Code/tokenize\";\nimport { detectCopyableLanguage, renderCopyableContent } from \"./content\";\n\nexport type CopyableTextPart =\n | \"label\"\n | \"value\"\n | \"actions\"\n | \"toggle\"\n | \"copy\"\n | \"feedback\"\n | \"link\"\n | \"highlight\"\n | \"code\";\nexport type CopyableTextFormat = \"auto\" | \"text\" | \"code\";\nexport type CopyableTextTone = \"neutral\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type CopyableTextProps = Omit<ComponentProps<\"span\">, \"onCopy\"> &\n CopyFeedbackProps & {\n /** Exact clipboard value; display formatting never changes copied bytes. */\n value: string;\n /** Optional visible context above value. */\n label?: string | undefined;\n /** Bordered field or inline text with adjacent copy action. */\n appearance?: \"field\" | \"plain\" | undefined;\n /** Content and copy target density. */\n size?: \"sm\" | \"md\" | undefined;\n /** Monospace display for identifiers, paths, and commands. */\n mono?: boolean | undefined;\n /** Value color and subtle field tint; independent of clipboard state. */\n tone?: CopyableTextTone | undefined;\n /** Single-line preview with explicit full-value disclosure. */\n truncate?: boolean | undefined;\n /** Collapsed disclosure button text. */\n expandLabel?: string | undefined;\n /** Expanded disclosure button text. */\n collapseLabel?: string | undefined;\n /** Case-sensitive literal terms to emphasize; longer matches win overlaps. */\n highlight?: string | readonly string[] | undefined;\n /** Automatic recognition, literal text, or explicit source code. */\n format?: CopyableTextFormat | undefined;\n /** Code language hint; forces code in automatic mode. */\n language?: CodeLanguage | undefined;\n /** Override automatic web/email links when full content is visible. */\n linkify?: boolean | undefined;\n /** Extra classes for each rendered part. */\n classNames?: ClassNames<CopyableTextPart> | undefined;\n };\n\nexport function CopyableText({\n value,\n label,\n appearance = \"field\",\n size = \"md\",\n mono = true,\n tone = \"neutral\",\n truncate = false,\n expandLabel = \"Show full value\",\n collapseLabel = \"Show less\",\n highlight,\n linkify,\n format = \"auto\",\n language,\n copyLabel = \"Copy\",\n copyingLabel = \"Copying…\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Retry copy\",\n successMessage = \"Copied to clipboard\",\n errorMessage = \"Copy failed. Select and copy the text manually.\",\n disabled,\n feedbackDuration,\n onCopy,\n onCopyError,\n className,\n classNames,\n children,\n ...props\n}: CopyableTextProps) {\n const valueId = useId();\n const codeLanguage =\n format === \"text\"\n ? undefined\n : (language ?? (format === \"code\" ? \"tsx\" : detectCopyableLanguage(value)));\n const [disclosure, setDisclosure] = useState({ value, open: false });\n const expanded = truncate && disclosure.value === value && disclosure.open;\n useEffect(() => setDisclosure({ value, open: false }), [value]);\n const clipboard = useClipboard(value, {\n disabled,\n feedbackDuration,\n onCopy,\n onCopyError: (error) => {\n setDisclosure({ value, open: true });\n onCopyError?.(error);\n },\n });\n const buttonLabel = {\n idle: copyLabel,\n pending: copyingLabel,\n copied: copiedLabel,\n failed: copyErrorLabel,\n }[clipboard.state];\n return (\n <span\n {...props}\n {...kb(\n \"copyabletext\",\n {\n appearance,\n format: codeLanguage ? \"code\" : \"text\",\n size,\n mono,\n tone,\n expandable: truncate,\n expanded,\n truncate: truncate && !expanded,\n disabled: clipboard.disabled,\n \"copy-state\": clipboard.state,\n },\n className,\n )}\n >\n {label ? (\n <span className={clsx(\"kb-copyabletext-label\", classNames?.label)}>{label}</span>\n ) : null}\n <span className={clsx(\"kb-copyabletext-value\", classNames?.value)} id={valueId}>\n {children != null && !expanded && clipboard.state !== \"failed\"\n ? children\n : renderCopyableContent(value, {\n highlight,\n linkify: (linkify ?? format !== \"text\") && (!truncate || expanded),\n detectCode: format !== \"text\",\n codeLanguage,\n codeClassName: classNames?.code,\n highlightClassName: classNames?.highlight,\n linkClassName: classNames?.link,\n })}\n </span>\n <span className={clsx(\"kb-copyabletext-actions\", classNames?.actions)}>\n {truncate ? (\n <button\n type=\"button\"\n className={clsx(\"kb-copyabletext-toggle\", classNames?.toggle)}\n aria-expanded={expanded}\n aria-controls={valueId}\n onClick={() => setDisclosure({ value, open: !expanded })}\n >\n {expanded ? collapseLabel : expandLabel}\n </button>\n ) : null}\n <button\n type=\"button\"\n className={clsx(\"kb-copyabletext-copy\", classNames?.copy)}\n disabled={clipboard.disabled}\n aria-disabled={clipboard.state === \"pending\" || undefined}\n onClick={() => void clipboard.copy()}\n >\n {buttonLabel}\n </button>\n </span>\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(\n \"kb-copyabletext-feedback\",\n clipboard.state !== \"failed\" && \"kb-sr-only\",\n classNames?.feedback,\n )}\n >\n {clipboard.state === \"copied\"\n ? successMessage\n : clipboard.state === \"failed\"\n ? errorMessage\n : clipboard.state === \"pending\"\n ? copyingLabel\n : \"\"}\n </span>\n </span>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type DashboardPart = \"header\" | \"metrics\" | \"panels\" | \"primary\" | \"secondary\";\n\nexport interface DashboardProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** Page title, freshness and page actions; usually a PageHeader. */\n header?: ReactNode | undefined;\n /** Row of headline metrics below the header. */\n metrics?: ReactNode | undefined;\n /** Main panels; take two thirds beside secondary on wide pages. */\n primary?: ReactNode | undefined;\n /** Supporting panels; move below primary on narrow pages. */\n secondary?: ReactNode | undefined;\n /** Classes for inner regions, keyed by region. */\n classNames?: ClassNames<DashboardPart> | undefined;\n}\n\n/** Layout intent for an overview page: header, metrics, then primary and secondary panels. */\nexport const Dashboard = ({\n ref,\n header,\n metrics,\n primary,\n secondary,\n className,\n classNames,\n ...props\n}: DashboardProps) => (\n <div {...props} ref={ref} {...kb(\"dashboard\", {}, className)}>\n {header ? (\n <div className={clsx(\"kb-dashboard-header\", classNames?.header)}>{header}</div>\n ) : null}\n {metrics ? (\n <div className={clsx(\"kb-dashboard-metrics\", classNames?.metrics)}>{metrics}</div>\n ) : null}\n {primary || secondary ? (\n <div className={clsx(\"kb-dashboard-panels\", classNames?.panels)}>\n {primary ? (\n <div className={clsx(\"kb-dashboard-primary\", classNames?.primary)}>{primary}</div>\n ) : null}\n {secondary ? (\n <div className={clsx(\"kb-dashboard-secondary\", classNames?.secondary)}>{secondary}</div>\n ) : null}\n </div>\n ) : null}\n </div>\n);\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type DescriptionListProps = ComponentProps<\"dl\"> & {\n /** Responsive label/value columns, always horizontal, or always stacked. */\n layout?: \"responsive\" | \"horizontal\" | \"stacked\" | undefined;\n density?: \"comfortable\" | \"dense\" | undefined;\n dividers?: boolean | undefined;\n};\nfunction DescriptionListRoot({\n layout = \"responsive\",\n density = \"comfortable\",\n dividers = true,\n className,\n ...props\n}: DescriptionListProps) {\n return <dl {...props} {...kb(\"descriptionlist\", { layout, density, dividers }, className)} />;\n}\nexport type DescriptionListItemProps = ComponentProps<\"div\">;\nfunction DescriptionListItem({ className, ...props }: DescriptionListItemProps) {\n return <div {...props} {...kb(\"descriptionlist-item\", {}, className)} />;\n}\nexport type DescriptionListTermProps = ComponentProps<\"dt\">;\nfunction DescriptionListTerm({ className, ...props }: DescriptionListTermProps) {\n return <dt {...props} {...kb(\"descriptionlist-term\", {}, className)} />;\n}\nexport type DescriptionListDetailProps = ComponentProps<\"dd\">;\nfunction DescriptionListDetail({ className, ...props }: DescriptionListDetailProps) {\n return <dd {...props} {...kb(\"descriptionlist-detail\", {}, className)} />;\n}\nexport const DescriptionList = Object.assign(DescriptionListRoot, {\n Item: DescriptionListItem,\n Term: DescriptionListTerm,\n Detail: DescriptionListDetail,\n});\n","import { Collapsible as Base } from \"@base-ui/react/collapsible\";\nimport { CollapsiblePanel } from \"../../utils/CollapsiblePanel\";\nimport { kb } from \"../../utils/kb\";\n\nexport type DisclosureProps = Omit<Base.Root.Props, \"className\"> & {\n /** Plain class string on root. */\n className?: string | undefined;\n};\nexport type DisclosureTriggerProps = Omit<Base.Trigger.Props, \"className\"> & {\n /** Plain class string on trigger. */\n className?: string | undefined;\n};\nexport type DisclosurePanelProps = Omit<Base.Panel.Props, \"className\"> & {\n /** Plain class string on panel. */\n className?: string | undefined;\n};\n\nfunction DisclosureRoot({ className, ...props }: DisclosureProps) {\n return <Base.Root {...props} {...kb(\"disclosure\", {}, className)} />;\n}\nfunction DisclosureTrigger({ className, ...props }: DisclosureTriggerProps) {\n return <Base.Trigger {...props} {...kb(\"disclosure-trigger\", {}, className)} />;\n}\nfunction DisclosurePanel({ className, children, render, ...props }: DisclosurePanelProps) {\n return (\n <Base.Panel\n {...props}\n {...kb(\"disclosure-panel\", {}, className)}\n render={(nativeProps, state) => (\n <CollapsiblePanel nativeProps={nativeProps} state={state} render={render} />\n )}\n >\n <div className=\"kb-disclosure-panel-content\">{children}</div>\n </Base.Panel>\n );\n}\n\nexport const Disclosure = Object.assign(DisclosureRoot, {\n Trigger: DisclosureTrigger,\n Panel: DisclosurePanel,\n});\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type EmptyStateSize = \"sm\" | \"md\" | \"lg\";\nexport type EmptyStateVariant = \"surface\" | \"subtle\" | \"plain\";\nexport type EmptyStateTone = \"neutral\" | \"info\" | \"warning\" | \"danger\";\nexport type EmptyStateHeadingLevel = 2 | 3 | 4;\n\nexport type EmptyStateProps = Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Primary heading explaining why the region is empty or unavailable. */\n title: ReactNode;\n /** Supporting guidance explaining what appears here or how to proceed. */\n description?: ReactNode;\n /** Short category or state label above the title. */\n eyebrow?: ReactNode;\n /** Decorative glyph or emblem rendered above the header. */\n icon?: ReactNode;\n /** Primary and secondary recovery or creation controls. */\n actions?: ReactNode;\n /** Quiet metadata or secondary link below the actions. */\n footer?: ReactNode;\n /** Document outline rank for the title heading (`2`–`4`). */\n headingLevel?: EmptyStateHeadingLevel;\n size?: EmptyStateSize;\n variant?: EmptyStateVariant;\n tone?: EmptyStateTone;\n /** Announces dynamic empty or recoverable failure updates via `role=\"status\"`. */\n live?: boolean;\n classNames?: ClassNames<\n \"icon\" | \"header\" | \"eyebrow\" | \"title\" | \"description\" | \"body\" | \"actions\" | \"footer\"\n >;\n};\n\nconst headingTags = {\n 2: \"h2\",\n 3: \"h3\",\n 4: \"h4\",\n} as const;\n\n/** Structured placeholder for empty collections, zero-match filters, and recoverable section errors. */\nexport function EmptyState({\n title,\n description,\n eyebrow,\n icon,\n actions,\n footer,\n headingLevel = 3,\n size = \"md\",\n variant = \"surface\",\n tone = \"neutral\",\n live = false,\n className,\n classNames,\n children,\n ...rest\n}: EmptyStateProps) {\n const HeadingTag = headingTags[headingLevel];\n\n return (\n <div\n {...rest}\n {...(live ? { role: \"status\" } : {})}\n {...kb(\"emptystate\", { size, variant, tone }, className)}\n >\n {icon != null ? (\n <span className={clsx(\"kb-emptystate-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <div className={clsx(\"kb-emptystate-header\", classNames?.header)}>\n {eyebrow != null ? (\n <p className={clsx(\"kb-emptystate-eyebrow\", classNames?.eyebrow)}>{eyebrow}</p>\n ) : null}\n <HeadingTag className={clsx(\"kb-emptystate-title\", classNames?.title)}>{title}</HeadingTag>\n {description != null ? (\n <p className={clsx(\"kb-emptystate-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n </div>\n {children != null ? (\n <div className={clsx(\"kb-emptystate-body\", classNames?.body)}>{children}</div>\n ) : null}\n {actions != null ? (\n <div className={clsx(\"kb-emptystate-actions\", classNames?.actions)}>{actions}</div>\n ) : null}\n {footer != null ? (\n <div className={clsx(\"kb-emptystate-footer\", classNames?.footer)}>{footer}</div>\n ) : null}\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type MouseEvent, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ErrorSummaryHeadingLevel = 2 | 3 | 4;\nexport type ErrorSummaryPart = \"title\" | \"description\" | \"list\" | \"item\" | \"link\";\n\nexport interface ErrorSummaryItem {\n /** Optional key when multiple items point to the same href. */\n id?: string | undefined;\n /** Anchor fragment such as \"#email\" targeting the invalid field or group. */\n href: string;\n /** Actionable message naming the field and how to fix it. */\n label: ReactNode;\n}\n\nexport interface ErrorSummaryProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n /** Summary heading displayed above the error list. */\n title?: ReactNode | undefined;\n /** Optional guidance shown between the heading and list. */\n description?: ReactNode | undefined;\n /** Ordered field errors with fragment links for focus recovery. */\n items: readonly ErrorSummaryItem[];\n /** Document heading rank for the summary title. */\n headingLevel?: ErrorSummaryHeadingLevel | undefined;\n /** Callback fired when a recovery link is activated. */\n onItemSelect?: ((href: string, event: MouseEvent<HTMLAnchorElement>) => void) | undefined;\n /** Classes for the title, description, list, item and link slots. */\n classNames?: ClassNames<ErrorSummaryPart> | undefined;\n}\n\nconst FOCUSABLE_CHILD_SELECTOR = [\n \"input:not(:disabled):not([type='hidden']):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"textarea:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"select:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"button:not(:disabled):not([hidden]):not([tabindex='-1']):not([aria-hidden='true'])\",\n \"[tabindex]:not([tabindex='-1']):not(:disabled):not([hidden]):not([aria-hidden='true']):not([aria-disabled='true'])\",\n].join(\", \");\n\nfunction focusTargetByHref(doc: Document, href: string): boolean {\n if (!href.startsWith(\"#\") || href.length < 2) return false;\n const rawId = href.slice(1);\n let targetId = rawId;\n try {\n targetId = decodeURIComponent(rawId);\n } catch {\n targetId = rawId;\n }\n const element = doc.getElementById(targetId);\n if (!element) return false;\n\n const focusTarget = element.matches(FOCUSABLE_CHILD_SELECTOR)\n ? element\n : (element.querySelector<HTMLElement>(FOCUSABLE_CHILD_SELECTOR) ??\n (element.hasAttribute(\"tabindex\") && !element.matches(\":disabled\") && !element.hidden\n ? element\n : null));\n if (!focusTarget) return false;\n\n focusTarget.focus();\n focusTarget.scrollIntoView?.({ block: \"nearest\" });\n return true;\n}\n\n/** Focusable form-level validation alert that links each error to its field. */\nexport const ErrorSummary = ({\n ref,\n title = \"There is a problem\",\n description,\n items,\n headingLevel = 2,\n onItemSelect,\n tabIndex = -1,\n className,\n classNames,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...props\n}: ErrorSummaryProps) => {\n const reactId = useId();\n if (items.length === 0) return null;\n\n const baseId = props.id ?? `kb-errorsummary-${reactId}`;\n const titleId = `${baseId}-title`;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const labelledBy = ariaLabelledBy ?? titleId;\n const describedBy = [descriptionId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n const HeadingTag = `h${headingLevel}` as const;\n const seenKeys = new Map<string, number>();\n\n return (\n <div\n {...props}\n ref={ref}\n role=\"alert\"\n tabIndex={tabIndex}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n {...kb(\"errorsummary\", {}, className)}\n >\n <HeadingTag id={titleId} className={clsx(\"kb-errorsummary-title\", classNames?.title)}>\n {title}\n </HeadingTag>\n {description ? (\n <p\n id={descriptionId}\n className={clsx(\"kb-errorsummary-description\", classNames?.description)}\n >\n {description}\n </p>\n ) : null}\n <ul className={clsx(\"kb-errorsummary-list\", classNames?.list)}>\n {items.map((item) => {\n const baseKey =\n item.id ??\n `${item.href}:${typeof item.label === \"string\" || typeof item.label === \"number\" ? item.label : \"\"}`;\n const occurrence = (seenKeys.get(baseKey) ?? 0) + 1;\n seenKeys.set(baseKey, occurrence);\n const itemKey = occurrence === 1 ? baseKey : `${baseKey}:${occurrence}`;\n return (\n <li key={itemKey} className={clsx(\"kb-errorsummary-item\", classNames?.item)}>\n <a\n href={item.href}\n className={clsx(\"kb-errorsummary-link\", classNames?.link)}\n onClick={(event) => {\n onItemSelect?.(item.href, event);\n if (event.defaultPrevented) return;\n if (focusTargetByHref(event.currentTarget.ownerDocument, item.href)) {\n event.preventDefault();\n }\n }}\n >\n {item.label}\n </a>\n </li>\n );\n })}\n </ul>\n </div>\n );\n};\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type FieldsetPart = \"legend\" | \"description\" | \"fields\" | \"error\";\n\nexport interface FieldsetProps extends ComponentProps<\"fieldset\"> {\n /** Group heading rendered inside the native legend element. */\n legend: ReactNode;\n /** Hide the legend visually while keeping the accessible group name. */\n visuallyHidden?: boolean | undefined;\n /** Supporting context explaining the grouped fields. */\n description?: ReactNode | undefined;\n /** Group-level validation error message. */\n error?: ReactNode | undefined;\n /** Classes for the legend, description, fields and error slots. */\n classNames?: ClassNames<FieldsetPart> | undefined;\n}\n\n/** Semantic fieldset and legend section that groups related form controls. */\nexport const Fieldset = ({\n ref,\n legend,\n visuallyHidden,\n description,\n error,\n disabled,\n className,\n classNames,\n children,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: FieldsetProps) => {\n const reactId = useId();\n const baseId = props.id ?? `kb-fieldset-${reactId}`;\n const hasError = Boolean(error);\n const { invalid, ariaInvalid } = resolveInvalid(hasError, callerAriaInvalid);\n const descriptionId = description ? `${baseId}-description` : undefined;\n const errorId = hasError ? `${baseId}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n\n return (\n <fieldset\n {...props}\n ref={ref}\n disabled={disabled}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n {...kb(\"fieldset\", { disabled: Boolean(disabled), invalid }, className)}\n >\n <legend\n className={clsx(\"kb-fieldset-legend\", visuallyHidden && \"kb-sr-only\", classNames?.legend)}\n >\n {legend}\n </legend>\n {description ? (\n <p id={descriptionId} className={clsx(\"kb-fieldset-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n <div className={clsx(\"kb-fieldset-fields\", classNames?.fields)}>{children}</div>\n {hasError ? (\n <div id={errorId} className={clsx(\"kb-fieldset-error\", classNames?.error)}>\n {error}\n </div>\n ) : null}\n </fieldset>\n );\n};\n","import { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n type ReactNode,\n type Ref,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nimport { Button } from \"../Button/Button\";\n\nexport type FileInputItem = {\n /** Stable unique identity independent of display name. */\n id: string;\n /** Visible filename and default accessible removal name. */\n name: string;\n /** Caller-owned metadata such as size or processing status. */\n description?: ReactNode;\n};\nexport type FileInputProps = Omit<\n ComponentProps<\"div\">,\n \"onChange\" | \"children\" | \"defaultValue\"\n> & {\n /** Accessible field label. */\n label: string;\n /** Retained items; caller owns acceptance and list updates. */\n items: readonly FileInputItem[];\n /** Receives original native File objects without policy filtering. */\n onFiles: (files: File[]) => void;\n /** Requests removal; focus moves only after items change. */\n onRemove: (id: string) => void;\n /** Native picker hint; callers must validate selected files. */\n accept?: string;\n /** Allow multiple selections; defaults to true. */\n multiple?: boolean;\n /** Block selection, removal and mutation callbacks. */\n disabled?: boolean;\n /** Keep retained items readable while blocking changes. */\n readOnly?: boolean;\n /** Helper text associated with picker action. */\n description?: string;\n /** Caller-owned rejection/error text; announced when shown. */\n error?: string;\n /** Hide field label visually while retaining accessible name. */\n visuallyHidden?: boolean;\n /** Localized picker action; defaults to Choose files. */\n chooseLabel?: string;\n /** Localized empty list message. */\n emptyMessage?: string;\n /** Localized accessible remove action for an item. */\n removeLabel?: (item: FileInputItem) => string;\n /** Localized announcement after controlled removal succeeds. */\n removedMessage?: (item: FileInputItem) => string;\n /** Localized native selection announcement; does not imply acceptance. */\n selectionMessage?: (count: number) => string;\n /** Custom item content; retain visible file identity. */\n renderItem?: (item: FileInputItem) => ReactNode;\n /** Class on picker action. */\n triggerClassName?: string;\n /** Class on retained-item list. */\n listClassName?: string;\n /** Class on each retained item. */\n itemClassName?: string;\n /** Ref to native hidden file input. */\n inputRef?: Ref<HTMLInputElement>;\n /** Ref to accessible picker button. */\n triggerRef?: Ref<HTMLButtonElement>;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n | \"label\"\n | \"trigger\"\n | \"list\"\n | \"item\"\n | \"native\"\n | \"description\"\n | \"error\"\n | \"content\"\n | \"name\"\n | \"metadata\"\n | \"remove\"\n | \"empty\"\n >;\n};\nconst defaultRemoveLabel = (item: FileInputItem) => `Remove ${item.name}`;\nconst defaultRemovedMessage = (item: FileInputItem) => `${item.name} removed.`;\nconst defaultSelectionMessage = (count: number) =>\n `${count} ${count === 1 ? \"file\" : \"files\"} selected.`;\n\nexport function FileInput({\n classNames,\n label,\n items,\n onFiles,\n onRemove,\n accept,\n multiple = true,\n disabled = false,\n readOnly = false,\n description,\n error,\n visuallyHidden,\n chooseLabel = \"Choose files\",\n emptyMessage = \"No files added.\",\n removeLabel = defaultRemoveLabel,\n removedMessage = defaultRemovedMessage,\n selectionMessage = defaultSelectionMessage,\n renderItem,\n triggerClassName,\n listClassName,\n itemClassName,\n inputRef,\n triggerRef,\n className,\n onBlurCapture,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: FileInputProps) {\n const id = useId();\n const input = useRef<HTMLInputElement>(null);\n const trigger = useRef<HTMLButtonElement>(null);\n const removeButtons = useRef(new Map<string, HTMLButtonElement>());\n const pending = useRef<{ item: FileInputItem; index: number; button: HTMLButtonElement } | null>(\n null,\n );\n const [announcement, setAnnouncement] = useState(\"\");\n useImperativeHandle(inputRef, () => input.current as HTMLInputElement);\n useImperativeHandle(triggerRef, () => trigger.current as HTMLButtonElement);\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const blocked = disabled || readOnly;\n const described =\n [description ? `${id}-description` : null, error ? `${id}-error` : null, callerDescription]\n .filter(Boolean)\n .join(\" \") || undefined;\n useLayoutEffect(() => {\n const request = pending.current;\n if (!request || items.some((item) => item.id === request.item.id)) return;\n pending.current = null;\n const active = request.button.ownerDocument.activeElement;\n if (!blocked && (active === request.button.ownerDocument.body || active === request.button)) {\n const next = items[Math.min(request.index, items.length - 1)];\n (next ? removeButtons.current.get(next.id) : trigger.current)?.focus();\n }\n setAnnouncement(removedMessage(request.item));\n }, [items, blocked, removedMessage]);\n return (\n <div\n {...props}\n {...kb(\"fileinput\", { disabled, readonly: readOnly, invalid }, className)}\n onBlurCapture={(event) => {\n if (\n pending.current?.button.isSameNode(event.target) &&\n event.relatedTarget !== pending.current.button\n )\n pending.current = null;\n onBlurCapture?.(event);\n }}\n >\n <span\n id={`${id}-label`}\n className={clsx(\"kb-fileinput-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </span>\n <input\n ref={input}\n type=\"file\"\n hidden\n className={clsx(\"kb-fileinput-native\", classNames?.native)}\n accept={accept}\n multiple={multiple}\n disabled={blocked}\n onChange={(event) => {\n const control = event.currentTarget;\n try {\n const files = Array.from(control.files ?? []);\n if (!blocked && files.length) {\n onFiles(files);\n setAnnouncement(selectionMessage(files.length));\n }\n } finally {\n control.value = \"\";\n }\n }}\n />\n <Button\n ref={trigger}\n type=\"button\"\n size=\"lg\"\n variant=\"secondary\"\n disabled={blocked}\n aria-labelledby={`${id}-label ${id}-action`}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n className={clsx(\"kb-fileinput-trigger\", classNames?.trigger, triggerClassName)}\n onClick={() => {\n if (!blocked) input.current?.click();\n }}\n >\n <span id={`${id}-action`}>{chooseLabel}</span>\n </Button>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-fileinput-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p\n id={`${id}-error`}\n className={clsx(\"kb-fileinput-error\", classNames?.error)}\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {items.length ? (\n <ul\n className={clsx(\"kb-fileinput-list\", classNames?.list, listClassName)}\n aria-labelledby={`${id}-label`}\n >\n {items.map((item, index) => (\n <li\n className={clsx(\"kb-fileinput-item\", classNames?.item, itemClassName)}\n key={item.id}\n >\n <div className={clsx(\"kb-fileinput-content\", classNames?.content)}>\n {renderItem ? (\n renderItem(item)\n ) : (\n <>\n <span className={clsx(\"kb-fileinput-name\", classNames?.name)}>{item.name}</span>\n {item.description && (\n <span className={clsx(\"kb-fileinput-metadata\", classNames?.metadata)}>\n {item.description}\n </span>\n )}\n </>\n )}\n </div>\n <Button\n ref={(node) => {\n if (node) removeButtons.current.set(item.id, node);\n else removeButtons.current.delete(item.id);\n }}\n type=\"button\"\n size=\"lg\"\n variant=\"ghost\"\n disabled={blocked}\n className={clsx(\"kb-fileinput-remove\", classNames?.remove)}\n aria-label={removeLabel(item)}\n onClick={(event) => {\n if (blocked) return;\n if (event.currentTarget === event.currentTarget.ownerDocument.activeElement)\n pending.current = { item, index, button: event.currentTarget };\n onRemove(item.id);\n }}\n >\n <span aria-hidden=\"true\">×</span>\n </Button>\n </li>\n ))}\n </ul>\n ) : (\n <p className={clsx(\"kb-fileinput-empty\", classNames?.empty)}>{emptyMessage}</p>\n )}\n <p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" className=\"kb-sr-only\">\n {announcement}\n </p>\n </div>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type FormActionsAlign = \"end\" | \"start\" | \"between\";\n\nexport interface FormActionsProps extends ComponentProps<\"div\"> {\n /** Horizontal alignment for form action buttons. */\n align?: FormActionsAlign | undefined;\n /** Add a top border and spacing above the action row. */\n divider?: boolean | undefined;\n}\n\n/** Wrapping action footer for form submit, reset and secondary buttons. */\nexport const FormActions = ({\n ref,\n align = \"end\",\n divider = false,\n className,\n children,\n ...props\n}: FormActionsProps) => (\n <div {...props} ref={ref} {...kb(\"formactions\", { align, divider }, className)}>\n {children}\n </div>\n);\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { FormActions, type FormActionsAlign } from \"../FormActions/FormActions\";\n\nexport type FormWidth = \"sm\" | \"md\" | \"full\";\nexport type FormPart = \"header\" | \"body\" | \"actions\";\n\nexport interface FormProps extends ComponentProps<\"form\"> {\n /** Title and intro above the fields, such as a heading or PageHeader. */\n header?: ReactNode | undefined;\n /** The task's submit button first, then secondary actions. */\n actions?: ReactNode | undefined;\n /** Alignment of the actions row above the compact width. */\n actionsAlign?: FormActionsAlign | undefined;\n /** Maximum inline size: sm 32rem, md 40rem or full. */\n width?: FormWidth | undefined;\n /** Classes for inner regions, keyed by region. */\n classNames?: ClassNames<FormPart> | undefined;\n}\n\n/** Layout intent for one task: header, grouped fields, then its actions. */\nexport const Form = ({\n ref,\n header,\n actions,\n actionsAlign = \"end\",\n width = \"md\",\n className,\n classNames,\n children,\n ...props\n}: FormProps) => (\n <form {...props} ref={ref} {...kb(\"form\", { width }, className)}>\n {header ? <div className={clsx(\"kb-form-header\", classNames?.header)}>{header}</div> : null}\n <div className={clsx(\"kb-form-body\", classNames?.body)}>{children}</div>\n {actions ? (\n <FormActions\n align={actionsAlign}\n divider\n className={clsx(\"kb-form-actions\", classNames?.actions)}\n >\n {actions}\n </FormActions>\n ) : null}\n </form>\n);\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\nexport type HeadingSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"display\";\nexport type HeadingProps = ComponentProps<\"h2\"> & {\n /** Native heading rank; follow document hierarchy. */\n level?: HeadingLevel;\n /** Visual size, independent of rank; defaults from level. */\n size?: HeadingSize;\n};\n\nconst sizes: Record<HeadingLevel, HeadingSize> = {\n 1: \"xl\",\n 2: \"lg\",\n 3: \"md\",\n 4: \"sm\",\n 5: \"sm\",\n 6: \"sm\",\n};\n\nexport function Heading({ level = 2, size = sizes[level], className, ...props }: HeadingProps) {\n return createElement(`h${level}`, { ...props, ...kb(\"heading\", { size }, className) });\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nimport { FormActions, type FormActionsAlign } from \"../FormActions/FormActions\";\nimport { Heading } from \"../Heading/Heading\";\n\nexport type FormSectionLayout = \"stack\" | \"split\";\nexport type FormSectionHeadingLevel = 2 | 3 | 4 | 5 | 6;\nexport type FormSectionPart =\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"fields\"\n | \"error\"\n | \"actions\";\n\nexport interface FormSectionProps extends Omit<ComponentProps<\"fieldset\">, \"title\"> {\n /** Section heading; also names the group. */\n title: ReactNode;\n /** Heading rank; follow the page hierarchy. */\n headingLevel?: FormSectionHeadingLevel | undefined;\n /** Supporting context for the grouped fields. */\n description?: ReactNode | undefined;\n /** Section-level validation error. */\n error?: ReactNode | undefined;\n /** Buttons for this section, after the fields in Tab order. */\n actions?: ReactNode | undefined;\n /** Alignment of the actions row. */\n actionsAlign?: FormActionsAlign | undefined;\n /** Heading beside or above fields; unset follows the enclosing intent. */\n layout?: FormSectionLayout | undefined;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<FormSectionPart> | undefined;\n}\n\n/** Named group of related fields with its heading, error and actions. */\nexport const FormSection = ({\n ref,\n title,\n headingLevel = 2,\n description,\n error,\n actions,\n actionsAlign = \"end\",\n layout,\n disabled,\n className,\n classNames,\n children,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: FormSectionProps) => {\n const reactId = useId();\n const baseId = props.id ?? `kb-formsection-${reactId}`;\n const hasError = Boolean(error);\n const { invalid, ariaInvalid } = resolveInvalid(hasError, callerAriaInvalid);\n const titleId = `${baseId}-title`;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const errorId = hasError ? `${baseId}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n\n return (\n // Heading names the group: a rendered legend cannot join the split layout.\n <fieldset\n aria-labelledby={props[\"aria-label\"] ? undefined : titleId}\n {...props}\n ref={ref}\n disabled={disabled}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n {...kb(\"formsection\", { layout, disabled: Boolean(disabled), invalid }, className)}\n >\n <div className={clsx(\"kb-formsection-header\", classNames?.header)}>\n <Heading\n level={headingLevel}\n size=\"md\"\n id={titleId}\n className={clsx(\"kb-formsection-title\", classNames?.title)}\n >\n {title}\n </Heading>\n {description ? (\n <p\n id={descriptionId}\n className={clsx(\"kb-formsection-description\", classNames?.description)}\n >\n {description}\n </p>\n ) : null}\n </div>\n <div className={clsx(\"kb-formsection-body\", classNames?.body)}>\n <div className={clsx(\"kb-formsection-fields\", classNames?.fields)}>{children}</div>\n {hasError ? (\n <div id={errorId} className={clsx(\"kb-formsection-error\", classNames?.error)}>\n {error}\n </div>\n ) : null}\n {actions ? (\n <FormActions\n align={actionsAlign}\n className={clsx(\"kb-formsection-actions\", classNames?.actions)}\n >\n {actions}\n </FormActions>\n ) : null}\n </div>\n </fieldset>\n );\n};\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutGap } from \"../../utils/layout\";\n\nexport type GridElement = \"div\" | \"ul\" | \"ol\";\nexport type GridLayout = \"auto\" | \"stack\";\nexport type GridColumns = \"auto\" | 1 | 2 | 3 | 4;\nexport type GridMinItemWidth = \"sm\" | \"md\" | \"lg\";\nexport type GridProps<T extends GridElement = \"div\"> = ComponentProps<T> & {\n /** Native container; list children must be list items. */\n as?: T | undefined;\n /** Responsive equal columns or a single vertical track. */\n layout?: GridLayout | undefined;\n /** Explicit column count or automatic wrapping columns. */\n columns?: GridColumns | undefined;\n /** Minimum column width before automatic columns wrap. */\n minItemWidth?: GridMinItemWidth | undefined;\n /** Space between columns and stacked rows. */\n gap?: LayoutGap | undefined;\n /** Cross-axis alignment within each grid row. */\n align?: LayoutAlign | undefined;\n};\n\nexport function Grid<T extends GridElement = \"div\">({\n as,\n layout = \"auto\",\n columns,\n minItemWidth,\n gap,\n align,\n className,\n ...props\n}: GridProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n ...kb(\n \"grid\",\n {\n layout,\n columns: columns === undefined ? undefined : String(columns),\n \"min-item-width\": minItemWidth,\n gap,\n align,\n },\n className,\n ),\n });\n}\n","import { clsx } from \"clsx\";\nimport { Children, type ComponentProps, Fragment, isValidElement, type ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Grid } from \"../Grid/Grid\";\n\nexport type GalleryPart = \"header\" | \"filters\" | \"items\" | \"empty\";\n\nexport interface GalleryProps extends ComponentProps<\"div\"> {\n /** Page title, intro and page actions, usually a PageHeader. */\n header?: ReactNode | undefined;\n /** Search, filter and sort controls; they share a row and wrap. */\n filters?: ReactNode | undefined;\n /** Accessible name for the item list. */\n itemsLabel?: string | undefined;\n /** Shown in place of the list when there are no items. */\n empty?: ReactNode | undefined;\n /** Classes for inner regions, keyed by region. */\n classNames?: ClassNames<GalleryPart> | undefined;\n}\n\nexport interface GalleryItemProps extends ComponentProps<\"li\"> {\n /** Spans two columns once the list has two; keep featured items first. */\n featured?: boolean | undefined;\n}\n\n// Looks through fragments; a component that renders null still counts as an item.\nfunction hasItems(children: ReactNode): boolean {\n return Children.toArray(children).some((child) =>\n isValidElement<{ children?: ReactNode }>(child) && child.type === Fragment\n ? hasItems(child.props.children)\n : true,\n );\n}\n\nfunction GalleryRoot({\n ref,\n header,\n filters,\n itemsLabel,\n empty,\n className,\n classNames,\n children,\n ...props\n}: GalleryProps) {\n const showEmpty = empty != null && !hasItems(children);\n return (\n <div {...props} ref={ref} {...kb(\"gallery\", {}, className)}>\n {header != null ? (\n <div className={clsx(\"kb-gallery-header\", classNames?.header)}>{header}</div>\n ) : null}\n {filters != null ? (\n <div className={clsx(\"kb-gallery-filters\", classNames?.filters)}>{filters}</div>\n ) : null}\n {showEmpty ? (\n <div className={clsx(\"kb-gallery-empty\", classNames?.empty)}>{empty}</div>\n ) : (\n <Grid\n as=\"ul\"\n gap=\"lg\"\n aria-label={itemsLabel}\n className={clsx(\"kb-gallery-items\", classNames?.items)}\n >\n {children}\n </Grid>\n )}\n </div>\n );\n}\n\nfunction GalleryItem({ featured, className, ...props }: GalleryItemProps) {\n return <li {...props} {...kb(\"gallery-item\", { featured }, className)} />;\n}\n\n/** Layout intent for a grid of image-led items, such as a product catalog. */\nexport const Gallery = Object.assign(GalleryRoot, { Item: GalleryItem });\n","import { createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutElementProps, LayoutGap } from \"../../utils/layout\";\n\nexport type InlineElement = \"div\" | \"ul\" | \"ol\" | \"nav\";\nexport type InlineJustify = \"start\" | \"center\" | \"end\" | \"between\";\nexport type InlineProps<T extends InlineElement = \"div\"> = LayoutElementProps<T> & {\n /** Space between items and wrapped rows. */\n gap?: LayoutGap;\n /** Cross-axis alignment within each row. */\n align?: LayoutAlign;\n /** Main-axis distribution within each row. */\n justify?: InlineJustify;\n};\n\nexport function Inline<T extends InlineElement = \"div\">({\n as,\n gap = \"md\",\n align = \"center\",\n justify = \"start\",\n className,\n ...props\n}: InlineProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n ...kb(\"inline\", { gap, align, justify }, className),\n });\n}\n","import { Menu as Base } from \"@base-ui/react/menu\";\nimport { Separator } from \"@base-ui/react/separator\";\nimport { clsx } from \"clsx\";\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\nconst PointerFocus = createContext(false);\n\nexport type MenuProps = Base.Root.Props;\nexport type MenuTriggerProps = Base.Trigger.Props;\nexport type MenuItemProps = Omit<Base.Item.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type MenuSeparatorProps = Omit<Separator.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type MenuContentProps = Omit<Base.Popup.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Portal target; pass the consumer theme host for nested themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Side of the trigger the popup prefers. */\n side?: Base.Positioner.Props[\"side\"];\n /** Alignment along that side. */\n align?: Base.Positioner.Props[\"align\"];\n};\n\nfunction MenuRoot({ onOpenChange, ...props }: MenuProps) {\n const [pointerFocus, setPointerFocus] = useState(false);\n useEffect(() => {\n if (!pointerFocus) return;\n const keyboard = () => setPointerFocus(false);\n document.addEventListener(\"keydown\", keyboard, { capture: true, once: true });\n return () => document.removeEventListener(\"keydown\", keyboard, true);\n }, [pointerFocus]);\n return (\n <PointerFocus.Provider value={pointerFocus}>\n <Base.Root\n {...props}\n onOpenChange={(open, details) => {\n const event = details.event;\n setPointerFocus(\n /^(pointer|mouse|touch|click)/.test(event.type) &&\n !(event.type === \"click\" && \"detail\" in event && event.detail === 0),\n );\n onOpenChange?.(open, details);\n }}\n />\n </PointerFocus.Provider>\n );\n}\n\nfunction MenuTrigger(props: MenuTriggerProps) {\n const pointerFocus = useContext(PointerFocus);\n return (\n <Base.Trigger\n {...props}\n data-kb-menu-trigger=\"\"\n data-pointer-focus={pointerFocus || undefined}\n />\n );\n}\n\nfunction MenuContent({\n side = \"bottom\",\n align = \"start\",\n className,\n container,\n ...props\n}: MenuContentProps) {\n return (\n <Base.Portal container={container}>\n <Base.Positioner side={side} align={align} sideOffset={6}>\n <Base.Popup {...props} className={clsx(\"kb-menu\", className)} />\n </Base.Positioner>\n </Base.Portal>\n );\n}\n\nfunction MenuItem({ className, ...props }: MenuItemProps) {\n return <Base.Item {...props} className={clsx(\"kb-menu-item\", className)} />;\n}\n\nfunction MenuSeparator({ className, ...props }: MenuSeparatorProps) {\n return <Separator {...props} className={clsx(\"kb-menu-separator\", className)} />;\n}\n\nexport const Menu = Object.assign(MenuRoot, {\n Trigger: MenuTrigger,\n Content: MenuContent,\n Item: MenuItem,\n Separator: MenuSeparator,\n});\n","import { NumberField as Base } from \"@base-ui/react/number-field\";\nimport { clsx } from \"clsx\";\nimport { type ComponentProps, type Ref, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type NumberFieldSize = \"sm\" | \"md\" | \"lg\";\nexport type NumberFieldProps = Omit<\n ComponentProps<\"div\">,\n \"onChange\" | \"children\" | \"defaultValue\"\n> & {\n /** Accessible label for the numeric input. */\n label: string;\n /** Controlled number; null represents an empty field. */\n value: number | null;\n /** Receives numeric edits and null on clearing. */\n onValueChange: (value: number | null) => void;\n /** Lower stepping bound; typed drafts remain visible outside it. */\n min?: number;\n /** Upper stepping bound; typed drafts remain visible outside it. */\n max?: number;\n /** Step for buttons and arrows; defaults to one. */\n step?: number;\n /** Locale for numeric editing and display. */\n locale?: Intl.LocalesArgument;\n /** Native form field name. */\n name?: string;\n /** External native form identifier. */\n form?: string;\n /** Require a value for native form validation. */\n required?: boolean;\n /** Disable editing, stepping and form submission. */\n disabled?: boolean;\n /** Preserve value while blocking edits and stepping. */\n readOnly?: boolean;\n /** Keep label accessible while hiding it visually. */\n visuallyHidden?: boolean;\n /** Help associated with the visible input. */\n description?: string;\n /** Invalid message; callers own business validation. */\n error?: string;\n /** Control height; defaults to md. */\n size?: NumberFieldSize;\n /** Class on the visible numeric input. */\n inputClassName?: string;\n /** Class on the group containing the input and steppers. */\n groupClassName?: string;\n /** Ref to the visible input; root ref targets the outer div. */\n inputRef?: Ref<HTMLInputElement>;\n /** Native input extensions; value and behavior remain controlled. */\n inputProps?: Omit<\n Base.Input.Props,\n | \"className\"\n | \"render\"\n | \"value\"\n | \"defaultValue\"\n | \"onChange\"\n | \"id\"\n | \"ref\"\n | \"type\"\n | \"disabled\"\n | \"readOnly\"\n | \"required\"\n | \"name\"\n >;\n /** Localized decrement action; defaults to Decrease plus label. */\n decrementLabel?: string;\n /** Localized increment action; defaults to Increase plus label. */\n incrementLabel?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\n \"label\" | \"group\" | \"input\" | \"editor\" | \"decrement\" | \"increment\" | \"description\" | \"error\"\n >;\n};\n\nexport function NumberField({\n classNames,\n label,\n value,\n onValueChange,\n min,\n max,\n step = 1,\n locale,\n name,\n form,\n required,\n disabled = false,\n readOnly = false,\n visuallyHidden,\n description,\n error,\n size = \"md\",\n inputClassName,\n groupClassName,\n inputRef,\n inputProps,\n decrementLabel = `Decrease ${label}`,\n incrementLabel = `Increase ${label}`,\n className,\n \"aria-describedby\": callerDescription,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: NumberFieldProps) {\n const id = useId();\n const { invalid, ariaInvalid } = resolveInvalid(\n Boolean(error),\n inputProps?.[\"aria-invalid\"] ?? callerAriaInvalid,\n );\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n callerDescription,\n inputProps?.[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <div\n {...props}\n {...kb(\"numberfield\", { size, disabled, readonly: readOnly, invalid }, className)}\n >\n <label\n htmlFor={id}\n className={clsx(\"kb-numberfield-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n <Base.Root\n id={id}\n value={value}\n onValueChange={(next) => {\n if (!disabled && !readOnly) onValueChange(next);\n }}\n min={min}\n max={max}\n step={step}\n smallStep={step}\n largeStep={step * 10}\n locale={locale}\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n snapOnStep\n allowOutOfRange\n allowWheelScrub={false}\n className={clsx(\"kb-numberfield-editor\", classNames?.editor)}\n >\n <Base.Group className={clsx(\"kb-numberfield-group\", classNames?.group, groupClassName)}>\n <Base.Decrement\n aria-label={decrementLabel}\n className={clsx(\"kb-numberfield-decrement\", classNames?.decrement)}\n >\n −\n </Base.Decrement>\n <Base.Input\n {...inputProps}\n ref={inputRef}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n className={clsx(\"kb-numberfield-input\", classNames?.input, inputClassName)}\n />\n <Base.Increment\n aria-label={incrementLabel}\n className={clsx(\"kb-numberfield-increment\", classNames?.increment)}\n >\n +\n </Base.Increment>\n </Base.Group>\n </Base.Root>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-numberfield-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-numberfield-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type PageHeaderSize = \"sm\" | \"md\" | \"lg\";\nexport type PageHeaderHeadingLevel = 1 | 2 | 3;\n\nexport type PageHeaderProps = Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Page title; renders as the screen's main heading. */\n title: ReactNode;\n /** One or two sentences of context below the title. */\n description?: ReactNode | undefined;\n /** Short section or object-type label above the title. */\n eyebrow?: ReactNode | undefined;\n /** Back link or breadcrumb trail above the heading. */\n navigation?: ReactNode | undefined;\n /** Status badges or metadata beside the title, outside its accessible name. */\n meta?: ReactNode | undefined;\n /** Page-level actions; end-aligned, wrapping below the heading when narrow. */\n actions?: ReactNode | undefined;\n /** Document outline rank for the title (`1`–`3`); keep `1` for a screen's own header. */\n headingLevel?: PageHeaderHeadingLevel | undefined;\n /** Title scale: `sm` for dense app shells, `lg` for landing screens. */\n size?: PageHeaderSize | undefined;\n /** Draws a rule below the header to separate it from page content. */\n divider?: boolean | undefined;\n classNames?:\n | ClassNames<\n | \"navigation\"\n | \"main\"\n | \"heading\"\n | \"eyebrow\"\n | \"headline\"\n | \"title\"\n | \"meta\"\n | \"description\"\n | \"actions\"\n | \"body\"\n >\n | undefined;\n};\n\nconst headingTags = {\n 1: \"h1\",\n 2: \"h2\",\n 3: \"h3\",\n} as const;\n\n/** Opening region of a screen: title, context, status and page-level actions. */\nexport function PageHeader({\n title,\n description,\n eyebrow,\n navigation,\n meta,\n actions,\n headingLevel = 1,\n size = \"md\",\n divider = false,\n className,\n classNames,\n children,\n ...rest\n}: PageHeaderProps) {\n const HeadingTag = headingTags[headingLevel];\n\n return (\n <div {...rest} {...kb(\"pageheader\", { size, divider }, className)}>\n {navigation != null ? (\n <div className={clsx(\"kb-pageheader-navigation\", classNames?.navigation)}>{navigation}</div>\n ) : null}\n <div className={clsx(\"kb-pageheader-main\", classNames?.main)}>\n <div className={clsx(\"kb-pageheader-heading\", classNames?.heading)}>\n {eyebrow != null ? (\n <p className={clsx(\"kb-pageheader-eyebrow\", classNames?.eyebrow)}>{eyebrow}</p>\n ) : null}\n <div className={clsx(\"kb-pageheader-headline\", classNames?.headline)}>\n <HeadingTag className={clsx(\"kb-pageheader-title\", classNames?.title)}>\n {title}\n </HeadingTag>\n {meta != null ? (\n <div className={clsx(\"kb-pageheader-meta\", classNames?.meta)}>{meta}</div>\n ) : null}\n </div>\n {description != null ? (\n <p className={clsx(\"kb-pageheader-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n </div>\n {actions != null ? (\n <div className={clsx(\"kb-pageheader-actions\", classNames?.actions)}>{actions}</div>\n ) : null}\n </div>\n {children != null ? (\n <div className={clsx(\"kb-pageheader-body\", classNames?.body)}>{children}</div>\n ) : null}\n </div>\n );\n}\n","import { Collapsible } from \"@base-ui/react/collapsible\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n createContext,\n type KeyboardEvent,\n type PointerEvent,\n type Ref,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type PanelTone = \"quiet\" | \"default\" | \"sunken\" | \"active\" | \"critical\";\nexport type PanelRail = \"none\" | \"accent\" | \"status\";\nexport type PanelDensity = \"compact\" | \"standard\";\nexport type PanelGroupDirection = \"row\" | \"column\";\n\n/** Name the region with aria-labelledby pointing at the heading inside Panel.Header. */\nexport type PanelProps = ComponentProps<\"section\"> & {\n /** Plane weight: quiet has no seam, sunken recesses, active lifts, critical warns. */\n tone?: PanelTone;\n /** Inline-start rail: accent is always accent; status follows the tone. */\n rail?: PanelRail;\n /** Padding scale. */\n density?: PanelDensity;\n /** Solid fill with no theme backdrop filter; for content that redraws often. */\n opaque?: boolean;\n /** Makes Panel.Body collapse and expand from Panel.Toggle. */\n collapsible?: boolean;\n /** Controlled open state; collapsible only. */\n open?: boolean;\n /** Initial open state; collapsible only. */\n defaultOpen?: boolean;\n /** Called when the toggle changes the open state; collapsible only. */\n onOpenChange?: (open: boolean) => void;\n};\nexport type PanelHeaderProps = ComponentProps<\"header\">;\nexport type PanelToolbarProps = ComponentProps<\"div\">;\nexport type PanelBodyProps = ComponentProps<\"div\">;\nexport type PanelFooterProps = ComponentProps<\"footer\">;\nexport type PanelWellProps = ComponentProps<\"div\">;\nexport type PanelToggleProps = Omit<Collapsible.Trigger.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type PanelGroupProps = ComponentProps<\"div\"> & {\n /** Flow of the panels inside the group. */\n direction?: PanelGroupDirection;\n};\n/** Sizes the panel right before it; the panel after it takes the rest. Needs a name. */\nexport type PanelHandleProps = Omit<ComponentProps<\"div\">, \"children\" | \"role\"> & {\n /** Controlled size of the panel before the handle, in percent of the group. */\n size?: number;\n /** Initial size when uncontrolled, in percent. */\n defaultSize?: number;\n /** Smallest size in percent; Enter collapses to it. */\n min?: number;\n /** Largest size in percent. */\n max?: number;\n /** Arrow-key change in percent. */\n step?: number;\n /** Called with the next size after a key press or drag. */\n onSizeChange?: (size: number) => void;\n} & ({ \"aria-label\": string } | { \"aria-labelledby\": string });\n\nconst NestedContext = createContext(false);\nconst CollapsibleContext = createContext(false);\nconst DirectionContext = createContext<PanelGroupDirection>(\"column\");\n\nconst paneBefore = (handle: HTMLElement | null) =>\n handle?.previousElementSibling as HTMLElement | null | undefined;\n\nfunction PanelRoot({\n tone = \"default\",\n rail = \"none\",\n density = \"standard\",\n opaque = false,\n collapsible = false,\n open,\n defaultOpen,\n onOpenChange,\n className,\n children,\n ref,\n ...props\n}: PanelProps) {\n const nested = useContext(NestedContext);\n const attrs = kb(\"panel\", { tone, rail, density, nested, opaque, collapsible }, className);\n const content = (\n <NestedContext value={true}>\n <CollapsibleContext value={collapsible}>\n <span className=\"kb-panel-glow\" aria-hidden=\"true\" />\n <span className=\"kb-panel-plate\" aria-hidden=\"true\">\n {rail !== \"none\" ? <span className=\"kb-panel-rail\" /> : null}\n </span>\n {children}\n </CollapsibleContext>\n </NestedContext>\n );\n if (!collapsible) {\n return (\n <section {...props} ref={ref} {...attrs}>\n {content}\n </section>\n );\n }\n return (\n <Collapsible.Root\n {...props}\n // Base UI types the root as a div; render swaps in the section.\n ref={ref as Ref<HTMLDivElement>}\n {...(open !== undefined ? { open } : {})}\n {...(defaultOpen !== undefined ? { defaultOpen } : {})}\n {...(onOpenChange ? { onOpenChange: (next: boolean) => onOpenChange(next) } : {})}\n render={<section />}\n {...attrs}\n >\n {content}\n </Collapsible.Root>\n );\n}\n\nfunction PanelHeader({ className, ...props }: PanelHeaderProps) {\n return <header {...props} className={clsx(\"kb-panel-header\", className)} />;\n}\n\nfunction PanelToolbar({ className, ...props }: PanelToolbarProps) {\n return <div {...props} className={clsx(\"kb-panel-toolbar\", className)} />;\n}\n\nfunction PanelBody({ className, ...props }: PanelBodyProps) {\n const collapsible = useContext(CollapsibleContext);\n const merged = clsx(\"kb-panel-body\", className);\n if (collapsible) return <Collapsible.Panel {...props} className={merged} />;\n return <div {...props} className={merged} />;\n}\n\nfunction PanelFooter({ className, ...props }: PanelFooterProps) {\n return <footer {...props} className={clsx(\"kb-panel-footer\", className)} />;\n}\n\nfunction PanelWell({ className, ...props }: PanelWellProps) {\n return <div {...props} className={clsx(\"kb-panel-well\", className)} />;\n}\n\nfunction PanelToggle({ className, ...props }: PanelToggleProps) {\n return <Collapsible.Trigger {...props} className={clsx(\"kb-panel-toggle\", className)} />;\n}\n\nfunction PanelGroup({ direction = \"column\", className, ...props }: PanelGroupProps) {\n return (\n <DirectionContext value={direction}>\n <div {...props} {...kb(\"panel-group\", { direction }, className)} />\n </DirectionContext>\n );\n}\n\nfunction PanelHandle({\n size,\n defaultSize = 50,\n min = 10,\n max = 90,\n step = 5,\n onSizeChange,\n className,\n ref,\n onKeyDown,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n ...props\n}: PanelHandleProps) {\n const row = useContext(DirectionContext) === \"row\";\n const clamp = (value: number) => Math.min(max, Math.max(min, value));\n const [inner, setInner] = useState(defaultSize);\n const current = clamp(size ?? inner);\n const [controls, setControls] = useState<string>();\n const [dragging, setDragging] = useState(false);\n const restore = useRef(current);\n const node = useRef<HTMLDivElement | null>(null);\n const fallbackId = useId();\n\n useLayoutEffect(() => {\n const target = paneBefore(node.current);\n if (!target) return;\n target.id ||= fallbackId;\n setControls(target.id);\n }, [fallbackId]);\n\n useLayoutEffect(() => {\n paneBefore(node.current)?.style.setProperty(\"--kb-panel-size\", `${current}%`);\n }, [current]);\n\n const commit = (value: number) => {\n const next = clamp(value);\n if (next === current) return;\n if (size === undefined) setInner(next);\n onSizeChange?.(next);\n };\n\n const keys: Record<string, () => number> = {\n [row ? \"ArrowLeft\" : \"ArrowUp\"]: () => current - step,\n [row ? \"ArrowRight\" : \"ArrowDown\"]: () => current + step,\n Home: () => min,\n End: () => max,\n Enter: () => {\n if (current > min) {\n restore.current = current;\n return min;\n }\n return restore.current;\n },\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const next = keys[event.key];\n if (event.defaultPrevented || !next) return;\n event.preventDefault();\n commit(next());\n };\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0) return;\n event.preventDefault();\n event.currentTarget.setPointerCapture?.(event.pointerId);\n setDragging(true);\n };\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n onPointerMove?.(event);\n const group = node.current?.parentElement?.getBoundingClientRect();\n const start = paneBefore(node.current)?.getBoundingClientRect();\n if (!dragging || !group || !start) return;\n const offset = row ? event.clientX - start.left : event.clientY - start.top;\n const length = row ? group.width : group.height;\n // One decimal keeps drags smooth without leaking float noise into aria-valuenow.\n if (length > 0) commit(Math.round((offset / length) * 1000) / 10);\n };\n\n const endDrag = (event: PointerEvent<HTMLDivElement>) => {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n setDragging(false);\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a focusable splitter with a value cannot be an hr.\n <div\n {...props}\n ref={(element) => {\n node.current = element;\n if (typeof ref === \"function\") return ref(element);\n if (ref) ref.current = element;\n }}\n role=\"separator\"\n tabIndex={0}\n aria-orientation={row ? \"vertical\" : \"horizontal\"}\n aria-valuenow={current}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-controls={controls}\n onKeyDown={handleKeyDown}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={(event) => {\n onPointerUp?.(event);\n endDrag(event);\n }}\n onPointerCancel={(event) => {\n onPointerCancel?.(event);\n endDrag(event);\n }}\n {...kb(\"panel-handle\", { orientation: row ? \"vertical\" : \"horizontal\", dragging }, className)}\n />\n );\n}\n\nexport const Panel = Object.assign(PanelRoot, {\n Header: PanelHeader,\n Toolbar: PanelToolbar,\n Body: PanelBody,\n Footer: PanelFooter,\n Well: PanelWell,\n Toggle: PanelToggle,\n Group: PanelGroup,\n Handle: PanelHandle,\n});\n","import { Popover as Base } from \"@base-ui/react/popover\";\nimport { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type PopoverProps = Base.Root.Props;\nexport type PopoverTriggerProps = Base.Trigger.Props;\nexport type PopoverCloseProps = Base.Close.Props;\nexport type PopoverSectionProps = ComponentProps<\"div\">;\nexport type PopoverTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Plain class string on title. */\n className?: string | undefined;\n};\nexport type PopoverDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Plain class string on description. */\n className?: string | undefined;\n};\nexport type PopoverContentProps = Omit<Base.Popup.Props, \"className\" | \"title\"> & {\n /** Accessible name; omit when composing Popover.Title. */\n title?: ReactNode;\n /** Accessible description; omit when composing Popover.Description. */\n description?: ReactNode;\n /** Plain class string on popup. */\n className?: string | undefined;\n /** Portal target; pass nested theme host when needed. */\n container?: Base.Portal.Props[\"container\"];\n /** Preferred side; collision handling may flip it. */\n side?: Base.Positioner.Props[\"side\"];\n /** Alignment relative to trigger. */\n align?: Base.Positioner.Props[\"align\"];\n /** Gap between trigger and popup, in CSS pixels. */\n sideOffset?: Base.Positioner.Props[\"sideOffset\"];\n /** Advanced positioning, including collision boundary, padding and anchor. */\n positionerProps?:\n | Omit<Base.Positioner.Props, \"children\" | \"className\" | \"side\" | \"align\" | \"sideOffset\">\n | undefined;\n /** Classes for inner positioner. */\n classNames?: ClassNames<\"positioner\"> | undefined;\n};\n\nfunction PopoverRoot(props: PopoverProps) {\n return <Base.Root {...props} />;\n}\nfunction PopoverTrigger(props: PopoverTriggerProps) {\n return <Base.Trigger {...props} />;\n}\nfunction PopoverClose(props: PopoverCloseProps) {\n return <Base.Close {...props} />;\n}\nfunction PopoverTitle({ className, ...props }: PopoverTitleProps) {\n return <Base.Title {...props} {...kb(\"popover-title\", {}, className)} />;\n}\nfunction PopoverDescription({ className, ...props }: PopoverDescriptionProps) {\n return <Base.Description {...props} {...kb(\"popover-description\", {}, className)} />;\n}\nfunction PopoverHeader({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-header\", {}, className)} />;\n}\nfunction PopoverBody({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-body\", {}, className)} />;\n}\nfunction PopoverFooter({ className, ...props }: PopoverSectionProps) {\n return <div {...props} {...kb(\"popover-footer\", {}, className)} />;\n}\nfunction PopoverContent({\n title,\n description,\n container,\n side = \"bottom\",\n align = \"start\",\n sideOffset = 6,\n positionerProps,\n classNames,\n className,\n children,\n ...props\n}: PopoverContentProps) {\n const hasTitle = title != null && title !== \"\";\n const hasDescription = description != null && description !== \"\";\n return (\n <Base.Portal container={container}>\n <Base.Positioner\n {...positionerProps}\n side={side}\n align={align}\n sideOffset={sideOffset}\n className={clsx(\"kb-popover-positioner\", classNames?.positioner)}\n >\n <Base.Popup {...props} {...kb(\"popover\", {}, className)}>\n {hasTitle || hasDescription ? (\n <PopoverHeader>\n {hasTitle ? <PopoverTitle>{title}</PopoverTitle> : null}\n {hasDescription ? <PopoverDescription>{description}</PopoverDescription> : null}\n </PopoverHeader>\n ) : null}\n {children}\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n );\n}\n\nexport const Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Title: PopoverTitle,\n Description: PopoverDescription,\n Close: PopoverClose,\n Header: PopoverHeader,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n","import { Progress as Base } from \"@base-ui/react/progress\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\n/** Determinate progress with a visible label; valueText replaces the percent, e.g. \"3 of 5\". */\nexport type ProgressProps = Omit<Base.Root.Props, \"className\" | \"children\" | \"value\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Visible name of the progressbar. */\n label: ReactNode;\n /** Current value, from 0 to max. */\n value: number;\n /** Shown beside the label and announced instead of the percent. */\n valueText?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"head\" | \"label\" | \"value\" | \"track\" | \"indicator\">;\n};\n\nexport function Progress({\n classNames,\n label,\n value,\n valueText,\n className,\n ...props\n}: ProgressProps) {\n return (\n <Base.Root\n {...props}\n value={value}\n {...(valueText ? { getAriaValueText: () => valueText } : {})}\n {...kb(\"progress\", {}, className)}\n >\n <div className={clsx(\"kb-progress-head\", classNames?.head)}>\n <Base.Label className={clsx(\"kb-progress-label\", classNames?.label)}>{label}</Base.Label>\n <Base.Value className={clsx(\"kb-progress-value\", classNames?.value)}>\n {(formatted) => valueText ?? formatted}\n </Base.Value>\n </div>\n <Base.Track className={clsx(\"kb-progress-track\", classNames?.track)}>\n <Base.Indicator className={clsx(\"kb-progress-indicator\", classNames?.indicator)} />\n </Base.Track>\n </Base.Root>\n );\n}\n","import { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup as BaseGroup } from \"@base-ui/react/radio-group\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\nexport type RadioGroupProps = Omit<ComponentProps<\"div\">, \"onChange\" | \"defaultValue\"> & {\n /** Visible group label. */\n label: string;\n /** Controlled choice; null means none selected. */\n value: string | null;\n /** Receives the selected item's value. */\n onValueChange: (value: string) => void;\n /** Disable all items. */\n disabled?: boolean;\n /** Segmented visual treatment; native single-choice behavior stays shared. */\n appearance?: \"standard\" | \"segmented\";\n /** Segmented background movement; reduced motion always wins. */\n selectionMotion?: \"slide\" | \"none\";\n /** Segmented selection color. */\n selectionTone?: \"primary\" | \"neutral\";\n /** Native form field name. */\n name?: string;\n /** Helper text for group. */\n description?: string;\n /** Group error message. */\n error?: string;\n /** Keep group label accessible but visually hidden. */\n visuallyHidden?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"label\" | \"options\" | \"description\" | \"error\">;\n};\nexport type RadioGroupItemProps = Omit<\n Radio.Root.Props<string>,\n \"className\" | \"children\" | \"render\"\n> & {\n /** Plain class on item label. */\n className?: string;\n /** Caller content supplies meaningful item label. */\n children: ReactNode;\n /** Class on focusable radio slot. */\n controlClassName?: string;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"item\" | \"control\" | \"indicator\" | \"content\">;\n};\ntype EntryData = { checked: boolean; eligible: boolean; tabIndex: number | undefined };\ntype EntryState = {\n target: string | null;\n update: (id: string, data: EntryData) => void;\n remove: (id: string) => void;\n markFocused: (id: string) => void;\n inside: boolean;\n};\nconst EntryContext = createContext<EntryState | null>(null);\n\ntype SelectionBounds = { x: number; y: number; width: number; height: number; disabled: boolean };\n\nfunction RadioOptions({\n segmented,\n className,\n children,\n}: {\n segmented: boolean;\n className: string | undefined;\n children: ReactNode;\n}) {\n const track = useRef<HTMLDivElement>(null);\n const [selection, setSelection] = useState<SelectionBounds | null>(null);\n useLayoutEffect(() => {\n const options = track.current;\n if (!options || !segmented) {\n setSelection(null);\n return;\n }\n const measure = () => {\n const control = options.querySelector<HTMLElement>(\".kb-radiogroup-control[data-checked]\");\n const item = control?.closest<HTMLLabelElement>(\".kb-radiogroup-item\");\n const next =\n item && item.offsetWidth > 0 && item.offsetHeight > 0\n ? {\n x: item.offsetLeft,\n y: item.offsetTop,\n width: item.offsetWidth,\n height: item.offsetHeight,\n disabled: control?.hasAttribute(\"data-disabled\") ?? false,\n }\n : null;\n setSelection((current) =>\n current?.x === next?.x &&\n current?.y === next?.y &&\n current?.width === next?.width &&\n current?.height === next?.height &&\n current?.disabled === next?.disabled\n ? current\n : next,\n );\n };\n const resize = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(measure);\n const observeItems = () => {\n resize?.disconnect();\n resize?.observe(options);\n for (const item of options.querySelectorAll(\".kb-radiogroup-item\")) resize?.observe(item);\n measure();\n };\n // Observe committed selection and layout; focus may move before owner accepts value.\n const changes = new MutationObserver(observeItems);\n changes.observe(options, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: [\"data-checked\", \"data-disabled\"],\n });\n observeItems();\n return () => {\n resize?.disconnect();\n changes.disconnect();\n };\n }, [segmented]);\n return (\n <div\n ref={track}\n className={clsx(\"kb-radiogroup-options\", className)}\n data-selection={segmented && selection ? \"\" : undefined}\n >\n {segmented && selection && (\n <span\n aria-hidden=\"true\"\n className=\"kb-radiogroup-selection\"\n data-disabled={selection.disabled ? \"\" : undefined}\n style={{\n width: selection.width,\n height: selection.height,\n transform: `translate(${selection.x}px, ${selection.y}px)`,\n }}\n />\n )}\n {children}\n </div>\n );\n}\n\nfunction RadioControl({\n checked,\n disabled,\n customTabIndex,\n ...props\n}: ComponentProps<\"span\"> & {\n checked: boolean;\n disabled: boolean;\n customTabIndex: number | undefined;\n}) {\n const entry = useContext(EntryContext);\n const update = entry?.update;\n const remove = entry?.remove;\n const id = useId();\n const eligible = !disabled && (customTabIndex === undefined || customTabIndex >= 0);\n useLayoutEffect(\n () => () => {\n remove?.(id);\n },\n [remove, id],\n );\n useLayoutEffect(() => {\n update?.(id, { checked, eligible, tabIndex: props.tabIndex });\n }, [update, id, checked, eligible, props.tabIndex]);\n // Entry follows selection; vendor retains arrow focus while user stays inside.\n const tabIndex = disabled\n ? -1\n : (customTabIndex ??\n (entry && !entry.inside && entry.target !== null\n ? entry.target === id\n ? 0\n : -1\n : props.tabIndex));\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: Base UI render props supply radio role.\n <span\n {...props}\n tabIndex={tabIndex}\n onFocus={(event) => {\n // Mark before handlers; caller may remove this control during focus.\n entry?.markFocused(id);\n props.onFocus?.(event);\n }}\n />\n );\n}\n\nfunction RadioGroupRoot({\n classNames,\n label,\n value,\n onValueChange,\n disabled = false,\n appearance = \"standard\",\n selectionMotion = \"slide\",\n selectionTone = \"primary\",\n name,\n description,\n error,\n visuallyHidden,\n className,\n children,\n onFocusCapture,\n onBlurCapture,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: RadioGroupProps) {\n const id = useId();\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const focused = useRef<string | null>(null);\n const [inside, setInside] = useState(false);\n const markFocused = useCallback((id: string) => {\n focused.current = id;\n }, []);\n const [entries, setEntries] = useState<Map<string, EntryData>>(() => new Map());\n const update = useCallback((id: string, data: EntryData) => {\n setEntries((current) => {\n const previous = current.get(id);\n if (\n previous &&\n previous.checked === data.checked &&\n previous.eligible === data.eligible &&\n previous.tabIndex === data.tabIndex\n )\n return current;\n return new Map(current).set(id, data);\n });\n }, []);\n const remove = useCallback((id: string) => {\n if (focused.current === id) {\n focused.current = null;\n setInside(false);\n }\n setEntries((current) => {\n if (!current.has(id)) return current;\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n const eligible = [...entries].filter(([, item]) => item.eligible);\n const target =\n (eligible.find(([, item]) => item.checked) ??\n eligible.find(([, item]) => item.tabIndex === 0) ??\n eligible[0])?.[0] ?? null;\n const described =\n [\n description ? `${id}-description` : null,\n error ? `${id}-error` : null,\n props[\"aria-describedby\"],\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <EntryContext.Provider value={{ target, update, remove, markFocused, inside }}>\n <BaseGroup<string | null>\n {...props}\n value={value}\n onFocusCapture={(event) => {\n setInside(true);\n onFocusCapture?.(event);\n }}\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n focused.current = null;\n setInside(false);\n }\n onBlurCapture?.(event);\n }}\n onValueChange={(next) => {\n if (next !== null && !disabled) onValueChange(next);\n }}\n disabled={disabled}\n {...(name ? { name } : {})}\n {...kb(\n \"radiogroup\",\n {\n invalid,\n disabled,\n appearance,\n \"selection-motion\": selectionMotion,\n \"selection-tone\": selectionTone,\n },\n className,\n )}\n aria-labelledby={`${id}-label`}\n aria-describedby={described}\n aria-invalid={ariaInvalid}\n >\n <div\n className={clsx(\"kb-radiogroup-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n id={`${id}-label`}\n >\n {label}\n </div>\n <RadioOptions segmented={appearance === \"segmented\"} className={classNames?.options}>\n {children}\n </RadioOptions>\n {description && (\n <p\n id={`${id}-description`}\n className={clsx(\"kb-radiogroup-description\", classNames?.description)}\n >\n {description}\n </p>\n )}\n {error && (\n <p id={`${id}-error`} className={clsx(\"kb-radiogroup-error\", classNames?.error)}>\n {error}\n </p>\n )}\n </BaseGroup>\n </EntryContext.Provider>\n );\n}\nfunction RadioGroupItem({\n classNames,\n className,\n children,\n controlClassName,\n ...props\n}: RadioGroupItemProps) {\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: Base UI Radio.Root renders its native input inside this label.\n <label className={clsx(\"kb-radiogroup-item\", classNames?.item, className)}>\n <Radio.Root\n {...props}\n className={clsx(\"kb-radiogroup-control\", classNames?.control, controlClassName)}\n render={(controlProps, state) => (\n <RadioControl\n {...controlProps}\n checked={state.checked}\n disabled={state.disabled}\n customTabIndex={props.tabIndex}\n />\n )}\n >\n <Radio.Indicator className={clsx(\"kb-radiogroup-indicator\", classNames?.indicator)} />\n </Radio.Root>\n <span className={clsx(\"kb-radiogroup-content\", classNames?.content)}>{children}</span>\n </label>\n );\n}\nexport const RadioGroup = Object.assign(RadioGroupRoot, { Item: RadioGroupItem });\n","import { ScrollArea as Base } from \"@base-ui/react/scroll-area\";\nimport { clsx } from \"clsx\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\n/** Scrolling region that keyboard users can reach: the viewport is a named, focusable region. */\nexport type ScrollAreaProps = Omit<Base.Root.Props, \"className\" | \"children\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Accessible name of the region. */\n label: string;\n /** Height cap, any CSS length; content scrolls past it. */\n maxHeight?: string;\n /** Scrolled content. */\n children: ReactNode;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"viewport\" | \"scrollbar\" | \"thumb\">;\n};\n\nexport function ScrollArea({\n classNames,\n label,\n maxHeight,\n className,\n style,\n children,\n ...props\n}: ScrollAreaProps) {\n const vars = maxHeight ? ({ \"--_scrollarea-max-height\": maxHeight } as CSSProperties) : {};\n return (\n <Base.Root\n {...props}\n style={{ ...vars, ...(typeof style === \"object\" ? style : {}) }}\n {...kb(\"scrollarea\", {}, className)}\n >\n <Base.Viewport\n className={clsx(\"kb-scrollarea-viewport\", classNames?.viewport)}\n tabIndex={0}\n role=\"region\"\n aria-label={label}\n >\n <Base.Content>{children}</Base.Content>\n </Base.Viewport>\n <Base.Scrollbar\n className={clsx(\"kb-scrollarea-scrollbar\", classNames?.scrollbar)}\n orientation=\"vertical\"\n >\n <Base.Thumb className={clsx(\"kb-scrollarea-thumb\", classNames?.thumb)} />\n </Base.Scrollbar>\n </Base.Root>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type SeparatorOrientation = \"horizontal\" | \"vertical\";\nexport type SeparatorProps = Omit<\n ComponentProps<\"hr\">,\n \"children\" | \"role\" | \"aria-hidden\" | \"aria-orientation\"\n> & {\n /** Direction of the visible rule and announced separator. */\n orientation?: SeparatorOrientation;\n /** Hide a visual-only divider from assistive technology. */\n decorative?: boolean;\n};\n\nexport function Separator({\n orientation = \"horizontal\",\n decorative = false,\n className,\n ...props\n}: SeparatorProps) {\n return (\n <hr\n {...props}\n {...kb(\"separator\", { orientation }, className)}\n role={decorative ? \"none\" : undefined}\n aria-hidden={decorative ? true : undefined}\n aria-orientation={decorative ? undefined : orientation}\n />\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SettingsPart = \"header\" | \"sections\";\n\nexport interface SettingsProps extends ComponentProps<\"div\"> {\n /** Page title and intro above the sections. */\n header?: ReactNode | undefined;\n /** Classes for inner regions, keyed by region. */\n classNames?: ClassNames<SettingsPart> | undefined;\n}\n\n/** Layout intent for sections of fields and managed lists, each saved on its own. */\nexport const Settings = ({\n ref,\n header,\n className,\n classNames,\n children,\n ...props\n}: SettingsProps) => (\n <div {...props} ref={ref} {...kb(\"settings\", {}, className)}>\n {header ? <div className={clsx(\"kb-settings-header\", classNames?.header)}>{header}</div> : null}\n <div className={clsx(\"kb-settings-sections\", classNames?.sections)}>{children}</div>\n </div>\n);\n","import { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SkeletonVariant = \"text\" | \"rect\" | \"circle\" | \"pill\" | \"auto\";\nexport type SkeletonSize = \"sm\" | \"md\" | \"lg\";\nexport type SkeletonAnimation = \"shimmer\" | \"pulse\" | \"wave\" | \"none\";\nexport type SkeletonTone = \"default\" | \"subtle\" | \"accent\";\nexport type SkeletonPart = \"root\" | \"line\" | \"content\" | \"status\";\n\nexport interface SkeletonProps extends ComponentPropsWithoutRef<\"div\"> {\n /** Shape preset; `auto` shapes placeholders from kbui children, falling back to `text` without them. */\n variant?: SkeletonVariant | undefined;\n /** Size preset controlling line height or avatar diameter. */\n size?: SkeletonSize | undefined;\n /** Number of stacked placeholder lines when `variant=\"text\"`. */\n lines?: number | undefined;\n /** Enable motion on placeholder shapes; set `false` for static placeholders. */\n animated?: boolean | undefined;\n /** Motion: `shimmer` sweep, `pulse` fade, `wave` staggered fade, or `none`. */\n animation?: SkeletonAnimation | undefined;\n /** Surface color: `default`, `subtle` recessed, or `accent` tinted. */\n tone?: SkeletonTone | undefined;\n /** Whether content is still loading; when `false`, renders `children` inside `.kb-skeleton-content`. */\n loading?: boolean | undefined;\n /** Loading status announced by `variant=\"auto\"`. */\n label?: string | undefined;\n /** Optional explicit inline size (`px` number or CSS length string). */\n width?: number | string | undefined;\n /** Optional explicit block size (`px` number or CSS length string). */\n height?: number | string | undefined;\n /** Loaded content; `variant=\"auto\"` also renders it inert as the placeholder layout. */\n children?: ReactNode | undefined;\n /** Custom class names for internal component slots. */\n classNames?: ClassNames<SkeletonPart> | undefined;\n}\n\nfunction toDimension(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? `${value}px` : value;\n}\n\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(function Skeleton(\n {\n variant = \"text\",\n size = \"md\",\n lines = 1,\n animated = true,\n animation = \"shimmer\",\n tone = \"default\",\n loading = true,\n label = \"Loading\",\n width,\n height,\n style,\n className,\n classNames,\n children,\n ...props\n },\n ref,\n) {\n const derived = variant === \"auto\" && children != null && typeof children !== \"boolean\";\n const shape = variant === \"auto\" && !derived ? \"text\" : variant;\n const placeholder = loading && !derived;\n const busy = loading && derived;\n const count = shape === \"text\" ? Math.max(1, Math.trunc(lines)) : 1;\n const inlineSize = toDimension(width);\n const blockSize = toDimension(height);\n const isAnimated = animated && animation !== \"none\";\n const rootStyle: CSSProperties | undefined =\n inlineSize !== undefined ? { ...style, inlineSize } : style;\n const lineStyle: CSSProperties | undefined = blockSize !== undefined ? { blockSize } : undefined;\n const lineIndices = Array.from({ length: count }, (_, idx) => idx);\n\n return (\n <div\n ref={ref}\n aria-hidden={placeholder ? \"true\" : undefined}\n aria-busy={busy ? \"true\" : undefined}\n style={rootStyle}\n {...props}\n {...kb(\n \"skeleton\",\n {\n variant: shape,\n size,\n tone,\n animation: isAnimated ? animation : false,\n animated: isAnimated,\n loaded: !loading,\n },\n classNames?.root ?? className,\n )}\n >\n {placeholder ? (\n lineIndices.map((lineNumber) => (\n <span\n key={`line-${lineNumber}`}\n style={lineStyle}\n className={clsx(\"kb-skeleton-line\", classNames?.line)}\n />\n ))\n ) : (\n <div\n className={clsx(\"kb-skeleton-content\", classNames?.content)}\n inert={busy}\n aria-hidden={busy ? \"true\" : undefined}\n >\n {children}\n </div>\n )}\n {busy ? (\n <span role=\"status\" className={clsx(\"kb-sr-only\", classNames?.status)}>\n {label}\n </span>\n ) : null}\n </div>\n );\n});\n","import { clsx } from \"clsx\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SpinnerSize = \"sm\" | \"md\" | \"lg\";\nexport type SpinnerTone =\n | \"current\"\n | \"accent\"\n | \"neutral\"\n | \"info\"\n | \"success\"\n | \"warning\"\n | \"danger\";\nexport type SpinnerVariant = \"ring\" | \"orbit\" | \"dots\" | \"bars\";\nexport type SpinnerAppearance = \"plain\" | \"pill\";\nexport type SpinnerPart = \"root\" | \"icon\" | \"track\" | \"arc\" | \"core\" | \"dot\" | \"bar\" | \"label\";\n\nexport interface SpinnerProps extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> {\n /** Accessible status label announced by assistive technology and optionally shown beside the indicator. */\n label?: string | undefined;\n /** Render the label visibly beside the spinner instead of visually hidden. */\n showLabel?: boolean | undefined;\n /** Mark spinner as purely decorative (`aria-hidden=\"true\"`, no status role) when a parent control already owns busy semantics. */\n decorative?: boolean | undefined;\n /** Visual size token preset. */\n size?: SpinnerSize | undefined;\n /** Semantic color tone; use `current` inside buttons or badges to inherit text color. */\n tone?: SpinnerTone | undefined;\n /** Indicator geometry and motion style. */\n variant?: SpinnerVariant | undefined;\n /** Container framing; `pill` wraps the indicator and label in a tinted status pill. */\n appearance?: SpinnerAppearance | undefined;\n /** Custom class names for internal component slots. */\n classNames?: ClassNames<SpinnerPart> | undefined;\n}\n\nconst DOT_CX = [5, 12, 19] as const;\nconst BAR_X = [3.5, 8.25, 13, 17.75] as const;\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n {\n label = \"Loading\",\n showLabel = false,\n decorative = false,\n size = \"md\",\n tone = \"accent\",\n variant = \"ring\",\n appearance = \"plain\",\n className,\n classNames,\n ...props\n },\n ref,\n) {\n return (\n <span\n ref={ref}\n role={decorative ? undefined : \"status\"}\n aria-live={decorative ? undefined : \"polite\"}\n aria-hidden={decorative ? \"true\" : undefined}\n {...props}\n {...kb(\n \"spinner\",\n { size, tone, variant, appearance, \"show-label\": showLabel },\n classNames?.root ?? className,\n )}\n >\n <svg\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n focusable=\"false\"\n className={clsx(\"kb-spinner-icon\", classNames?.icon)}\n >\n {variant === \"ring\" && (\n <>\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <path\n d=\"M12 2.5a9.5 9.5 0 1 1 0 19a9.5 9.5 0 1 1 0 -19\"\n pathLength={100}\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n </>\n )}\n {variant === \"orbit\" && (\n <>\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"9.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"5.5\"\n className={clsx(\"kb-spinner-track\", classNames?.track)}\n />\n <path\n d=\"M12 2.5a9.5 9.5 0 1 1 0 19a9.5 9.5 0 1 1 0 -19\"\n pathLength={100}\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n <path\n d=\"M12 17.5a5.5 5.5 0 1 1 0 -11a5.5 5.5 0 1 1 0 11\"\n pathLength={100}\n className={clsx(\"kb-spinner-arc\", classNames?.arc)}\n />\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"1.75\"\n className={clsx(\"kb-spinner-core\", classNames?.core)}\n />\n </>\n )}\n {variant === \"dots\" &&\n DOT_CX.map((cxPos) => (\n <circle\n key={cxPos}\n cx={cxPos}\n cy=\"12\"\n r=\"2.25\"\n className={clsx(\"kb-spinner-dot\", classNames?.dot)}\n />\n ))}\n {variant === \"bars\" &&\n BAR_X.map((xPos) => (\n <rect\n key={xPos}\n x={xPos}\n y=\"5\"\n width=\"2.5\"\n height=\"14\"\n rx=\"1.25\"\n className={clsx(\"kb-spinner-bar\", classNames?.bar)}\n />\n ))}\n </svg>\n {!decorative && (\n <span className={clsx(\"kb-spinner-label\", !showLabel && \"kb-sr-only\", classNames?.label)}>\n {label}\n </span>\n )}\n </span>\n );\n});\n","import { clsx } from \"clsx\";\nimport { Children, createElement } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport type { LayoutAlign, LayoutElementProps, LayoutGap } from \"../../utils/layout\";\n\nexport type SplitElement = \"div\" | \"section\" | \"article\";\nexport type SplitRatio = \"equal\" | \"wide-start\" | \"wide-end\";\nexport type SplitCollapse = \"sm\" | \"md\" | \"lg\";\nexport type SplitProps<T extends SplitElement = \"div\"> = LayoutElementProps<T> & {\n /** Classes for each layout-owned column track. */\n classNames?: ClassNames<\"track\">;\n /** Column proportions: 1:1, 2:1 or 1:2 in source order. */\n ratio?: SplitRatio;\n /** Available-width threshold below which columns stack. */\n collapse?: SplitCollapse;\n /** Space between columns or stacked rows. */\n gap?: LayoutGap;\n /** Cross-axis alignment while columns share a row. */\n align?: LayoutAlign;\n};\n\nexport function Split<T extends SplitElement = \"div\">({\n as,\n ratio = \"equal\",\n collapse = \"md\",\n gap = \"md\",\n align = \"stretch\",\n className,\n classNames,\n children,\n ...props\n}: SplitProps<T>) {\n const trackClassName = clsx(\"kb-split-track\", classNames?.track);\n return createElement(\n as ?? \"div\",\n { ...props, ...kb(\"split\", { ratio, collapse, gap, align }, className) },\n Children.map(children, (child) =>\n child == null ? null : <div className={trackClassName}>{child}</div>,\n ),\n );\n}\n","import { createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\nimport type { LayoutElementProps, LayoutGap } from \"../../utils/layout\";\n\nexport type StackElement = \"div\" | \"section\" | \"article\" | \"aside\" | \"ul\" | \"ol\" | \"nav\" | \"form\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\";\nexport type StackProps<T extends StackElement = \"div\"> = LayoutElementProps<T> & {\n /** Space between stacked items. */\n gap?: LayoutGap;\n /** Inline-axis alignment; stretch fills the stack width. */\n align?: StackAlign;\n /** Block-axis distribution when the stack is taller than its content. */\n justify?: StackJustify;\n};\n\nexport function Stack<T extends StackElement = \"div\">({\n as,\n gap = \"md\",\n align = \"stretch\",\n justify = \"start\",\n className,\n ...props\n}: StackProps<T>) {\n return createElement(as ?? \"div\", {\n ...props,\n ...kb(\"stack\", { gap, align, justify }, className),\n });\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type StatSize = \"md\" | \"display\";\n\n/** A labelled value; the label renders first so it is read first. */\nexport type StatProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n /** What the value measures. */\n label: ReactNode;\n /** The number or short text; figures are tabular. */\n value: ReactNode;\n /** Value size; display is for one headline number. */\n size?: StatSize;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"label\" | \"value\">;\n};\n\nexport function Stat({ classNames, label, value, size = \"md\", className, ...props }: StatProps) {\n return (\n <div {...props} {...kb(\"stat\", { size }, className)}>\n <span className={clsx(\"kb-stat-label\", classNames?.label)}>{label}</span>\n <span className={clsx(\"kb-stat-value\", classNames?.value)}>{value}</span>\n </div>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Stat } from \"../Stat/Stat\";\n\nexport type StatsRowAppearance = \"plain\" | \"outlined\";\nexport type StatsRowTrend = \"up\" | \"down\" | \"flat\";\nexport type StatsRowTone = \"positive\" | \"negative\" | \"neutral\";\n\nexport type StatsRowProps = ComponentProps<\"ul\"> & {\n /** Plain metrics on the page, or each metric on an outlined card surface. */\n appearance?: StatsRowAppearance | undefined;\n};\n\n/** A list of comparable metrics that fills its region and wraps when narrow. */\nfunction StatsRowRoot({ appearance = \"plain\", className, ...rest }: StatsRowProps) {\n // biome-ignore lint/a11y/noRedundantRoles: WebKit drops list semantics when list-style is none.\n return <ul role=\"list\" {...rest} {...kb(\"statsrow\", { appearance }, className)} />;\n}\n\nexport type StatsRowItemProps = Omit<ComponentProps<\"li\">, \"children\"> & {\n /** What the value measures, including its period when that changes the meaning. */\n label: ReactNode;\n /** The figure with its unit; figures are tabular. */\n value: ReactNode;\n /** Change since the comparison period; its text must state the direction, such as `+12.8%`. */\n change?: ReactNode | undefined;\n /** Direction glyph beside `change`; decorative, so the change text carries the meaning. */\n trend?: StatsRowTrend | undefined;\n /** Colors `change` by whether it is good or bad news; color alone, so state it in text too. */\n tone?: StatsRowTone | undefined;\n /** Comparison period or freshness, such as `vs. previous month`. */\n context?: ReactNode | undefined;\n /** Optional link to the detail behind the metric. */\n link?: ReactNode | undefined;\n classNames?:\n | ClassNames<\"stat\" | \"label\" | \"value\" | \"trend\" | \"change\" | \"glyph\" | \"context\" | \"link\">\n | undefined;\n};\n\nconst glyphs: Record<StatsRowTrend, string> = {\n up: \"M8 3.5 13 10H3z\",\n down: \"M8 12.5 3 6h10z\",\n flat: \"M3 7h10v2H3z\",\n};\n\nfunction StatsRowItem({\n label,\n value,\n change,\n trend,\n tone = \"neutral\",\n context,\n link,\n className,\n classNames,\n ...rest\n}: StatsRowItemProps) {\n const hasTrend = change != null || context != null;\n\n return (\n <li {...rest} {...kb(\"statsrow-item\", {}, className)}>\n <Stat\n label={label}\n value={value}\n className={classNames?.stat}\n classNames={classNames ?? {}}\n />\n {hasTrend ? (\n <p className={clsx(\"kb-statsrow-trend\", classNames?.trend)}>\n {change != null ? (\n <span\n className={clsx(\"kb-statsrow-change\", classNames?.change)}\n data-tone={tone}\n data-trend={trend}\n >\n {trend !== undefined ? (\n <svg\n className={clsx(\"kb-statsrow-glyph\", classNames?.glyph)}\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d={glyphs[trend]} fill=\"currentColor\" />\n </svg>\n ) : null}\n {change}\n </span>\n ) : null}\n {change != null && context != null ? \" \" : null}\n {context != null ? (\n <span className={clsx(\"kb-statsrow-context\", classNames?.context)}>{context}</span>\n ) : null}\n </p>\n ) : null}\n {link != null ? (\n <div className={clsx(\"kb-statsrow-link\", classNames?.link)}>{link}</div>\n ) : null}\n </li>\n );\n}\n\nexport const StatsRow = Object.assign(StatsRowRoot, { Item: StatsRowItem });\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type StatusTone = \"neutral\" | \"info\" | \"running\" | \"success\" | \"warning\" | \"blocked\";\nexport type StatusAppearance = \"plain\" | \"chip\";\n\n/** Text is mandatory: tone is never conveyed by color alone. */\nexport type StatusProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n /** Visible label. */\n children: ReactNode;\n /** Meaning of the state; drives color and the icon slot's color. */\n tone?: StatusTone;\n /** Caller-provided decorative icon; kbui ships no icons. */\n icon?: ReactNode;\n /** Announce changes: adds role=\"status\" and nothing else. */\n live?: boolean;\n /** Plain text and icon, or a chip tinted from the tone. */\n appearance?: StatusAppearance;\n /** Tighter spacing and smaller text; the text stays visible. */\n compact?: boolean;\n /** Classes for inner parts, keyed by part. */\n classNames?: ClassNames<\"icon\" | \"text\">;\n};\n\nexport function Status({\n classNames,\n tone = \"neutral\",\n appearance = \"plain\",\n icon,\n live = false,\n compact = false,\n className,\n children,\n ...props\n}: StatusProps) {\n return (\n <span\n {...props}\n {...(live ? { role: \"status\" } : {})}\n {...kb(\"status\", { tone, appearance, compact }, className)}\n >\n {icon != null ? (\n <span className={clsx(\"kb-status-icon\", classNames?.icon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className={clsx(\"kb-status-text\", classNames?.text)}>{children}</span>\n </span>\n );\n}\n","import { clsx } from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type SupportingPanePart = \"main\" | \"aside\";\n\nexport interface SupportingPaneProps extends ComponentProps<\"div\"> {\n /** Supporting content, such as an order summary; moves below main at compact size. */\n aside?: ReactNode | undefined;\n /** Accessible name for the aside landmark. */\n asideLabel?: string | undefined;\n /** Id of a visible heading that names the aside; preferred over `asideLabel`. */\n asideLabelledBy?: string | undefined;\n /** Classes for inner regions, keyed by region. */\n classNames?: ClassNames<SupportingPanePart> | undefined;\n}\n\n/** Layout intent for a main column with a complementary aside beside it, or below it when narrow. */\nexport const SupportingPane = ({\n ref,\n aside,\n asideLabel,\n asideLabelledBy,\n className,\n classNames,\n children,\n ...props\n}: SupportingPaneProps) => (\n <div {...props} ref={ref} {...kb(\"supportingpane\", {}, className)}>\n <div className={clsx(\"kb-supportingpane-main\", classNames?.main)}>{children}</div>\n {aside ? (\n <aside\n className={clsx(\"kb-supportingpane-aside\", classNames?.aside)}\n aria-label={asideLabelledBy ? undefined : asideLabel}\n aria-labelledby={asideLabelledBy}\n >\n {aside}\n </aside>\n ) : null}\n </div>\n);\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type CSSProperties, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type SwitchSize = \"sm\" | \"md\" | \"lg\";\nexport type SwitchTone = \"neutral\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport type SwitchProps = Omit<\n ComponentProps<\"input\">,\n \"type\" | \"role\" | \"checked\" | \"defaultChecked\" | \"onChange\" | \"size\" | \"children\" | \"style\"\n> & {\n /** Visible, associated label. */\n label: string;\n /** Owner controls checked state. */\n checked: boolean;\n /** Requests next checked state. */\n onCheckedChange: (checked: boolean) => void;\n /** Track size; defaults to sm inside Fieldset and md elsewhere. */\n size?: SwitchSize | undefined;\n /** Shorthand tone for the on side when onTone is omitted. */\n tone?: SwitchTone | undefined;\n /** Semantic tone for the off side. */\n offTone?: SwitchTone | undefined;\n /** Semantic tone for the on side; defaults to accent. */\n onTone?: SwitchTone | undefined;\n /** Custom CSS color or token for the off side. */\n offColor?: string | undefined;\n /** Custom CSS color or token for the on side. */\n onColor?: string | undefined;\n /** Associated helper text. */\n description?: string | undefined;\n /** Associated error; marks native control invalid for assistive technology. */\n error?: string | undefined;\n /** Hide label visually; keep its accessible name. */\n visuallyHidden?: boolean | undefined;\n /** Decorative content in off position. */\n offIcon?: ReactNode;\n /** Decorative content in on position. */\n onIcon?: ReactNode;\n /** Added to native input; className belongs to root. */\n controlClassName?: string | undefined;\n /** Native styles; custom properties also feed visible planes. */\n style?: CSSProperties | (CSSProperties & Record<`--${string}`, string | number | undefined>);\n /** Classes for inner parts, keyed by part. */\n classNames?:\n | ClassNames<\n | \"control\"\n | \"label\"\n | \"field\"\n | \"target\"\n | \"track\"\n | \"thumb\"\n | \"off\"\n | \"on\"\n | \"description\"\n | \"error\"\n >\n | undefined;\n};\n\nexport function Switch({\n classNames,\n label,\n checked,\n onCheckedChange,\n size,\n tone,\n offTone,\n onTone,\n offColor,\n onColor,\n description,\n error,\n visuallyHidden,\n offIcon,\n onIcon,\n controlClassName,\n className,\n style,\n id,\n disabled,\n readOnly,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: SwitchProps) {\n const customVars = Object.fromEntries(\n Object.entries(style ?? {}).filter(([property]) => property.startsWith(\"--\")),\n );\n const rootStyle = {\n ...customVars,\n ...(offColor ? { \"--kb-switch-off-color\": offColor } : {}),\n ...(onColor ? { \"--kb-switch-on-color\": onColor } : {}),\n } as CSSProperties;\n const resolvedOffTone = offColor ? \"custom\" : offTone;\n const resolvedOnTone = onColor ? \"custom\" : (onTone ?? tone ?? \"accent\");\n const generated = useId();\n const controlId = id ?? `kb-switch-${generated}`;\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const descriptionId = `${controlId}-description`;\n const errorId = `${controlId}-error`;\n const descriptions =\n [describedBy, description && descriptionId, error && errorId].filter(Boolean).join(\" \") ||\n undefined;\n return (\n <div\n style={rootStyle}\n {...kb(\n \"switch\",\n {\n size,\n \"off-tone\": resolvedOffTone,\n \"on-tone\": resolvedOnTone,\n checked,\n disabled,\n readonly: readOnly,\n invalid,\n },\n className,\n )}\n >\n <div className={clsx(\"kb-switch-field\", classNames?.field)}>\n <span className={clsx(\"kb-switch-target\", classNames?.target)}>\n <input\n {...props}\n style={style}\n id={controlId}\n type=\"checkbox\"\n role=\"switch\"\n aria-checked={checked}\n className={clsx(\"kb-switch-control\", classNames?.control, controlClassName)}\n checked={checked}\n disabled={disabled}\n readOnly={readOnly}\n aria-readonly={readOnly || undefined}\n aria-invalid={ariaInvalid}\n aria-describedby={descriptions}\n onChange={(event) => {\n if (!readOnly) onCheckedChange(event.currentTarget.checked);\n }}\n />\n <span className={clsx(\"kb-switch-track\", classNames?.track)} aria-hidden=\"true\">\n <span className={clsx(\"kb-switch-thumb\", classNames?.thumb)} />\n <span className={clsx(\"kb-switch-off\", classNames?.off)}>{offIcon}</span>\n <span className={clsx(\"kb-switch-on\", classNames?.on)}>{onIcon}</span>\n </span>\n </span>\n <label\n htmlFor={controlId}\n className={clsx(\"kb-switch-label\", classNames?.label, visuallyHidden && \"kb-sr-only\")}\n >\n {label}\n </label>\n </div>\n {description && (\n <p className={clsx(\"kb-switch-description\", classNames?.description)} id={descriptionId}>\n {description}\n </p>\n )}\n {error && (\n <p className={clsx(\"kb-switch-error\", classNames?.error)} id={errorId}>\n {error}\n </p>\n )}\n </div>\n );\n}\n","import type { ComponentProps, CSSProperties } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Checkbox, type CheckboxProps } from \"../Checkbox/Checkbox\";\n\nexport type TableProps = ComponentProps<\"table\"> & {\n /** Cell spacing; dense retains full-size control targets. */\n density?: \"comfortable\" | \"dense\" | undefined;\n stickyHeader?: boolean | undefined;\n /** Fixed column sizing; supply widths through colgroup or cell styles. */\n layout?: \"auto\" | \"fixed\" | undefined;\n};\nexport function TableRoot({\n density = \"comfortable\",\n stickyHeader = false,\n layout = \"auto\",\n className,\n ...props\n}: TableProps) {\n return (\n <table\n {...props}\n {...kb(\"table\", { density, \"sticky-header\": stickyHeader, layout }, className)}\n />\n );\n}\nfunction revealTableFocus(viewport: HTMLElement, target: HTMLElement) {\n const table = [...viewport.querySelectorAll<HTMLTableElement>(\".kb-table\")].find(\n (candidate) => candidate.contains(target) && candidate.closest(\".kb-table-scroll\") === viewport,\n );\n if (!table) return;\n const bounds = viewport.getBoundingClientRect();\n const left = bounds.left + viewport.clientLeft;\n const top = bounds.top + viewport.clientTop;\n let focusedEdge: string | undefined;\n for (let cell: HTMLElement | null = target; cell && cell !== table; cell = cell.parentElement) {\n if (cell.matches(\"th[data-sticky], td[data-sticky]\") && cell.closest(\".kb-table\") === table) {\n focusedEdge = cell.dataset.sticky;\n break;\n }\n }\n let visibleLeft = left;\n let visibleRight = left + viewport.clientWidth;\n const pinnedCells = table.querySelectorAll<HTMLElement>(\n \":scope > thead > tr > [data-sticky], :scope > :is(tbody, tfoot) > tr:first-child > [data-sticky]\",\n );\n for (const cell of pinnedCells) {\n const appearance = getComputedStyle(cell);\n if (\n cell.dataset.sticky === focusedEdge ||\n appearance.position !== \"sticky\" ||\n appearance.visibility !== \"visible\"\n )\n continue;\n const cellBounds = cell.getBoundingClientRect();\n if (cellBounds.width <= 0 || cellBounds.height <= 0) continue;\n const leftEdge = (cell.dataset.sticky === \"start\") !== (appearance.direction === \"rtl\");\n if (leftEdge) visibleLeft = Math.max(visibleLeft, cellBounds.right);\n else visibleRight = Math.min(visibleRight, cellBounds.left);\n }\n const head = table.tHead;\n const visibleTop =\n head && table.hasAttribute(\"data-sticky-header\") && !head.contains(target)\n ? Math.max(top, head.getBoundingClientRect().bottom)\n : top;\n const visibleBottom = top + viewport.clientHeight;\n const targetBounds = target.getBoundingClientRect();\n if (visibleRight > visibleLeft) {\n if (targetBounds.left < visibleLeft)\n viewport.scrollLeft += Math.floor(targetBounds.left - visibleLeft);\n else if (targetBounds.right > visibleRight)\n viewport.scrollLeft += Math.ceil(targetBounds.right - visibleRight);\n }\n if (visibleBottom > visibleTop) {\n if (targetBounds.top < visibleTop)\n viewport.scrollTop += Math.floor(targetBounds.top - visibleTop);\n else if (targetBounds.bottom > visibleBottom)\n viewport.scrollTop += Math.ceil(targetBounds.bottom - visibleBottom);\n }\n}\n\nexport type TableScrollContainerProps = ComponentProps<\"section\"> & {\n label: string;\n /** Height cap; sticky headers use this scroll boundary. */\n maxHeight?: CSSProperties[\"maxHeight\"] | undefined;\n};\nexport function TableScrollContainer({\n label,\n maxHeight,\n onFocus,\n className,\n style,\n ...props\n}: TableScrollContainerProps) {\n return (\n <section\n {...props}\n aria-label={label}\n tabIndex={props.tabIndex ?? 0}\n {...kb(\"table-scroll\", {}, className)}\n style={{ maxHeight, ...style }}\n onFocus={(event) => {\n onFocus?.(event);\n if (!event.defaultPrevented && event.target instanceof HTMLElement)\n revealTableFocus(event.currentTarget, event.target);\n }}\n />\n );\n}\nexport type TableCaptionProps = ComponentProps<\"caption\">;\nexport function TableCaption({ className, ...props }: TableCaptionProps) {\n return <caption {...props} {...kb(\"table-caption\", {}, className)} />;\n}\nexport type TableHeadProps = ComponentProps<\"thead\">;\nexport function TableHead({ className, ...props }: TableHeadProps) {\n return <thead {...props} {...kb(\"table-head\", {}, className)} />;\n}\nexport type TableBodyProps = ComponentProps<\"tbody\">;\nexport function TableBody({ className, ...props }: TableBodyProps) {\n return <tbody {...props} {...kb(\"table-body\", {}, className)} />;\n}\nexport type TableFootProps = ComponentProps<\"tfoot\">;\nexport function TableFoot({ className, ...props }: TableFootProps) {\n return <tfoot {...props} {...kb(\"table-foot\", {}, className)} />;\n}\nexport type TableRowProps = ComponentProps<\"tr\"> & {\n /** Highlight a row whose checkbox is selected; adds no grid role. */\n selected?: boolean | undefined;\n};\nexport function TableRow({ selected = false, className, ...props }: TableRowProps) {\n return <tr {...props} {...kb(\"table-row\", { selected }, className)} />;\n}\nexport type TableCellOptions = {\n align?: \"start\" | \"center\" | \"end\" | undefined;\n /** Pin one edge cell; use matching edges in header and body. */\n sticky?: \"start\" | \"end\" | undefined;\n};\nexport type TableSortDirection = \"none\" | \"ascending\" | \"descending\";\nexport type TableColumnHeaderProps = Omit<ComponentProps<\"th\">, \"align\"> &\n TableCellOptions & {\n /** Controlled order; app owns sorting and resets other columns to none. */\n sortDirection?: TableSortDirection | undefined;\n /** Enables native sort button; none starts ascending, then toggles. */\n onSortChange?: ((direction: Exclude<TableSortDirection, \"none\">) => void) | undefined;\n sortDisabled?: boolean | undefined;\n classNames?: ClassNames<\"sortButton\" | \"sortIcon\"> | undefined;\n };\nexport function TableColumnHeader({\n align = \"start\",\n sticky,\n sortDirection,\n onSortChange,\n sortDisabled,\n className,\n classNames,\n children,\n scope = \"col\",\n \"aria-sort\": ariaSort,\n ...props\n}: TableColumnHeaderProps) {\n const direction =\n sortDirection ?? (ariaSort === \"ascending\" || ariaSort === \"descending\" ? ariaSort : \"none\");\n return (\n <th\n {...props}\n scope={scope}\n aria-sort={sortDirection === \"none\" ? undefined : (sortDirection ?? ariaSort)}\n {...kb(\"table-columnheader\", { align, sticky, sortable: Boolean(onSortChange) }, className)}\n >\n {onSortChange ? (\n <button\n type=\"button\"\n disabled={sortDisabled}\n {...kb(\"table-sort-button\", {}, classNames?.sortButton)}\n onClick={() => onSortChange(direction === \"ascending\" ? \"descending\" : \"ascending\")}\n >\n {children}\n <span aria-hidden=\"true\" {...kb(\"table-sort-icon\", {}, classNames?.sortIcon)}>\n {direction === \"ascending\" ? \"↑\" : direction === \"descending\" ? \"↓\" : \"⇅\"}\n </span>\n </button>\n ) : (\n children\n )}\n </th>\n );\n}\nexport type TableRowHeaderProps = Omit<ComponentProps<\"th\">, \"align\"> & TableCellOptions;\nexport function TableRowHeader({\n align = \"start\",\n sticky,\n scope = \"row\",\n className,\n ...props\n}: TableRowHeaderProps) {\n return <th {...props} scope={scope} {...kb(\"table-rowheader\", { align, sticky }, className)} />;\n}\nexport type TableCellProps = Omit<ComponentProps<\"td\">, \"align\"> & TableCellOptions;\nexport function TableCell({ align = \"start\", sticky, className, ...props }: TableCellProps) {\n return <td {...props} {...kb(\"table-cell\", { align, sticky }, className)} />;\n}\nexport type TableSelectionCheckboxProps = CheckboxProps;\nexport type TableRowActionsProps = ComponentProps<\"div\">;\nexport function TableRowActions({ className, ...props }: TableRowActionsProps) {\n return <div {...props} {...kb(\"table-rowactions\", {}, className)} />;\n}\n\nexport const Table = Object.assign(TableRoot, {\n ScrollContainer: TableScrollContainer,\n Caption: TableCaption,\n Head: TableHead,\n Body: TableBody,\n Foot: TableFoot,\n Row: TableRow,\n ColumnHeader: TableColumnHeader,\n RowHeader: TableRowHeader,\n Cell: TableCell,\n SelectionCheckbox: Checkbox,\n RowActions: TableRowActions,\n});\n","import { Tabs as BaseTabs } from \"@base-ui/react/tabs\";\nimport { clsx as cx } from \"clsx\";\nimport {\n Children,\n type ComponentPropsWithoutRef,\n createContext,\n forwardRef,\n isValidElement,\n type ReactNode,\n useContext,\n} from \"react\";\nimport type { ClassNames } from \"../../utils/kb\";\n\nexport type TabsOrientation = \"horizontal\" | \"vertical\";\nexport type TabsVariant = \"line\" | \"pill\";\nexport type TabsSize = \"sm\" | \"md\";\nexport type TabsClassKey =\n | \"root\"\n | \"list\"\n | \"tab\"\n | \"tabIcon\"\n | \"tabLabel\"\n | \"tabBadge\"\n | \"indicator\"\n | \"panel\";\n\ntype TabsStyleContextValue = {\n variant: TabsVariant;\n size: TabsSize;\n orientation: TabsOrientation;\n classNames?: ClassNames<TabsClassKey> | undefined;\n};\n\nconst TabsStyleContext = createContext<TabsStyleContextValue>({\n variant: \"line\",\n size: \"md\",\n orientation: \"horizontal\",\n});\n\nexport interface TabsProps\n extends Omit<\n ComponentPropsWithoutRef<typeof BaseTabs.Root>,\n \"className\" | \"orientation\" | \"value\" | \"defaultValue\" | \"onValueChange\"\n > {\n /** Controlled active tab value. */\n value?: string | number | null | undefined;\n /** Initial active tab value when uncontrolled. */\n defaultValue?: string | number | null | undefined;\n /** Called when the active tab value changes. */\n onValueChange?:\n | ((value: string | number | null, eventDetails: BaseTabs.Root.ChangeEventDetails) => void)\n | undefined;\n /** Layout axis for the tab list and panels. */\n orientation?: TabsOrientation | undefined;\n /** Visual treatment of the tab list and active indicator. */\n variant?: TabsVariant | undefined;\n /** Control density for tab triggers. */\n size?: TabsSize | undefined;\n /** Additional root class name. */\n className?: string | undefined;\n /** Custom class names for inner anatomy slots. */\n classNames?: ClassNames<TabsClassKey> | undefined;\n}\n\nexport interface TabsListProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.List>, \"className\"> {\n /** Move selection automatically when focus moves between tabs. */\n activateOnFocus?: boolean | undefined;\n /** Wrap arrow-key focus from the last tab back to the first. */\n loopFocus?: boolean | undefined;\n /** Render the sliding active indicator inside the list. */\n showIndicator?: boolean | undefined;\n /** Additional tablist class name. */\n className?: string | undefined;\n}\n\nexport interface TabsTabProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Tab>, \"className\" | \"value\"> {\n /** Unique value matching the associated panel. */\n value: string | number;\n /** Prevent selecting or activating the tab. */\n disabled?: boolean | undefined;\n /** Optional leading icon rendered inside the tab trigger. */\n icon?: ReactNode | undefined;\n /** Optional trailing count or status badge. */\n badge?: ReactNode | undefined;\n /** Additional tab button class name. */\n className?: string | undefined;\n}\n\nexport interface TabsIndicatorProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Indicator>, \"className\"> {\n /** Additional indicator class name. */\n className?: string | undefined;\n}\n\nexport interface TabsPanelProps\n extends Omit<ComponentPropsWithoutRef<typeof BaseTabs.Panel>, \"className\" | \"value\"> {\n /** Tab value that reveals this panel when active. */\n value: string | number;\n /** Keep inactive panel DOM mounted when hidden. */\n keepMounted?: boolean | undefined;\n /** Additional panel class name. */\n className?: string | undefined;\n}\n\nexport const TabsIndicator = forwardRef<HTMLSpanElement, TabsIndicatorProps>(function TabsIndicator(\n { className, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Indicator\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n className={cx(\"kb-tabs-indicator\", classNames?.indicator, className)}\n />\n );\n});\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(function TabsList(\n { activateOnFocus = true, loopFocus = true, showIndicator = true, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n const hasExplicitIndicator = Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === TabsIndicator,\n );\n return (\n <BaseTabs.List\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n activateOnFocus={activateOnFocus}\n loopFocus={loopFocus}\n className={cx(\"kb-tabs-list\", classNames?.list, className)}\n >\n {children}\n {showIndicator && !hasExplicitIndicator ? <TabsIndicator /> : null}\n </BaseTabs.List>\n );\n});\n\nexport const TabsTab = forwardRef<HTMLButtonElement, TabsTabProps>(function TabsTab(\n { value, disabled = false, icon, badge, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Tab\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n value={value}\n disabled={disabled}\n className={cx(\"kb-tabs-tab\", classNames?.tab, className)}\n >\n {icon != null ? (\n <span className={cx(\"kb-tabs-tab-icon\", classNames?.tabIcon)} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className={cx(\"kb-tabs-tab-label\", classNames?.tabLabel)}>{children}</span>\n {badge != null ? (\n <span className={cx(\"kb-tabs-tab-badge\", classNames?.tabBadge)}>{badge}</span>\n ) : null}\n </BaseTabs.Tab>\n );\n});\n\nexport const TabsPanel = forwardRef<HTMLDivElement, TabsPanelProps>(function TabsPanel(\n { value, keepMounted = false, className, children, ...props },\n ref,\n) {\n const { classNames, variant, size, orientation } = useContext(TabsStyleContext);\n return (\n <BaseTabs.Panel\n {...props}\n data-variant={variant}\n data-size={size}\n data-orientation={orientation}\n ref={ref}\n value={value}\n keepMounted={keepMounted}\n className={cx(\"kb-tabs-panel\", classNames?.panel, className)}\n >\n {children}\n </BaseTabs.Panel>\n );\n});\n\nconst TabsRoot = forwardRef<HTMLDivElement, TabsProps>(function Tabs(\n {\n value,\n defaultValue,\n onValueChange,\n orientation = \"horizontal\",\n variant = \"line\",\n size = \"md\",\n className,\n classNames,\n children,\n ...props\n },\n ref,\n) {\n return (\n <TabsStyleContext.Provider value={{ classNames, variant, size, orientation }}>\n <BaseTabs.Root\n {...props}\n ref={ref}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n orientation={orientation}\n data-variant={variant}\n data-size={size}\n className={cx(\"kb-tabs\", classNames?.root, className)}\n >\n {children}\n </BaseTabs.Root>\n </TabsStyleContext.Provider>\n );\n});\n\nexport const Tabs = Object.assign(TabsRoot, {\n List: TabsList,\n Tab: TabsTab,\n Indicator: TabsIndicator,\n Panel: TabsPanel,\n});\n","import { type ComponentProps, createElement } from \"react\";\nimport { kb } from \"../../utils/kb\";\n\nexport type TextElement = \"p\" | \"span\" | \"div\";\nexport type TextSize = \"sm\" | \"md\" | \"lg\";\nexport type TextTone = \"default\" | \"muted\";\nexport type TextProps<T extends TextElement = \"p\"> = ComponentProps<T> & {\n /** Native element; use span inside paragraphs and div for block children. */\n as?: T;\n /** Body size; inline links and code inherit surrounding size. */\n size?: TextSize;\n /** Default ink or secondary text with readable contrast. */\n tone?: TextTone;\n};\n\nexport function Text<T extends TextElement = \"p\">({\n as,\n size = \"md\",\n tone = \"default\",\n className,\n ...props\n}: TextProps<T>) {\n return createElement(as ?? \"p\", { ...props, ...kb(\"text\", { size, tone }, className) });\n}\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, useId } from \"react\";\nimport { type ClassNames, kb, resolveInvalid } from \"../../utils/kb\";\n\nexport type TextareaResize = \"vertical\" | \"none\" | \"both\";\nexport type TextareaPart = \"label\" | \"control\" | \"description\" | \"error\";\n\nexport interface TextareaProps extends Omit<ComponentProps<\"textarea\">, \"children\"> {\n /** Visible field label and accessible name. */\n label: string;\n /** Hide the label visually while keeping its accessible name. */\n visuallyHidden?: boolean | undefined;\n /** Supporting helper text below the textarea. */\n description?: string | undefined;\n /** Validation error message; marks the textarea invalid. */\n error?: string | undefined;\n /** Drag-resize axis for the native textarea. */\n resize?: TextareaResize | undefined;\n /** Callback fired with the next string value on change. */\n onValueChange?: ((value: string) => void) | undefined;\n /** Root wrapper class name. */\n className?: string | undefined;\n /** Classes for the label, control, description and error slots. */\n classNames?: ClassNames<TextareaPart> | undefined;\n}\n\n/** Labelled multiline text control with associated helper and error messages. */\nexport const Textarea = ({\n ref,\n id,\n label,\n visuallyHidden,\n description,\n error,\n resize = \"vertical\",\n rows = 4,\n disabled,\n readOnly,\n onChange,\n onValueChange,\n className,\n classNames,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": callerAriaInvalid,\n ...props\n}: TextareaProps) => {\n const reactId = useId();\n const controlId = id ?? `kb-textarea-${reactId}`;\n const { invalid, ariaInvalid } = resolveInvalid(Boolean(error), callerAriaInvalid);\n const descriptionId = description ? `${controlId}-description` : undefined;\n const errorId = error ? `${controlId}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, ariaDescribedBy].filter(Boolean).join(\" \") || undefined;\n\n return (\n <div {...kb(\"textarea\", { resize, invalid, disabled, readonly: readOnly }, className)}>\n <label\n htmlFor={controlId}\n className={clsx(\"kb-textarea-label\", visuallyHidden && \"kb-sr-only\", classNames?.label)}\n >\n {label}\n </label>\n <textarea\n {...props}\n ref={ref}\n id={controlId}\n rows={rows}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={describedBy}\n className={clsx(\"kb-textarea-control\", classNames?.control)}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n }}\n />\n {description ? (\n <p id={descriptionId} className={clsx(\"kb-textarea-description\", classNames?.description)}>\n {description}\n </p>\n ) : null}\n {error ? (\n <div id={errorId} className={clsx(\"kb-textarea-error\", classNames?.error)}>\n {error}\n </div>\n ) : null}\n </div>\n );\n};\n","import { clsx } from \"clsx\";\nimport { type ComponentProps, type ReactNode, useId } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\nimport { Image, type ImageProps } from \"../Image/Image\";\n\nexport type ThumbnailProps = Omit<ComponentProps<\"figure\">, \"children\"> &\n Pick<ImageProps, \"src\" | \"alt\" | \"ratio\" | \"fit\" | \"position\" | \"fallback\"> & {\n /** Visible title; may contain a native link or button. */\n caption?: ReactNode | undefined;\n /** Supporting metadata; remains visible when media fails. */\n description?: ReactNode | undefined;\n /** Native source/loading attributes and Image styling hooks. */\n imageProps?:\n | Omit<ImageProps, \"src\" | \"alt\" | \"ratio\" | \"fit\" | \"position\" | \"fallback\">\n | undefined;\n /** Extra classes for figure, media, caption, title and description. */\n classNames?: ClassNames<\"root\" | \"media\" | \"caption\" | \"title\" | \"description\"> | undefined;\n };\n\nexport function Thumbnail({\n src,\n alt,\n ratio,\n fit,\n position,\n fallback,\n caption,\n description,\n imageProps,\n className,\n classNames,\n ...props\n}: ThumbnailProps) {\n const captionId = useId();\n const hasCaption = caption !== undefined && caption !== null && caption !== false;\n return (\n <figure\n {...props}\n {...kb(\"thumbnail\", {}, classNames?.root ?? className)}\n aria-labelledby={\n props[\"aria-labelledby\"] ??\n (props[\"aria-label\"] ? undefined : hasCaption ? captionId : undefined)\n }\n >\n <Image\n {...imageProps}\n src={src}\n alt={alt}\n ratio={ratio}\n fit={fit}\n position={position}\n fallback={fallback}\n classNames={{\n ...imageProps?.classNames,\n root: clsx(\n \"kb-thumbnail-media\",\n classNames?.media,\n imageProps?.classNames?.root ?? imageProps?.className,\n ),\n }}\n />\n {(hasCaption || description != null) && (\n <figcaption {...kb(\"thumbnail-caption\", {}, classNames?.caption)}>\n {hasCaption && (\n <span id={captionId} {...kb(\"thumbnail-title\", {}, classNames?.title)}>\n {caption}\n </span>\n )}\n {description != null && (\n <span {...kb(\"thumbnail-description\", {}, classNames?.description)}>{description}</span>\n )}\n </figcaption>\n )}\n </figure>\n );\n}\n","import {\n Toast as Base,\n type ToastManagerAddOptions as BaseAddOptions,\n type ToastManagerPromiseOptions as BasePromiseOptions,\n type ToastManager as BaseToastManager,\n type ToastObject as BaseToastObject,\n type ToastManagerUpdateOptions as BaseUpdateOptions,\n type UseToastManagerReturnValue,\n} from \"@base-ui/react/toast\";\nimport { clsx } from \"clsx\";\nimport type { ReactNode } from \"react\";\nimport { type ClassNames, kb } from \"../../utils/kb\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\nexport type ToastPlacement = \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"inline\";\nexport type ToastObject<Data extends object = Record<string, unknown>> = BaseToastObject<Data>;\nexport type ToastManager<Data extends object = Record<string, unknown>> = BaseToastManager<Data>;\nexport type ToastAddOptions<Data extends object = Record<string, unknown>> = BaseAddOptions<Data>;\nexport type ToastUpdateOptions<Data extends object = Record<string, unknown>> =\n BaseUpdateOptions<Data>;\nexport type ToastPromiseOptions<\n Value,\n Data extends object = Record<string, unknown>,\n> = BasePromiseOptions<Value, Data>;\nexport type ToastProviderProps = Base.Provider.Props;\nexport type ToastContentProps = Omit<Base.Content.Props, \"className\"> & {\n /** Extra classes for content. */\n className?: string | undefined;\n};\nexport type ToastTitleProps = Omit<Base.Title.Props, \"className\"> & {\n /** Extra classes for title. */\n className?: string | undefined;\n};\nexport type ToastDescriptionProps = Omit<Base.Description.Props, \"className\"> & {\n /** Extra classes for description. */\n className?: string | undefined;\n};\nexport type ToastActionProps = Omit<Base.Action.Props, \"className\"> & {\n /** Extra classes for action. */\n className?: string | undefined;\n};\nexport type ToastCloseProps = Omit<Base.Close.Props, \"className\"> & {\n /** Extra classes for dismissal control. */\n className?: string | undefined;\n};\nexport type ToastProps<Data extends object = Record<string, unknown>> = Omit<\n Base.Root.Props,\n \"className\" | \"toast\"\n> & {\n /** Message object from the matching provider. */\n toast: ToastObject<Data>;\n /** Extra classes for root. */\n className?: string | undefined;\n /** Visual emphasis; defaults to matching toast.type, with error mapped to danger. */\n tone?: ToastTone | undefined;\n /** Localized accessible name for default dismissal control. */\n closeLabel?: string | undefined;\n /** Classes for default parts; custom children own their part classes. */\n classNames?: ClassNames<\"content\" | \"title\" | \"description\" | \"action\" | \"close\"> | undefined;\n};\nexport type ToastViewportProps<Data extends object = Record<string, unknown>> = Omit<\n Base.Viewport.Props,\n \"className\"\n> & {\n /** Extra classes for viewport. */\n className?: string | undefined;\n /** Logical screen corner; inline participates in surrounding layout without a portal. */\n placement?: ToastPlacement | undefined;\n /** Theme-scoped portal host; defaults to document.body for fixed placements. */\n container?: Base.Portal.Props[\"container\"];\n /** Custom renderer for each message; defaults to a complete Toast with all parts. */\n renderToast?: ((toast: ToastObject<Data>) => ReactNode) | undefined;\n};\n\nexport function createToastManager<\n Data extends object = Record<string, unknown>,\n>(): ToastManager<Data> {\n return Base.createToastManager<Data>();\n}\n\nexport function useToastManager<\n Data extends object = Record<string, unknown>,\n>(): UseToastManagerReturnValue<Data> {\n return Base.useToastManager<Data>();\n}\n\nfunction ToastContent({ className, ...props }: ToastContentProps) {\n return <Base.Content {...props} className={clsx(\"kb-toast-content\", className)} />;\n}\n\nfunction ToastTitle({ className, ...props }: ToastTitleProps) {\n return <Base.Title {...props} className={clsx(\"kb-toast-title\", className)} />;\n}\n\nfunction ToastDescription({ className, ...props }: ToastDescriptionProps) {\n return <Base.Description {...props} className={clsx(\"kb-toast-description\", className)} />;\n}\n\nfunction ToastAction({ className, ...props }: ToastActionProps) {\n return <Base.Action {...props} className={clsx(\"kb-toast-action\", className)} />;\n}\n\nfunction ToastClose({ className, ...props }: ToastCloseProps) {\n return (\n <Base.Close\n aria-label=\"Dismiss notification\"\n aria-hidden={false}\n {...props}\n className={clsx(\"kb-toast-close\", className)}\n />\n );\n}\n\nfunction toastTone(type: string | undefined): ToastTone {\n if (type === \"error\") return \"danger\";\n if (type === \"loading\") return \"info\";\n return type === \"info\" || type === \"success\" || type === \"warning\" || type === \"danger\"\n ? type\n : \"neutral\";\n}\n\nfunction ToastRoot<Data extends object = Record<string, unknown>>({\n toast,\n tone = toastTone(toast.type),\n closeLabel = \"Dismiss notification\",\n classNames,\n className,\n children,\n ...props\n}: ToastProps<Data>) {\n return (\n <Base.Root {...props} toast={toast} {...kb(\"toast\", { tone }, className)}>\n {children === undefined ? (\n <>\n <ToastContent className={classNames?.content}>\n <ToastTitle className={classNames?.title}>\n {toast.title ?? toast.description}\n </ToastTitle>\n {toast.title != null && <ToastDescription className={classNames?.description} />}\n <ToastAction className={classNames?.action} />\n </ToastContent>\n <ToastClose className={classNames?.close} aria-label={closeLabel}>\n <span aria-hidden=\"true\">×</span>\n </ToastClose>\n </>\n ) : (\n children\n )}\n </Base.Root>\n );\n}\n\nfunction ToastViewport<Data extends object = Record<string, unknown>>({\n placement = \"bottom-end\",\n container,\n renderToast,\n className,\n children,\n ...props\n}: ToastViewportProps<Data>) {\n const { toasts } = useToastManager<Data>();\n const viewport = (\n <Base.Viewport {...props} {...kb(\"toast-viewport\", { placement }, className)}>\n {children === undefined\n ? toasts.map((toast) =>\n renderToast ? renderToast(toast) : <ToastRoot key={toast.id} toast={toast} />,\n )\n : children}\n </Base.Viewport>\n );\n return placement === \"inline\" ? (\n viewport\n ) : (\n <Base.Portal container={container}>{viewport}</Base.Portal>\n );\n}\n\nexport const Toast = Object.assign(ToastRoot, {\n Provider: Base.Provider,\n Viewport: ToastViewport,\n Content: ToastContent,\n Title: ToastTitle,\n Description: ToastDescription,\n Action: ToastAction,\n Close: ToastClose,\n});\n","import { Toolbar as Base } from \"@base-ui/react/toolbar\";\nimport { clsx } from \"clsx\";\nimport { Button, type ButtonVariant } from \"../Button/Button\";\n\n/** One tab stop for a row of actions; arrow keys move between them. Name it with aria-label. */\nexport type ToolbarProps = Omit<Base.Root.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type ToolbarGroupProps = Omit<Base.Group.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\nexport type ToolbarButtonProps = Omit<Base.Button.Props, \"className\" | \"render\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n /** Button weight; toolbars default to ghost. */\n variant?: ButtonVariant;\n};\nexport type ToolbarSeparatorProps = Omit<Base.Separator.Props, \"className\"> & {\n /** Plain class string; Base UI's function form is not supported. */\n className?: string;\n};\n\nfunction ToolbarRoot({ className, ...props }: ToolbarProps) {\n return <Base.Root {...props} className={clsx(\"kb-toolbar\", className)} />;\n}\n\nfunction ToolbarGroup({ className, ...props }: ToolbarGroupProps) {\n return <Base.Group {...props} className={clsx(\"kb-toolbar-group\", className)} />;\n}\n\nfunction ToolbarButton({ variant = \"ghost\", className, ...props }: ToolbarButtonProps) {\n return (\n <Base.Button\n {...props}\n render={<Button variant={variant} size=\"sm\" {...(className ? { className } : {})} />}\n />\n );\n}\n\nfunction ToolbarSeparator({ className, ...props }: ToolbarSeparatorProps) {\n return <Base.Separator {...props} className={clsx(\"kb-toolbar-separator\", className)} />;\n}\n\nexport const Toolbar = Object.assign(ToolbarRoot, {\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Separator: ToolbarSeparator,\n});\n","import { Tooltip as Base } from \"@base-ui/react/tooltip\";\nimport { clsx } from \"clsx\";\nimport type { ReactElement, ReactNode, Ref } from \"react\";\n\n/** A visual hint only; the trigger still needs its own accessible name. */\nexport type TooltipProps = {\n /** Text shown in the popup. */\n content: ReactNode;\n /** The element that shows the tooltip on hover and focus. */\n children: ReactElement;\n /** Portal target for nested consumer themes. */\n container?: Base.Portal.Props[\"container\"];\n /** Plain class on popup slot. */\n className?: string;\n /** Side of the trigger the popup prefers. */\n side?: Base.Positioner.Props[\"side\"];\n /** Hover delay in ms before opening. */\n delay?: number;\n /** Ref forwarded to the popup element. */\n ref?: Ref<HTMLDivElement>;\n};\n\nexport function Tooltip({\n content,\n children,\n side = \"top\",\n delay = 400,\n container,\n className,\n ref,\n}: TooltipProps) {\n return (\n <Base.Root>\n <Base.Trigger delay={delay} render={children} />\n <Base.Portal container={container}>\n <Base.Positioner side={side} sideOffset={6}>\n <Base.Popup ref={ref} className={clsx(\"kb-tooltip\", className)}>\n {content}\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n </Base.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAgB6C,EAAkD,EAChE,gBACA,UACA,aAC+B;CAC/B,IAAMC,IAAU,CAACC,EAAM,QAAQ,CAACC,EAAY;CAC5C,OAAOC,EAAU;EACf,OAAO;GACL,GAAGD;GAEH,OAAOF,KAAWE,EAAY;EAChC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