@amberstack/comp-lib 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/amberstack.css +2 -0
- package/dist/components/Accordion/Accordion.d.ts +18 -0
- package/dist/components/Accordion/AccordionContext.d.ts +10 -0
- package/dist/components/Accordion/AccordionItem.d.ts +11 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/ActivityItem/ActivityItem.d.ts +15 -0
- package/dist/components/ActivityItem/index.d.ts +1 -0
- package/dist/components/AreaChart/AreaChart.d.ts +4 -0
- package/dist/components/AreaChart/index.d.ts +1 -0
- package/dist/components/AssetField/AssetField.d.ts +26 -0
- package/dist/components/AssetField/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +19 -0
- package/dist/components/Avatar/AvatarContext.d.ts +3 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Banner/Banner.d.ts +18 -0
- package/dist/components/Banner/index.d.ts +1 -0
- package/dist/components/BarChart/BarChart.d.ts +25 -0
- package/dist/components/BarChart/index.d.ts +1 -0
- package/dist/components/BlockHeader/BlockHeader.d.ts +22 -0
- package/dist/components/BlockHeader/index.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +9 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.d.ts +11 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +16 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Calendar/Calendar.d.ts +49 -0
- package/dist/components/Calendar/CalendarDay.d.ts +25 -0
- package/dist/components/Calendar/CalendarHeader.d.ts +27 -0
- package/dist/components/Calendar/DateTriggerInternal.d.ts +30 -0
- package/dist/components/Calendar/dateUtils.d.ts +95 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Calendar/useDatePopup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +10 -0
- package/dist/components/Card/CardFooter.d.ts +8 -0
- package/dist/components/Card/CardHeader.d.ts +14 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/CatalogCard/CatalogCard.d.ts +18 -0
- package/dist/components/CatalogCard/index.d.ts +1 -0
- package/dist/components/ChartCard/ChartCard.d.ts +30 -0
- package/dist/components/ChartCard/index.d.ts +1 -0
- package/dist/components/ChartCore/ChartAxes.d.ts +24 -0
- package/dist/components/ChartCore/ChartDataTable.d.ts +19 -0
- package/dist/components/ChartCore/ChartFrame.d.ts +11 -0
- package/dist/components/ChartCore/ChartHoverLayer.d.ts +21 -0
- package/dist/components/ChartCore/chartPlayHelpers.d.ts +11 -0
- package/dist/components/ChartCore/index.d.ts +10 -0
- package/dist/components/ChartCore/paths.d.ts +23 -0
- package/dist/components/ChartCore/scales.d.ts +40 -0
- package/dist/components/ChartCore/series.d.ts +4 -0
- package/dist/components/ChartCore/types.d.ts +38 -0
- package/dist/components/ChartCore/useChartHover.d.ts +25 -0
- package/dist/components/ChartCore/useChartSize.d.ts +6 -0
- package/dist/components/ChartLegend/ChartLegend.d.ts +20 -0
- package/dist/components/ChartLegend/ChartLegendItem.d.ts +19 -0
- package/dist/components/ChartLegend/index.d.ts +4 -0
- package/dist/components/ChartLegend/legendHelpers.d.ts +20 -0
- package/dist/components/ChartLegend/useLegendState.d.ts +10 -0
- package/dist/components/ChartTooltip/ChartTooltip.d.ts +20 -0
- package/dist/components/ChartTooltip/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/ChecklistItem/ChecklistItem.d.ts +14 -0
- package/dist/components/ChecklistItem/index.d.ts +1 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +32 -0
- package/dist/components/CommandPalette/CommandPaletteItem.d.ts +14 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +27 -0
- package/dist/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/components/ContentRow/ContentRow.d.ts +20 -0
- package/dist/components/ContentRow/index.d.ts +1 -0
- package/dist/components/CredentialRow/CredentialRow.d.ts +18 -0
- package/dist/components/CredentialRow/index.d.ts +1 -0
- package/dist/components/DataTable/DataTable.d.ts +115 -0
- package/dist/components/DataTable/index.d.ts +1 -0
- package/dist/components/DataTable/useControllable.d.ts +2 -0
- package/dist/components/DateField/DateField.d.ts +4 -0
- package/dist/components/DateField/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +42 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +87 -0
- package/dist/components/DateRangePicker/DateRangePresets.d.ts +24 -0
- package/dist/components/DateRangePicker/DateRangeTrigger.d.ts +10 -0
- package/dist/components/DateRangePicker/index.d.ts +3 -0
- package/dist/components/Dialog/Dialog.d.ts +23 -0
- package/dist/components/Dialog/DialogBody.d.ts +4 -0
- package/dist/components/Dialog/DialogFooter.d.ts +4 -0
- package/dist/components/Dialog/DialogHeader.d.ts +15 -0
- package/dist/components/Dialog/dialogContext.d.ts +23 -0
- package/dist/components/Dialog/index.d.ts +5 -0
- package/dist/components/Dialog/useModalBehaviour.d.ts +27 -0
- package/dist/components/Divider/Divider.d.ts +10 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/DonutChart/DonutChart.d.ts +20 -0
- package/dist/components/DonutChart/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +21 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +32 -0
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +13 -0
- package/dist/components/DropdownMenu/DropdownMenuContext.d.ts +5 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.d.ts +16 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.d.ts +4 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.d.ts +4 -0
- package/dist/components/DropdownMenu/index.d.ts +5 -0
- package/dist/components/EmptyState/EmptyState.d.ts +14 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EnvironmentLabel/EnvironmentLabel.d.ts +10 -0
- package/dist/components/EnvironmentLabel/index.d.ts +1 -0
- package/dist/components/Field/Field.d.ts +26 -0
- package/dist/components/Field/FieldContext.d.ts +17 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Field/useFieldControl.d.ts +34 -0
- package/dist/components/Filters/FilterBar.d.ts +9 -0
- package/dist/components/Filters/FilterChip.d.ts +18 -0
- package/dist/components/Filters/FilterMenu.d.ts +37 -0
- package/dist/components/Filters/index.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts +16 -0
- package/dist/components/IconButton/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +14 -0
- package/dist/components/Input/LockedTagInternal.d.ts +2 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/KPI/KPI.d.ts +24 -0
- package/dist/components/KPI/index.d.ts +1 -0
- package/dist/components/KPIGraph/KPIGraph.d.ts +12 -0
- package/dist/components/KPIGraph/index.d.ts +1 -0
- package/dist/components/Kbd/Kbd.d.ts +4 -0
- package/dist/components/Kbd/index.d.ts +1 -0
- package/dist/components/Label/Label.d.ts +14 -0
- package/dist/components/Label/index.d.ts +1 -0
- package/dist/components/LineChart/LineChart.d.ts +4 -0
- package/dist/components/LineChart/SeriesChartInternal.d.ts +30 -0
- package/dist/components/LineChart/index.d.ts +2 -0
- package/dist/components/Link/Link.d.ts +20 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/MediaTile/MediaTile.d.ts +13 -0
- package/dist/components/MediaTile/index.d.ts +1 -0
- package/dist/components/Menu/Menu.d.ts +7 -0
- package/dist/components/Menu/MenuItem.d.ts +20 -0
- package/dist/components/Menu/index.d.ts +3 -0
- package/dist/components/Menu/usePopup.d.ts +46 -0
- package/dist/components/MetricCard/MetricCard.d.ts +26 -0
- package/dist/components/MetricCard/index.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +42 -0
- package/dist/components/MultiSelect/index.d.ts +1 -0
- package/dist/components/NavGroup/NavGroup.d.ts +17 -0
- package/dist/components/NavGroup/index.d.ts +1 -0
- package/dist/components/NavItem/NavItem.d.ts +28 -0
- package/dist/components/NavItem/index.d.ts +1 -0
- package/dist/components/NodeGraph/GraphNode.d.ts +15 -0
- package/dist/components/NodeGraph/NodeGraph.d.ts +34 -0
- package/dist/components/NodeGraph/index.d.ts +2 -0
- package/dist/components/NodeReference/NodeReference.d.ts +12 -0
- package/dist/components/NodeReference/index.d.ts +1 -0
- package/dist/components/NumberField/NumberField.d.ts +28 -0
- package/dist/components/NumberField/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +20 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +21 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/PickerItem/PickerItem.d.ts +14 -0
- package/dist/components/PickerItem/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +24 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/ProposedNote/ProposedNote.d.ts +9 -0
- package/dist/components/ProposedNote/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +11 -0
- package/dist/components/Radio/RadioGroup.d.ts +22 -0
- package/dist/components/Radio/RadioGroupContext.d.ts +11 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/RangeTabs/RangeTabs.d.ts +21 -0
- package/dist/components/RangeTabs/Segment.d.ts +7 -0
- package/dist/components/RangeTabs/index.d.ts +2 -0
- package/dist/components/ResourceCard/ResourceCard.d.ts +29 -0
- package/dist/components/ResourceCard/index.d.ts +1 -0
- package/dist/components/RichTextField/RichTextField.d.ts +26 -0
- package/dist/components/RichTextField/RichTextTool.d.ts +9 -0
- package/dist/components/RichTextField/RichTextToolbar.d.ts +12 -0
- package/dist/components/RichTextField/index.d.ts +4 -0
- package/dist/components/RichTextField/richTextCommands.d.ts +18 -0
- package/dist/components/ScatterPlot/ScatterPlot.d.ts +41 -0
- package/dist/components/ScatterPlot/index.d.ts +1 -0
- package/dist/components/Search/Search.d.ts +15 -0
- package/dist/components/Search/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/useListbox.d.ts +38 -0
- package/dist/components/SetupStep/SetupStep.d.ts +18 -0
- package/dist/components/SetupStep/index.d.ts +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +17 -0
- package/dist/components/Sidebar/SidebarBrand.d.ts +11 -0
- package/dist/components/Sidebar/SidebarUser.d.ts +13 -0
- package/dist/components/Sidebar/index.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.d.ts +12 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/SortableRow/SortableRow.d.ts +24 -0
- package/dist/components/SortableRow/index.d.ts +1 -0
- package/dist/components/Sparkline/Sparkline.d.ts +18 -0
- package/dist/components/Sparkline/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +10 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Status/Status.d.ts +8 -0
- package/dist/components/Status/index.d.ts +1 -0
- package/dist/components/StatusIcon/StatusIcon.d.ts +13 -0
- package/dist/components/StatusIcon/index.d.ts +1 -0
- package/dist/components/Stepper/Step.d.ts +19 -0
- package/dist/components/Stepper/Stepper.d.ts +28 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/SwitchField/SwitchField.d.ts +10 -0
- package/dist/components/SwitchField/index.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +9 -0
- package/dist/components/Table/TableCell.d.ts +10 -0
- package/dist/components/Table/TableCellActions.d.ts +11 -0
- package/dist/components/Table/TableCellCheckbox.d.ts +7 -0
- package/dist/components/Table/TableCellNumber.d.ts +11 -0
- package/dist/components/Table/TableCellStatus.d.ts +4 -0
- package/dist/components/Table/TableCellText.d.ts +7 -0
- package/dist/components/Table/TableCellTwoLine.d.ts +9 -0
- package/dist/components/Table/TableCellUser.d.ts +11 -0
- package/dist/components/Table/TableContext.d.ts +3 -0
- package/dist/components/Table/TableFooter.d.ts +9 -0
- package/dist/components/Table/TableHeaderCell.d.ts +17 -0
- package/dist/components/Table/TableHeaderRow.d.ts +4 -0
- package/dist/components/Table/TableRow.d.ts +7 -0
- package/dist/components/Table/TableToolbar.d.ts +13 -0
- package/dist/components/Table/index.d.ts +14 -0
- package/dist/components/Table/storyHelpers.d.ts +12 -0
- package/dist/components/Tabs/Tab.d.ts +9 -0
- package/dist/components/Tabs/TabList.d.ts +4 -0
- package/dist/components/Tabs/TabPanel.d.ts +7 -0
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/TabsContext.d.ts +12 -0
- package/dist/components/Tabs/index.d.ts +4 -0
- package/dist/components/Textarea/Textarea.d.ts +9 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +23 -0
- package/dist/components/Toast/ToastProvider.d.ts +12 -0
- package/dist/components/Toast/ToastStack.d.ts +11 -0
- package/dist/components/Toast/index.d.ts +4 -0
- package/dist/components/Toast/useToast.d.ts +25 -0
- package/dist/components/Toggle/Toggle.d.ts +14 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/useAnchoredPosition.d.ts +13 -0
- package/dist/components/TopBar/ContextSwitcher.d.ts +10 -0
- package/dist/components/TopBar/TopBar.d.ts +9 -0
- package/dist/components/TopBar/TopBarSeparator.d.ts +4 -0
- package/dist/components/TopBar/index.d.ts +3 -0
- package/dist/components/UnavailableState/UnavailableState.d.ts +18 -0
- package/dist/components/UnavailableState/index.d.ts +1 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +6774 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cx.d.ts +2 -0
- package/package.json +87 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["styles","item","heading","header","panel","styles","sm","md","lg","image","dot","success","warning","danger","info","neutral","pending","ICON_SIZE","styles","group","item","styles","item","text","summary","meta","styles","svg","line","marker","bar","srOnly","marks","grid","label","styles","styles","chartMarks","chartMarks","empty","styles","item","chip","toggle","swatch","label","_Fragment","styles","legend","styles","tooltip","title","row","name","value","styles","defaultFormatValue","formatValue","chartMarks","button","md","sm","primary","secondary","ghost","danger","styles","field","header","label","box","empty","error","image","text","title","description","input","styles","md","sm","primary","secondary","danger","styles","dismissible","icon","content","title","body","action","dismiss","info","accent","success","warning","danger","production","TONE_ICONS","styles","GAP","defaultFormatValue","formatValue","chartMarks","header","kind","title","meta","error","grip","styles","list","separator","styles","_Fragment","link","md","sm","disabled","ICON_SIZE","styles","item","current","separator","styles","calendar","cell","number","disabled","styles","header","label","styles","styles","card","md","lg","styles","end","styles","text","title","description","actions","styles","card","header","tile","names","title","subtitle","description","footer","styles","selected","styles","styles","card","header","title","subtitle","styles","root","control","input","box","text","label","description","disabled","styles","sm","md","styles","item","icon","text","title","detail","pending","styles","backdrop","panel","sm","md","styles","header","text","title","description","styles","body","styles","footer","styles","item","active","icon","label","styles","search","input","list","group","status","visuallyHidden","_Fragment","styles","status","dot","success","warning","danger","info","neutral","pending","styles","row","names","title","subtitle","styles","row","icon","names","name","reference","meta","styles","menu","styles","item","disabled","active","label","shortcut","check","danger","styles","VIEWPORT_MARGIN","TYPE_AHEAD_RESET_MS","TriggerSlot","_Fragment","label","styles","separator","styles","icon","title","description","action","styles","chip","field","value","styles","control","invalid","field","disabled","icon","input","clear","control","styles","title","options","count","footer","styles","bar","styles","pagination","controls","current","styles","text","circle","styles","styles","cell","left","right","center","button","visuallyHidden","styles","row","styles","row","selected","styles","left","right","styles","text","styles","styles","user","styles","styles","actions","styles","toolbar","title","search","styles","footer","count","styles","message","visuallyHidden","styles","control","control","trigger","open","value","placeholder","clear","control","styles","popup","_Fragment","styles","presets","label","check","styles","popup","body","footer","actions","_Fragment","styles","horizontal","vertical","label","styles","_Fragment","GAP","defaultFormatValue","styles","chartMarks","formatValue","right","left","panel","styles","styles","header","label","labelDisabled","meta","styles","card","label","figure","value","meta","arrow","neutral","styles","accent","neutral","INSET","DOT_RADIUS","defaultFormatValue","styles","chartMarks","formatValue","card","_Fragment","styles","styles","label","neutral","accent","success","warning","danger","styles","tile","selected","name","meta","styles","icon","title","description","styles","card","label","value","meta","styles","trigger","value","list","styles","_Fragment","control","selectStyles","group","toggle","styles","item","icon","label","count","active","disabled","styles","_Fragment","icon","name","dot","healthy","degraded","offline","styles","styles","chartMarks","name","styles","root","input","stepper","control","styles","text","overline","title","description","styles","item","tile","text","title","description","styles","clamp","GAP","_Fragment","styles","header","label","value","warning","danger","meta","styles","body","styles","root","text","label","description","disabled","styles","label","horizontal","styles","header","tile","title","label","footer","styles","disabled","styles","styles","fieldStyles","styles","defaultFormatValue","formatValue","chartMarks","_Fragment","control","styles","step","done","text","title","description","styles","styles","text","name","description","icon","styles","text","name","icon","styles","text","title","styles","success","warning","danger","neutral","styles","text","label","styles","styles","styles","root","styles","styles","styles","styles","styles","control","styles","icon","styles","styles","_Fragment","styles","styles","styles","styles","CIRCLE","iconPaths","iconNames","Icon","props","size","name","label","cx","classes","AccordionContext","createContext","useAccordionContext","context","useContext","Accordion_module_default","Accordion","forwardRef","innerValue","setInnerValue","useState","defaultValue","openValues","value","useMemo","isOpen","item","others","mode","open","next","onChange","headingLevel","className","AccordionItem_module_default","AccordionItem","id","useId","Heading","headerId","panelId","handleKeyDown","root","event","headers","index","target","toggle","title","AvatarSizeContext","Avatar_module_default","ICON_SIZE$2","Avatar","groupSize","resolvedSize","failedSrc","setFailedSrc","showImage","src","accessibleName","status","statusLabel","initials","AvatarGroup_module_default","AvatarGroup","count","avatars","Children","children","visible","max","overflow","avatar","overflowLabel","ActivityItem_module_default","ActivityItem","actor","action","meta","MAX_SERIES","clamp","min","linearScale","span","domain","range","niceTicks","top","rawStep","magnitude","step","multiple","candidate","first","last","i","formatTicks","compact","ticks","tick","formatValue","thinTickIndexes","every","minSpacing","spacing","estimateTextWidth","text","seriesLabels","series","longest","p","lastRecordedIndex","values","hasSeriesData","point","seriesValues","foldSeries","kept","rest","points","sum","otherName","foldSegments","segments","otherLabel","segment","placeTooltip","reach","anchor","right","gap","left","tooltip","bounds","round","runs","result","current","linePath","run","tail","areaPath","baselineY","barPath","long","direction","height","width","r","radius","x0","y0","x1","y1","x","y","polar","angle","cy","arcPath","end","start","mid","outer","inner","trim","o0","o1","i0","i1","large","marks_module_default","COLOR_CLASSES","seriesColorClass","assignRef","ref","node","useChartSize","setWidth","observer","useRef","useCallback","entry","forwardedRef","useChartHover","active","setActive","source","setSource","activeIndex","fromPointer","rect","locate","ChartAxes_module_default","ChartAxes","yTicks","grid","plot","categoryY","leftBaseline","xTicks","ChartHoverLayer_module_default","PLOT_ROLE","ChartHoverLayer","slot","useLayoutEffect","element","layer","layerRect","boundsRect","offsetX","offsetY","place","style","hover","announcement","ChartDataTable","caption","columns","column","rows","row","cell","ChartFrame_module_default","ChartFrame","empty","emptyMessage","ChartLegendItem_module_default","ChartLegendItem","content","Fragment","colorIndex","seriesHidden","isolated","onToggle","onOnly","onlyLabel","legendChips","chip","items","toggleHidden","memberIds","hidden","allIds","isolateHidden","useLegendState","internal","setInternal","defaultHiddenIds","hiddenIds","onHiddenChange","ChartLegend_module_default","ChartLegend","ariaLabel","setHidden","canIsolate","interactive","ChartTooltip_module_default","ChartTooltip","MARKER_RADIUS","LABEL_MIN_GAP","MAX_LABELLED_SERIES","SeriesChartInternal","formatValue$5","sizeRef","hiddenSeries","defaultHiddenSeries","onHiddenSeriesChange","folded","shown","labels","tickLabels","ends","showLabels","showEndMarkers","labelRoom","xAt","yAt","activePoints","recorded","placedLabels","endLabels","a","b","placed","wash","AreaChart","Button_module_default","Button","variant","leadingIcon","trailingIcon","AssetField_module_default","AssetField","inputRef","descriptionId","file","onFileSelect","hint","state","description","inputLabel","actionLabel","IconButton_module_default","IconButton","icon","Banner_module_default","TONE_ICONS$1","Banner","tone","onDismiss","dismissLabel","MAX_BAR","GAP$3","RADIUS","BarChart","formatValue$4","horizontal","type","stacked","valueAt","stackTotal","extents","lastTick","categoryRoom","valueRoom","bandSize","bandStart","toPixel","zero","slots","thickness","bars","parts","bottom","isFirst","partIndex","isLast","barHeight","offset","length","d","barLabels","only","centre","position","peak","bar","BlockHeader_module_default","BlockHeader","kind","onAction","onMore","moreLabel","Breadcrumb_module_default","Breadcrumb","expanded","setExpanded","listRef","isValidElement","tailCount","maxItems","collapsed","hiddenCount","renderItem","cloneElement","expandLabel","Link_module_default","\"default\"","ICON_SIZE$1","Link","external","behaviour","disabled","rel","newTabLabel","BreadcrumbItem_module_default","BreadcrumbItem","href","separator","Calendar_module_default","CalendarDay_module_default","MS_PER_DAY","WEEKS_IN_GRID","DAYS_IN_WEEK","dayNumber","date","startOfDay","isSameDay","isSameMonth","compareDays","daysBetween","rangeLength","addDays","amount","addMonths","firstOfTarget","lastDay","addYears","startOfMonth","endOfMonth","startOfWeek","weekStartsOn","endOfWeek","monthWeeks","month","week","day","weekdayDates","clampDay","isDayDisabled","isDateDisabled","sortRange","fitsLength","minDays","maxDays","createEndDateTest","limits","edge","crossesDisabled","allowDisabledInRange","distance","side","walked","isRangeAllowed","toISODay","formatters","dateFormat","key","locale","options","format","formatShortDate","formatLongDate","formatFullDate","formatMonthLabel","formatWeekday","formatDayNumber","formatRangeText","CalendarDay","rangeEnds","rangeStart","rangeEnd","filled","selected","preview","inAnyRange","inRange","today","outsideMonth","onClick","CalendarHeader_module_default","CalendarHeader","hidePrevious","previousLabel","previousDisabled","onPrevious","labelId","hideNext","nextLabel","nextDisabled","onNext","paintedRange","rangePreview","Calendar","monthProp","todayProp","months","baseId","now","innerMonth","setInnerMonth","defaultMonth","firstMonth","focused","setFocused","rootRef","pendingFocus","autoFocusDay","shownMonths","lastDayShown","isShown","currentDay","showMonth","onMonthChange","moveTo","onGridKeyDown","moves","move","choose","stepMonth","painted","shownMonth","previousMonthLabel","nextMonthLabel","showOutsideDays","isStart","isEnd","isBetween","onDayPreview","Card_module_default","Card","Component","padding","CardFooter_module_default","CardFooter","align","CardHeader_module_default","CardHeader","actions","CatalogCard_module_default","CatalogCard","subtitle","secondaryAction","primaryAction","Segment_module_default","Segment","tabIndex","RangeTabs_module_default","MOVES","RangeTabsInner","enabled","option","tabStop","optionValue","group","RangeTabs","ChartCard_module_default","ChartCard","titleId","ranges","rangeValue","defaultRangeValue","onRangeChange","rangeLabel","Checkbox_module_default","Checkbox","ariaLabelledBy","ariaDescribedBy","useEffect","indeterminate","Spinner_module_default","Spinner","ChecklistItem_module_default","RESULT_ICON","RESULT_LABEL","ChecklistItem","detail","resultLabel","DialogContext","useDialogContext","useDialogLabels","hasTitle","setHasTitle","hasDescription","setHasDescription","registerLabel","setPresent","onClose","dismissible","close","FOCUSABLE_SELECTOR","getFocusableElements","container","modalStack","scrollLocks","bodyOverflow","bodyPaddingRight","lockBodyScroll","scrollbarWidth","unlockBodyScroll","useModalBehaviour","latest","token","isTop","dismiss","previouslyFocused","containerRef","initialFocusRef","trapTab","inContainer","focusable","onKeyDown","pressStart","onPointerDown","backdrop","backdropRef","useOverlayOpen","internalOpen","setInternalOpen","defaultOpen","Dialog_module_default","Dialog","panelRef","useImperativeHandle","createPortal","labelProps","DialogHeader_module_default","DialogHeader","fallbackId","handleClose","hideClose","closeLabel","DialogBody_module_default","DialogBody","DialogFooter_module_default","DialogFooter","CommandPaletteItem_module_default","CommandPaletteItem","onSelect","onMouseDown","CommandPalette_module_default","PaletteContent","query","setQuery","setActiveIndex","listId","optionId","activeRef","matches","term","commands","command","groups","byName","ordered","hasResults","searchLabel","onRun","resultsLabel","CommandPalette","ConfirmDialog","confirmRef","cancelRef","cancel","onCancel","confirm","onConfirm","cancelLabel","confirmLabel","Status_module_default","Status","ContentRow_module_default","ContentRow","tags","statusTone","updated","CredentialRow_module_default","CredentialRow","reference","valueState","Menu_module_default","Menu","MenuItem_module_default","MenuItem","danger","leading","shortcut","VIEWPORT_MARGIN$1","popupStyle","usePopup","triggerRef","popupRef","reposition","trigger","popup","matchTriggerWidth","roomBelow","roomAbove","above","room","shownHeight","wantedLeft","placement","maxLeft","closeOnEscape","DropdownMenuContext","ITEM_SELECTOR","TYPE_AHEAD_RESET_MS$1","TriggerSlot$1","triggerProps","own","DropdownMenu","innerOpen","setInnerOpen","triggerId","menuId","initialFocus","typed","setOpenState","onOpenChange","closeAndFocus","focusAt","buffer","repeated","letter","search","DropdownMenuCheckboxItem","innerChecked","setInnerChecked","defaultChecked","isChecked","checked","onCheckedChange","onMouseEnter","DropdownMenuItem","menu","DropdownMenuLabel_module_default","DropdownMenuLabel","DropdownMenuSeparator_module_default","DropdownMenuSeparator","EmptyState_module_default","EmptyState","FilterChip_module_default","FilterChip","addLabel","field","onRemove","removeLabel","FieldContext","useFieldControl","describedBy","control_module_default","Search_module_default","Search","clear","input","onClear","clearLabel","FilterMenu_module_default","FilterMenu","needle","update","searchable","searchPlaceholder","noMatchesLabel","onApply","applyLabel","FilterBar_module_default","FilterBar","onClearAll","clearAllLabel","Pagination_module_default","pageEntries","page","pageCount","unique","entries","Pagination","number","innerPage","setInnerPage","defaultPage","go","onPageChange","summary","pageLabel","Skeleton_module_default","DEFAULT_WIDTH","DEFAULT_HEIGHT","Skeleton","resolvedWidth","resolvedHeight","TableDensityContext","Table_module_default","Table","density","TableHeaderCell_module_default","SORT_ICON","ARIA_SORT","TableHeaderCell","hideLabel","sort","onSort","TableHeaderRow_module_default","TableHeaderRow","TableRow_module_default","TableRow","TableCell_module_default","TableCell","TableCellText_module_default","TableCellText","mono","TableCellTwoLine_module_default","TableCellTwoLine","primary","secondary","TableCellStatus","TableCellUser_module_default","TableCellUser","TableCellNumber_module_default","TableCellNumber","TableCellActions_module_default","TableCellActions","TableCellCheckbox","TableToolbar_module_default","TableToolbar","filterAction","TableFooter_module_default","TableFooter","pagination","useControllable","setInner","initial","set","controlled","DataTable_module_default","compareValues","nextSort","columnId","optionsFor","counts","filter","FilterPicker","wrapper","filters","onPress","onPick","DataTableInner","sortProp","filterValuesProp","searchProp","pageProp","selectedProp","setSort","defaultSort","onSortChange","filterValues","setFilterValues","defaultFilterValues","onFilterValuesChange","setSearch","defaultSearch","onSearchChange","setPage","setSelected","defaultSelectedRowIds","onSelectedRowIdsChange","searchRef","filterButtonWrapper","openFilterId","setOpenFilterId","closePopup","reason","returnFocus","openFilter","filterId","focusPopup","onPopupKeyDown","hasFilters","isFiltered","visibleRows","searchText","getSearchText","matched","accessor","factor","pageSize","currentPage","firstIndex","pageRows","pageIds","getRowId","selectedOnPage","changeFilterValues","applyFilter","focusFilterButton","clearFilters","toggleRow","toggleAll","headerSort","activeFilters","inactiveFilters","openedFilter","columnCount","isEmpty","loading","hasNoResults","countText","itemLabel","selectable","rowIndex","emptyTitle","emptyDescription","emptyAction","noResultsTitle","noResultsDescription","isSelected","getRowLabel","DataTable","LockedTag","Input","readOnly","DateField","DateTriggerInternal_module_default","DateTriggerInternal","showClear","clearable","anchorRef","popupId","placeholder","useDatePopup","buttonRef","focusTrigger","DatePicker_module_default","DatePicker","setOpen","commit","popupLabel","DateRangePresets_module_default","isSameRange","second","DateRangePresets","presets","preset","isRangeDisabled","DateRangeTrigger","DateRangePicker_module_default","defaultLabels","EMPTY_RANGE","draftFrom","DateRangePicker","labelsProp","committed","draft","setDraft","viewMonth","setViewMonth","setAnnouncement","inProgress","requireApply","cancelMessage","choosingEnd","canEndAt","isDayBlocked","openPopup","finish","settle","onDayChosen","onPresetSelected","sorted","onTriggerClick","onTriggerKeyDown","helper","hasLengthLimit","explainsDisabled","Divider_module_default","Divider","orientation","DonutChart_module_default","GAP$2","TAU","DonutChart","formatValue$3","positive","total","share","cursor","arcs","found","arc","activeArc","shareLabel","centerLabel","Drawer_module_default","Drawer","EnvironmentLabel_module_default","EnvironmentLabel","Field_module_default","Field","generatedId","controlId","messageId","hasError","error","hasMessage","help","locked","required","KPI_module_default","DEFAULT_INTENT","DEFAULT_TREND_LABEL","KPI","intent","trendIntent","trend","unit","trendLabel","Sparkline_module_default","INSET$1","DOT_RADIUS$1","Sparkline","formatValue$2","data","lastIndex","toneClass","KPIGraph_module_default","WIDTH","HEIGHT","INSET","BAR_GAP","DOT_RADIUS","MIN_BAR_HEIGHT","Area","line","lastX","Bars","barWidth","KPIGraph","graph","graphLabel","jsx","Kbd_module_default","Kbd","Label_module_default","ICON_SIZE","Label","LineChart","MediaTile_module_default","MediaTile","UnavailableState_module_default","UnavailableState","linkLabel","linkHref","linkExternal","MetricCard_module_default","MetricCard","unavailableTitle","unavailableDescription","Select_module_default","TYPE_AHEAD_RESET_MS","PAGE_SIZE","useListbox","findEnabled","nextIndexForKey","stay","isPrintableKey","typeAheadIndex","char","MultiSelect_module_default","SELECT_ALL","checkIcons","RowCheck","MultiSelect","enabledValues","filtered","chosenCount","selectAllState","selectAllLabel","comboboxRef","filterRef","combobox","remove","onListKeyDown","isFilter","match","onComboboxKeyDown","labelFor","maxVisible","editable","filterLabel","emptyLabel","NavGroup_module_default","NavGroup","innerExpanded","setInnerExpanded","defaultExpanded","isCollapsible","collapsible","headingId","itemsId","onExpandedChange","NavItem_module_default","NavItem","shared","child","hasChildren","GraphNode_module_default","HEALTH_LABELS","GraphNode","healthText","healthLabel","health","NodeGraph_module_default","NODE_WIDTH","NODE_HEIGHT","MIN_SCALE","VIEWPORT_ROLE","NodeGraph","rightmost","nodes","naturalWidth","scale","contentWidth","scrolls","byId","edges","from","to","x2","y2","NodeReference_module_default","NodeReference","NumberField_module_default","PAGE_MULTIPLIER","decimalsOf","NumberField","inert","stepBy","decimals","steps","onBlur","decreaseLabel","increaseLabel","PageHeader_module_default","PageHeader","overline","docsHref","docsLabel","PickerItem_module_default","PickerItem","glyph","OPPOSITE","VIEWPORT_MARGIN","clamp$1","TriggerSlot","useAnchoredPosition","getAnchor","floating","floatingRef","viewportWidth","viewportHeight","fits","positions","arrowOffset","Popover_module_default","GAP$1","Popover","generatedTriggerId","generatedPanelId","latestOnOpenChange","panel","closeAndReturnFocus","ProgressBar_module_default","ProgressBar","metaId","clamped","showValue","ProposedNote_module_default","ProposedNote","Radio_module_default","RadioGroupContext","Radio","isDisabled","RadioGroup_module_default","RadioGroup","groupName","ResourceCard_module_default","ResourceCard","identifier","details","footer","footerIcon","blockTags","stateCommands","ALLOWED_TAGS","SAFE_URL","isSafeUrl","url","selectedLink","getActiveFormats","block","applyFormat","isActive","link","insertPlainText","cleanNode","attribute","sanitizeHtml","html","body","RichTextField_module_default","RichTextTool_module_default","RichTextTool","RichTextToolbar_module_default","tools","RichTextToolbar","focusIndex","setFocusIndex","targets","tool","activeFormats","onFormat","defaultRequestLinkUrl","RichTextField","editorRef","savedRange","initialValue","setActiveFormats","editor","refreshActive","previous","onSelectionChange","selection","emit","needsUrl","requestLinkUrl","onPaste","onDrop","MAX_SCATTER_SERIES","POINT_RADIUS","ACTIVE_RADIUS","HIT_DISTANCE","ScatterPlot","formatValue$1","limited","xTickValues","yTickValues","xTickLabels","yTickLabels","nearest","best","xLabel","yLabel","Select","selectedIndex","SetupStep_module_default","SetupStep","doneLabel","Sidebar_module_default","Sidebar","header","navLabel","pinned","SidebarBrand_module_default","SidebarBrand","SidebarUser_module_default","SidebarUser","role","SortableRow_module_default","SortableRow","moveUpLabel","onMoveUp","moveDownLabel","onMoveDown","StatusIcon_module_default","ICONS","SIZES","StatusIcon","Step_module_default","STATE_ICON","STATE_LABEL","Step","indicatorIcon","stateLabel","Stepper_module_default","Stepper","stateMeta","Toggle_module_default","Toggle","isOn","SwitchField_module_default","SwitchField","toggleId","TabsContext","useTabsContext","part","Tabs_module_default","idPart","Tabs","tab","TabList_module_default","TabList","adopt","Tab_module_default","Tab","selectedValue","tabId","select","list","tabs","TabPanel_module_default","TabPanel","Textarea_module_default","Textarea","Toast_module_default","TONE_ICONS","Toast","progress","ToastStack_module_default","ToastStack","ToastContext","useToast","DEFAULT_DURATION","ToastProvider","toasts","setToasts","nextId","timers","hovered","stackRef","timer","runTimer","toast","duration","syncTimers","paused","setHovered","_duration","Tooltip_module_default","HIDE_DELAY","GAP","Tooltip","tooltipId","tooltipRef","timerRef","schedule","nextOpen","wait","show","delay","hideNow","TopBar_module_default","TopBar","ContextSwitcher_module_default","ContextSwitcher","TopBarSeparator_module_default","TopBarSeparator"],"sources":["../src/icons/index.tsx","../src/lib/cx.ts","../src/components/Accordion/AccordionContext.ts","../src/components/Accordion/Accordion.module.css","../src/components/Accordion/Accordion.tsx","../src/components/Accordion/AccordionItem.module.css","../src/components/Accordion/AccordionItem.tsx","../src/components/Avatar/AvatarContext.ts","../src/components/Avatar/Avatar.module.css","../src/components/Avatar/Avatar.tsx","../src/components/Avatar/AvatarGroup.module.css","../src/components/Avatar/AvatarGroup.tsx","../src/components/ActivityItem/ActivityItem.module.css","../src/components/ActivityItem/ActivityItem.tsx","../src/components/ChartCore/scales.ts","../src/components/ChartCore/paths.ts","../src/components/ChartCore/marks.module.css","../src/components/ChartCore/series.ts","../src/components/ChartCore/useChartSize.ts","../src/components/ChartCore/useChartHover.ts","../src/components/ChartCore/ChartAxes.module.css","../src/components/ChartCore/ChartAxes.tsx","../src/components/ChartCore/ChartHoverLayer.module.css","../src/components/ChartCore/ChartHoverLayer.tsx","../src/components/ChartCore/ChartDataTable.tsx","../src/components/ChartCore/ChartFrame.module.css","../src/components/ChartCore/ChartFrame.tsx","../src/components/ChartLegend/ChartLegendItem.module.css","../src/components/ChartLegend/ChartLegendItem.tsx","../src/components/ChartLegend/legendHelpers.ts","../src/components/ChartLegend/useLegendState.ts","../src/components/ChartLegend/ChartLegend.module.css","../src/components/ChartLegend/ChartLegend.tsx","../src/components/ChartTooltip/ChartTooltip.module.css","../src/components/ChartTooltip/ChartTooltip.tsx","../src/components/LineChart/SeriesChartInternal.tsx","../src/components/AreaChart/AreaChart.tsx","../src/components/Button/Button.module.css","../src/components/Button/Button.tsx","../src/components/AssetField/AssetField.module.css","../src/components/AssetField/AssetField.tsx","../src/components/IconButton/IconButton.module.css","../src/components/IconButton/IconButton.tsx","../src/components/Banner/Banner.module.css","../src/components/Banner/Banner.tsx","../src/components/BarChart/BarChart.tsx","../src/components/BlockHeader/BlockHeader.module.css","../src/components/BlockHeader/BlockHeader.tsx","../src/components/Breadcrumb/Breadcrumb.module.css","../src/components/Breadcrumb/Breadcrumb.tsx","../src/components/Link/Link.module.css","../src/components/Link/Link.tsx","../src/components/Breadcrumb/BreadcrumbItem.module.css","../src/components/Breadcrumb/BreadcrumbItem.tsx","../src/components/Calendar/Calendar.module.css","../src/components/Calendar/CalendarDay.module.css","../src/components/Calendar/dateUtils.ts","../src/components/Calendar/CalendarDay.tsx","../src/components/Calendar/CalendarHeader.module.css","../src/components/Calendar/CalendarHeader.tsx","../src/components/Calendar/Calendar.tsx","../src/components/Card/Card.module.css","../src/components/Card/Card.tsx","../src/components/Card/CardFooter.module.css","../src/components/Card/CardFooter.tsx","../src/components/Card/CardHeader.module.css","../src/components/Card/CardHeader.tsx","../src/components/CatalogCard/CatalogCard.module.css","../src/components/CatalogCard/CatalogCard.tsx","../src/components/RangeTabs/Segment.module.css","../src/components/RangeTabs/Segment.tsx","../src/components/RangeTabs/RangeTabs.module.css","../src/components/RangeTabs/RangeTabs.tsx","../src/components/ChartCard/ChartCard.module.css","../src/components/ChartCard/ChartCard.tsx","../src/components/Checkbox/Checkbox.module.css","../src/components/Checkbox/Checkbox.tsx","../src/components/Spinner/Spinner.module.css","../src/components/Spinner/Spinner.tsx","../src/components/ChecklistItem/ChecklistItem.module.css","../src/components/ChecklistItem/ChecklistItem.tsx","../src/components/Dialog/dialogContext.ts","../src/components/Dialog/useModalBehaviour.ts","../src/components/Dialog/Dialog.module.css","../src/components/Dialog/Dialog.tsx","../src/components/Dialog/DialogHeader.module.css","../src/components/Dialog/DialogHeader.tsx","../src/components/Dialog/DialogBody.module.css","../src/components/Dialog/DialogBody.tsx","../src/components/Dialog/DialogFooter.module.css","../src/components/Dialog/DialogFooter.tsx","../src/components/CommandPalette/CommandPaletteItem.module.css","../src/components/CommandPalette/CommandPaletteItem.tsx","../src/components/CommandPalette/CommandPalette.module.css","../src/components/CommandPalette/CommandPalette.tsx","../src/components/ConfirmDialog/ConfirmDialog.tsx","../src/components/Status/Status.module.css","../src/components/Status/Status.tsx","../src/components/ContentRow/ContentRow.module.css","../src/components/ContentRow/ContentRow.tsx","../src/components/CredentialRow/CredentialRow.module.css","../src/components/CredentialRow/CredentialRow.tsx","../src/components/Menu/Menu.module.css","../src/components/Menu/Menu.tsx","../src/components/Menu/MenuItem.module.css","../src/components/Menu/MenuItem.tsx","../src/components/Menu/usePopup.ts","../src/components/DropdownMenu/DropdownMenuContext.ts","../src/components/DropdownMenu/DropdownMenu.tsx","../src/components/DropdownMenu/DropdownMenuCheckboxItem.tsx","../src/components/DropdownMenu/DropdownMenuItem.tsx","../src/components/DropdownMenu/DropdownMenuLabel.module.css","../src/components/DropdownMenu/DropdownMenuLabel.tsx","../src/components/DropdownMenu/DropdownMenuSeparator.module.css","../src/components/DropdownMenu/DropdownMenuSeparator.tsx","../src/components/EmptyState/EmptyState.module.css","../src/components/EmptyState/EmptyState.tsx","../src/components/Filters/FilterChip.module.css","../src/components/Filters/FilterChip.tsx","../src/components/Field/FieldContext.ts","../src/components/Field/useFieldControl.ts","../src/components/Input/control.module.css","../src/components/Search/Search.module.css","../src/components/Search/Search.tsx","../src/components/Filters/FilterMenu.module.css","../src/components/Filters/FilterMenu.tsx","../src/components/Filters/FilterBar.module.css","../src/components/Filters/FilterBar.tsx","../src/components/Pagination/Pagination.module.css","../src/components/Pagination/Pagination.tsx","../src/components/Skeleton/Skeleton.module.css","../src/components/Skeleton/Skeleton.tsx","../src/components/Table/TableContext.ts","../src/components/Table/Table.module.css","../src/components/Table/Table.tsx","../src/components/Table/TableHeaderCell.module.css","../src/components/Table/TableHeaderCell.tsx","../src/components/Table/TableHeaderRow.module.css","../src/components/Table/TableHeaderRow.tsx","../src/components/Table/TableRow.module.css","../src/components/Table/TableRow.tsx","../src/components/Table/TableCell.module.css","../src/components/Table/TableCell.tsx","../src/components/Table/TableCellText.module.css","../src/components/Table/TableCellText.tsx","../src/components/Table/TableCellTwoLine.module.css","../src/components/Table/TableCellTwoLine.tsx","../src/components/Table/TableCellStatus.tsx","../src/components/Table/TableCellUser.module.css","../src/components/Table/TableCellUser.tsx","../src/components/Table/TableCellNumber.module.css","../src/components/Table/TableCellNumber.tsx","../src/components/Table/TableCellActions.module.css","../src/components/Table/TableCellActions.tsx","../src/components/Table/TableCellCheckbox.tsx","../src/components/Table/TableToolbar.module.css","../src/components/Table/TableToolbar.tsx","../src/components/Table/TableFooter.module.css","../src/components/Table/TableFooter.tsx","../src/components/DataTable/useControllable.ts","../src/components/DataTable/DataTable.module.css","../src/components/DataTable/DataTable.tsx","../src/components/Input/LockedTagInternal.tsx","../src/components/Input/Input.tsx","../src/components/DateField/DateField.tsx","../src/components/Calendar/DateTriggerInternal.module.css","../src/components/Calendar/DateTriggerInternal.tsx","../src/components/Calendar/useDatePopup.ts","../src/components/DatePicker/DatePicker.module.css","../src/components/DatePicker/DatePicker.tsx","../src/components/DateRangePicker/DateRangePresets.module.css","../src/components/DateRangePicker/DateRangePresets.tsx","../src/components/DateRangePicker/DateRangeTrigger.tsx","../src/components/DateRangePicker/DateRangePicker.module.css","../src/components/DateRangePicker/DateRangePicker.tsx","../src/components/Divider/Divider.module.css","../src/components/Divider/Divider.tsx","../src/components/DonutChart/DonutChart.module.css","../src/components/DonutChart/DonutChart.tsx","../src/components/Drawer/Drawer.module.css","../src/components/Drawer/Drawer.tsx","../src/components/EnvironmentLabel/EnvironmentLabel.module.css","../src/components/EnvironmentLabel/EnvironmentLabel.tsx","../src/components/Field/Field.module.css","../src/components/Field/Field.tsx","../src/components/KPI/KPI.module.css","../src/components/KPI/KPI.tsx","../src/components/Sparkline/Sparkline.module.css","../src/components/Sparkline/Sparkline.tsx","../src/components/KPIGraph/KPIGraph.module.css","../src/components/KPIGraph/KPIGraph.tsx","../src/components/Kbd/Kbd.module.css","../src/components/Kbd/Kbd.tsx","../src/components/Label/Label.module.css","../src/components/Label/Label.tsx","../src/components/LineChart/LineChart.tsx","../src/components/MediaTile/MediaTile.module.css","../src/components/MediaTile/MediaTile.tsx","../src/components/UnavailableState/UnavailableState.module.css","../src/components/UnavailableState/UnavailableState.tsx","../src/components/MetricCard/MetricCard.module.css","../src/components/MetricCard/MetricCard.tsx","../src/components/Select/Select.module.css","../src/components/Select/useListbox.ts","../src/components/MultiSelect/MultiSelect.module.css","../src/components/MultiSelect/MultiSelect.tsx","../src/components/NavGroup/NavGroup.module.css","../src/components/NavGroup/NavGroup.tsx","../src/components/NavItem/NavItem.module.css","../src/components/NavItem/NavItem.tsx","../src/components/NodeGraph/GraphNode.module.css","../src/components/NodeGraph/GraphNode.tsx","../src/components/NodeGraph/NodeGraph.module.css","../src/components/NodeGraph/NodeGraph.tsx","../src/components/NodeReference/NodeReference.module.css","../src/components/NodeReference/NodeReference.tsx","../src/components/NumberField/NumberField.module.css","../src/components/NumberField/NumberField.tsx","../src/components/PageHeader/PageHeader.module.css","../src/components/PageHeader/PageHeader.tsx","../src/components/PickerItem/PickerItem.module.css","../src/components/PickerItem/PickerItem.tsx","../src/components/Tooltip/useAnchoredPosition.ts","../src/components/Popover/Popover.module.css","../src/components/Popover/Popover.tsx","../src/components/ProgressBar/ProgressBar.module.css","../src/components/ProgressBar/ProgressBar.tsx","../src/components/ProposedNote/ProposedNote.module.css","../src/components/ProposedNote/ProposedNote.tsx","../src/components/Radio/Radio.module.css","../src/components/Radio/RadioGroupContext.ts","../src/components/Radio/Radio.tsx","../src/components/Radio/RadioGroup.module.css","../src/components/Radio/RadioGroup.tsx","../src/components/ResourceCard/ResourceCard.module.css","../src/components/ResourceCard/ResourceCard.tsx","../src/components/RichTextField/richTextCommands.ts","../src/components/RichTextField/RichTextField.module.css","../src/components/RichTextField/RichTextTool.module.css","../src/components/RichTextField/RichTextTool.tsx","../src/components/RichTextField/RichTextToolbar.module.css","../src/components/RichTextField/RichTextToolbar.tsx","../src/components/RichTextField/RichTextField.tsx","../src/components/ScatterPlot/ScatterPlot.tsx","../src/components/Select/Select.tsx","../src/components/SetupStep/SetupStep.module.css","../src/components/SetupStep/SetupStep.tsx","../src/components/Sidebar/Sidebar.module.css","../src/components/Sidebar/Sidebar.tsx","../src/components/Sidebar/SidebarBrand.module.css","../src/components/Sidebar/SidebarBrand.tsx","../src/components/Sidebar/SidebarUser.module.css","../src/components/Sidebar/SidebarUser.tsx","../src/components/SortableRow/SortableRow.module.css","../src/components/SortableRow/SortableRow.tsx","../src/components/StatusIcon/StatusIcon.module.css","../src/components/StatusIcon/StatusIcon.tsx","../src/components/Stepper/Step.module.css","../src/components/Stepper/Step.tsx","../src/components/Stepper/Stepper.module.css","../src/components/Stepper/Stepper.tsx","../src/components/Toggle/Toggle.module.css","../src/components/Toggle/Toggle.tsx","../src/components/SwitchField/SwitchField.module.css","../src/components/SwitchField/SwitchField.tsx","../src/components/Tabs/TabsContext.ts","../src/components/Tabs/Tabs.module.css","../src/components/Tabs/Tabs.tsx","../src/components/Tabs/TabList.module.css","../src/components/Tabs/TabList.tsx","../src/components/Tabs/Tab.module.css","../src/components/Tabs/Tab.tsx","../src/components/Tabs/TabPanel.module.css","../src/components/Tabs/TabPanel.tsx","../src/components/Textarea/Textarea.module.css","../src/components/Textarea/Textarea.tsx","../src/components/Toast/Toast.module.css","../src/components/Toast/Toast.tsx","../src/components/Toast/ToastStack.module.css","../src/components/Toast/ToastStack.tsx","../src/components/Toast/useToast.ts","../src/components/Toast/ToastProvider.tsx","../src/components/Tooltip/Tooltip.module.css","../src/components/Tooltip/Tooltip.tsx","../src/components/TopBar/TopBar.module.css","../src/components/TopBar/TopBar.tsx","../src/components/TopBar/ContextSwitcher.module.css","../src/components/TopBar/ContextSwitcher.tsx","../src/components/TopBar/TopBarSeparator.module.css","../src/components/TopBar/TopBarSeparator.tsx"],"sourcesContent":["import type { SVGProps } from 'react';\n\nconst CIRCLE = 'M22 12A10 10 0 1 1 2 12A10 10 0 1 1 22 12';\n\n/** Same 24 px paths as the Icons page in Figma. */\nexport const iconPaths = {\n plus: 'M5 12H19M12 5V19',\n minus: 'M5 12H19',\n check: 'M20 6L9 17L4 12',\n x: 'M18 6L6 18M6 6L18 18',\n 'chevron-down': 'M6 9L12 15L18 9',\n 'chevron-up': 'M18 15L12 9L6 15',\n 'chevron-right': 'M9 18L15 12L9 6',\n 'chevron-left': 'M15 18L9 12L15 6',\n 'chevrons-up-down': 'M7 15L12 20L17 15M7 9L12 4L17 9',\n 'arrow-right': 'M5 12H19M12 5L19 12L12 19',\n 'arrow-left': 'M12 19L5 12L12 5M19 12H5',\n 'arrow-up': 'M5 12L12 5L19 12M12 19V5',\n 'arrow-down': 'M12 5V19M19 12L12 19L5 12',\n 'external-link': 'M15 3H21V9M10 14L21 3M18 13V19A2 2 0 0 1 16 21H5A2 2 0 0 1 3 19V8A2 2 0 0 1 5 6H11',\n search: 'M19 11A8 8 0 1 1 3 11A8 8 0 1 1 19 11M21 21L16.7 16.7',\n lock: 'M5 11H19A2 2 0 0 1 21 13V20A2 2 0 0 1 19 22H5A2 2 0 0 1 3 20V13A2 2 0 0 1 5 11ZM7 11V7A5 5 0 0 1 17 7V11',\n 'alert-triangle': 'M21.73 18L13.73 4A2 2 0 0 0 10.25 4L2.25 18A2 2 0 0 0 4 21H20A2 2 0 0 0 21.73 18ZM12 9V13M12 17H12.01',\n 'alert-circle': `${CIRCLE}M12 8V12M12 16H12.01`,\n info: `${CIRCLE}M12 16V12M12 8H12.01`,\n 'check-circle': `${CIRCLE}M9 12L11 14L15 10`,\n 'x-circle': `${CIRCLE}M15 9L9 15M9 9L15 15`,\n clock: `${CIRCLE}M12 6V12L16 14`,\n circle: CIRCLE,\n user: 'M19 21V19A4 4 0 0 0 15 15H9A4 4 0 0 0 5 19V21M16 7A4 4 0 1 1 8 7A4 4 0 1 1 16 7',\n sliders: 'M21 4H14M10 4H3M21 12H12M8 12H3M21 20H16M12 20H3M14 2V6M8 10V14M16 18V22',\n home: 'M3 9L12 2L21 9V20A2 2 0 0 1 19 22H5A2 2 0 0 1 3 20ZM9 22V12H15V22',\n folder: 'M20 20A2 2 0 0 0 22 18V8A2 2 0 0 0 20 6H12.1A2 2 0 0 1 10.41 5.1L9.6 3.9A2 2 0 0 0 7.93 3H4A2 2 0 0 0 2 5V18A2 2 0 0 0 4 20Z',\n database:\n 'M21 5C21 6.66 17 8 12 8S3 6.66 3 5S7 2 12 2S21 3.34 21 5ZM3 5V19C3 20.66 7 22 12 22S21 20.66 21 19V5M3 12C3 13.66 7 15 12 15S21 13.66 21 12',\n globe: `${CIRCLE}M2 12H22M12 2A15 15 0 0 1 12 22A15 15 0 0 1 12 2`,\n activity: 'M22 12H18L15 21L9 3L6 12H2',\n bell: 'M6 8A6 6 0 0 1 18 8C18 15 21 17 21 17H3S6 15 6 8M10.3 21A1.94 1.94 0 0 0 13.7 21',\n trash: 'M3 6H21M19 6V20C19 21 18 22 17 22H7C6 22 5 21 5 20V6M8 6V4C8 3 9 2 10 2H14C15 2 16 3 16 4V6',\n pencil: 'M12 20H21M16.5 3.5A2.12 2.12 0 0 1 19.5 6.5L7 19L3 20L4 16Z',\n copy: 'M10 8H20A2 2 0 0 1 22 10V20A2 2 0 0 1 20 22H10A2 2 0 0 1 8 20V10A2 2 0 0 1 10 8ZM4 16C2.9 16 2 15.1 2 14V4C2 2.9 2.9 2 4 2H14C15.1 2 16 2.9 16 4',\n more: 'M12 12H12.01M19 12H19.01M5 12H5.01',\n filter: 'M22 3H2L10 12.46V19L14 21V12.46Z',\n calendar: 'M8 2V6M16 2V6M5 4H19A2 2 0 0 1 21 6V20A2 2 0 0 1 19 22H5A2 2 0 0 1 3 20V6A2 2 0 0 1 5 4ZM3 10H21',\n 'file-text': 'M15 2H6A2 2 0 0 0 4 4V20A2 2 0 0 0 6 22H18A2 2 0 0 0 20 20V7ZM14 2V6A2 2 0 0 0 16 8H20M16 13H8M16 17H8',\n image:\n 'M5 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3ZM21 15L17.9 11.9A2 2 0 0 0 15.1 11.9L6 21M11 9A2 2 0 1 1 7 9A2 2 0 1 1 11 9',\n 'bar-chart': 'M3 3V21H21M8 17V12M13 17V7M18 17V9',\n book: 'M4 19.5A2.5 2.5 0 0 1 6.5 17H20V2H6.5A2.5 2.5 0 0 0 4 4.5ZM4 19.5A2.5 2.5 0 0 0 6.5 22H20V17',\n} as const;\n\nexport type IconName = keyof typeof iconPaths;\nexport const iconNames = Object.keys(iconPaths) as IconName[];\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'name'> {\n /** Which icon to draw. */\n name: IconName;\n /** Width and height in pixels. */\n size?: number;\n /** Accessible name. Leave empty for decorative icons beside text. */\n label?: string;\n}\n\n/** Draws an icon in the current text colour, with a 1.5 px stroke at 16 px. */\nexport function Icon({ name, size = 16, label, ...props }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={name === 'more' ? 3.5 : 2.25}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n focusable=\"false\"\n {...props}\n >\n <path d={iconPaths[name]} />\n </svg>\n );\n}\n","/** Joins class names, skipping anything falsy. */\nexport function cx(...classes: Array<string | false | null | undefined>): string {\n return classes.filter(Boolean).join(' ');\n}\n","import { createContext, useContext } from 'react';\n\nexport type AccordionHeadingLevel = 2 | 3 | 4 | 5 | 6;\n\nexport interface AccordionContextValue {\n /** The values of the open items. */\n openValues: string[];\n /** Opens or closes an item. */\n toggle: (value: string) => void;\n headingLevel: AccordionHeadingLevel;\n}\n\nexport const AccordionContext = createContext<AccordionContextValue | null>(null);\n\nexport function useAccordionContext(): AccordionContextValue {\n const context = useContext(AccordionContext);\n if (!context) throw new Error('AccordionItem must be used inside Accordion.');\n return context;\n}\n",".accordion {\n display: flex;\n flex-direction: column;\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n","import { forwardRef, useMemo, useState, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { AccordionContext, type AccordionContextValue, type AccordionHeadingLevel } from './AccordionContext';\nimport styles from './Accordion.module.css';\n\nexport type { AccordionHeadingLevel };\nexport type AccordionMode = 'single' | 'multiple';\n\nexport interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {\n /** `single` keeps at most one item open. `multiple` lets any number stay open. */\n mode?: AccordionMode;\n /** The values of the open items, when controlled. */\n value?: string[];\n /** The values of the items that first show open, when uncontrolled. */\n defaultValue?: string[];\n /** Called with the values of the open items after the user opens or closes one. */\n onChange?: (value: string[]) => void;\n /** Level of the heading around each item's button. Match it to the page outline. */\n headingLevel?: AccordionHeadingLevel;\n}\n\n/** A stack of sections that open and close to show their content. */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(function Accordion(\n { mode = 'single', value, defaultValue = [], onChange, headingLevel = 3, className, ...props },\n ref,\n) {\n const [innerValue, setInnerValue] = useState(defaultValue);\n const openValues = value ?? innerValue;\n\n const context = useMemo<AccordionContextValue>(\n () => ({\n openValues,\n headingLevel,\n toggle: (item) => {\n const isOpen = openValues.includes(item);\n const others = mode === 'single' ? [] : openValues.filter((open) => open !== item);\n const next = isOpen ? others : [...others, item];\n setInnerValue(next);\n onChange?.(next);\n },\n }),\n [openValues, headingLevel, mode, onChange],\n );\n\n return (\n <AccordionContext.Provider value={context}>\n <div ref={ref} data-accordion=\"\" className={cx(styles.accordion, className)} {...props} />\n </AccordionContext.Provider>\n );\n});\n",".item {\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.heading {\n margin: var(--space-0);\n font: var(--font-heading-s);\n}\n\n.header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-12);\n box-sizing: border-box;\n width: 100%;\n padding: var(--space-12) var(--space-8);\n border: none;\n background: transparent;\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n text-align: left;\n cursor: pointer;\n}\n\n.header:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.header:focus-visible {\n border-radius: var(--radius-sm);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.header:disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.chevron {\n flex: none;\n}\n\n.panel {\n padding: var(--space-0) var(--space-8) var(--space-16);\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n","import { forwardRef, useId, type HTMLAttributes, type KeyboardEvent, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useAccordionContext } from './AccordionContext';\nimport styles from './AccordionItem.module.css';\n\nexport interface AccordionItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Identifies this item in the Accordion's value. */\n value: string;\n /** The text of the header button. */\n title: ReactNode;\n /** Blocks opening and closing. */\n disabled?: boolean;\n}\n\n/** One section of an Accordion: a header button and a panel with the region role. */\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem(\n { value, title, disabled = false, className, children, ...props },\n ref,\n) {\n const id = useId();\n const { openValues, toggle, headingLevel } = useAccordionContext();\n const open = openValues.includes(value);\n const Heading = `h${headingLevel}` as const;\n const headerId = `${id}-header`;\n const panelId = `${id}-panel`;\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n const root = event.currentTarget.closest('[data-accordion]');\n if (!root) return;\n const headers = Array.from(root.querySelectorAll<HTMLButtonElement>('[data-accordion-header]:not(:disabled)'));\n const index = headers.indexOf(event.currentTarget);\n const targets: Record<string, number> = {\n ArrowDown: (index + 1) % headers.length,\n ArrowUp: (index - 1 + headers.length) % headers.length,\n Home: 0,\n End: headers.length - 1,\n };\n const target = headers[targets[event.key]];\n if (!target) return;\n event.preventDefault();\n target.focus();\n };\n\n return (\n <div ref={ref} className={cx(styles.item, className)} {...props}>\n <Heading className={styles.heading}>\n <button\n id={headerId}\n type=\"button\"\n data-accordion-header=\"\"\n className={styles.header}\n aria-expanded={open}\n aria-controls={panelId}\n disabled={disabled}\n onClick={() => toggle(value)}\n onKeyDown={handleKeyDown}\n >\n {title}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className={styles.chevron} />\n </button>\n </Heading>\n <div id={panelId} role=\"region\" aria-labelledby={headerId} className={styles.panel} hidden={!open}>\n {children}\n </div>\n </div>\n );\n});\n","import { createContext } from 'react';\nimport type { AvatarSize } from './Avatar';\n\n/** Lets AvatarGroup set the size of the avatars inside it. */\nexport const AvatarSizeContext = createContext<AvatarSize | undefined>(undefined);\n",".avatar {\n position: relative;\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n border-radius: var(--radius-full);\n background: var(--color-bg-sunken);\n color: var(--color-text-primary);\n white-space: nowrap;\n}\n\n.sm {\n width: 24px;\n height: 24px;\n font: var(--font-label-s);\n}\n\n.md {\n width: 32px;\n height: 32px;\n font: var(--font-label-s);\n}\n\n.lg {\n width: 40px;\n height: 40px;\n font: var(--font-label-m);\n}\n\n.image {\n width: 100%;\n height: 100%;\n border-radius: var(--radius-full);\n object-fit: cover;\n}\n\n.dot {\n position: absolute;\n right: 0;\n bottom: 0;\n width: 8px;\n height: 8px;\n border-radius: var(--radius-full);\n outline: var(--stroke-hairline) solid var(--color-bg-canvas);\n}\n\n.success {\n background: var(--color-status-success);\n}\n\n.warning {\n background: var(--color-status-warning);\n}\n\n.danger {\n background: var(--color-status-danger);\n}\n\n.info {\n background: var(--color-status-info);\n}\n\n.neutral {\n background: var(--color-status-neutral);\n}\n\n.pending {\n background: var(--color-status-pending);\n}\n","import { forwardRef, useContext, useState, type HTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport type { StatusTone } from '../Status';\nimport { AvatarSizeContext } from './AvatarContext';\nimport styles from './Avatar.module.css';\n\nexport type AvatarSize = 'sm' | 'md' | 'lg';\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Accessible name of the person or team. Without it the avatar only exposes its initials, if any. */\n name?: string;\n /** Short text fallback, such as `DR`. Without it the fallback is a user icon. */\n initials?: string;\n /** Image to show. If it is missing or fails to load, the initials or icon show instead. */\n src?: string;\n /** Diameter: `sm` is 24 px, `md` is 32 px and `lg` is 40 px. Inside an AvatarGroup, defaults to the size of the group. */\n size?: AvatarSize;\n /** Adds a status dot in this tone. */\n status?: StatusTone;\n /** What the status dot means, added to the accessible name. Defaults to the tone. */\n statusLabel?: string;\n}\n\nconst ICON_SIZE: Record<AvatarSize, number> = { sm: 14, md: 16, lg: 20 };\n\n/** Represents a person or team, with initials or an icon when no photo is available. */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n { name, initials, src, size, status, statusLabel, className, ...props },\n ref,\n) {\n const groupSize = useContext(AvatarSizeContext);\n const resolvedSize = size ?? groupSize ?? 'md';\n const [failedSrc, setFailedSrc] = useState<string>();\n const showImage = src !== undefined && src !== failedSrc;\n const accessibleName = [name, status && (statusLabel ?? status)].filter(Boolean).join(', ') || undefined;\n\n return (\n <span\n ref={ref}\n className={cx(styles.avatar, styles[resolvedSize], className)}\n role={accessibleName ? 'img' : undefined}\n aria-label={accessibleName}\n {...props}\n >\n {showImage ? (\n <img className={styles.image} src={src} alt=\"\" onError={() => setFailedSrc(src)} />\n ) : (\n (initials ?? <Icon name=\"user\" size={ICON_SIZE[resolvedSize]} />)\n )}\n {status && <span className={cx(styles.dot, styles[status])} />}\n </span>\n );\n});\n",".group {\n --avatar-overlap: calc(var(--space-4) * -1);\n\n display: inline-flex;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.item {\n display: flex;\n margin-inline-start: var(--avatar-overlap);\n}\n\n.item:first-child {\n margin-inline-start: 0;\n}\n\n.item > * {\n outline: var(--stroke-strong) solid var(--color-bg-canvas);\n}\n","import { Children, forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Avatar, type AvatarSize } from './Avatar';\nimport { AvatarSizeContext } from './AvatarContext';\nimport styles from './AvatarGroup.module.css';\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLUListElement> {\n /** Most avatars to show. The rest are summed up in a +N chip. */\n max?: number;\n /** Size of every avatar in the group, and of the +N chip. */\n size?: AvatarSize;\n /** Accessible name of the +N chip, given how many avatars it hides. */\n overflowLabel?: (count: number) => string;\n}\n\n/** A row of overlapping avatars. Give it an `aria-label` that says who they are. */\nexport const AvatarGroup = forwardRef<HTMLUListElement, AvatarGroupProps>(function AvatarGroup(\n { max = 3, size = 'md', overflowLabel = (count) => `${count} more`, className, children, ...props },\n ref,\n) {\n const avatars = Children.toArray(children);\n const visible = avatars.slice(0, Math.max(max, 0));\n const overflow = avatars.length - visible.length;\n\n return (\n <AvatarSizeContext.Provider value={size}>\n <ul ref={ref} className={cx(styles.group, className)} {...props}>\n {visible.map((avatar, index) => (\n <li key={index} className={styles.item}>\n {avatar}\n </li>\n ))}\n {overflow > 0 && (\n <li className={styles.item}>\n <Avatar name={overflowLabel(overflow)} initials={`+${overflow}`} />\n </li>\n )}\n </ul>\n </AvatarSizeContext.Provider>\n );\n});\n",".item {\n display: flex;\n align-items: flex-start;\n gap: var(--space-8);\n padding: var(--space-8) var(--space-0);\n}\n\n.text {\n min-width: 0;\n}\n\n.summary {\n color: var(--color-text-primary);\n font: var(--font-body-s);\n}\n\n.meta {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Avatar } from '../Avatar';\nimport styles from './ActivityItem.module.css';\n\nexport interface ActivityItemProps extends HTMLAttributes<HTMLDivElement> {\n /** Who did it. */\n actor: string;\n /** Short text for the avatar, such as `DR`. */\n initials?: string;\n /** Avatar image. */\n src?: string;\n /** What they did, following on from their name. */\n action: ReactNode;\n /** A quieter line, such as the time. */\n meta?: ReactNode;\n}\n\n/** One entry in an activity feed. */\nexport const ActivityItem = forwardRef<HTMLDivElement, ActivityItemProps>(function ActivityItem(\n { actor, initials, src, action, meta, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.item, className)} {...props}>\n {/* Hidden because the name is right beside it. */}\n <Avatar size=\"sm\" initials={initials} src={src} aria-hidden=\"true\" />\n <div className={styles.text}>\n <div className={styles.summary}>\n {actor} {action}\n </div>\n {meta && <div className={styles.meta}>{meta}</div>}\n </div>\n </div>\n );\n});\n","import type { ChartAnchor, ChartPoint, ChartSegment, ChartSeries } from './types';\n\n/** The most series or segments a chart colours. Past this, the rest fold into Other. */\nexport const MAX_SERIES = 5;\n\n/** Keeps a number inside a range. */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/** Returns a function that maps a value from one numeric range to another. */\nexport function linearScale(domain: [number, number], range: [number, number]): (value: number) => number {\n const span = domain[1] - domain[0];\n if (span === 0) return () => (range[0] + range[1]) / 2;\n return (value) => range[0] + ((value - domain[0]) / span) * (range[1] - range[0]);\n}\n\n/** Round axis ticks that cover the values and leave a little headroom above the highest one. */\nexport function niceTicks(min: number, max: number, count = 4): number[] {\n const top = max === min ? max + 1 : max + (max - min) * 0.05;\n const rawStep = (top - min) / count;\n const magnitude = 10 ** Math.floor(Math.log10(rawStep));\n const step = [1, 2.5, 5, 10].map((multiple) => multiple * magnitude).find((candidate) => candidate >= rawStep) ?? 10 * magnitude;\n const first = Math.floor(min / step);\n const last = Math.ceil(top / step);\n return Array.from({ length: last - first + 1 }, (_, i) => Number(((first + i) * step).toFixed(6)));\n}\n\n/** Formats axis ticks in one style: in full under 10,000, compact when the axis reaches it. */\nexport function formatTicks(ticks: number[]): string[] {\n const compact = Math.max(...ticks.map(Math.abs)) >= 10000;\n return ticks.map((tick) => {\n if (!compact) return tick.toLocaleString('en-US');\n if (Math.abs(tick) >= 1e6) return `${Number((tick / 1e6).toFixed(1))}M`;\n return `${Number((tick / 1e3).toFixed(1))}K`;\n });\n}\n\n/** Default value format for labels, tooltips and tables. */\nexport function formatValue(value: number): string {\n return value.toLocaleString('en-US');\n}\n\n/** Which label positions to show so that labels sit at least `minSpacing` pixels apart. */\nexport function thinTickIndexes(count: number, spacing: number, minSpacing = 48): number[] {\n const every = Math.max(1, Math.ceil(minSpacing / Math.max(spacing, 1)));\n return Array.from({ length: count }, (_, i) => i).filter((i) => i % every === 0);\n}\n\n/** Rough width of a caption-sized string, used to reserve room before the text is drawn. */\nexport function estimateTextWidth(text: string): number {\n return text.length * 7;\n}\n\n/** The position labels of a set of series, taken from the longest. */\nexport function seriesLabels(series: ChartSeries[]): string[] {\n return series\n .reduce<ChartPoint[]>((longest, item) => (item.points.length > longest.length ? item.points : longest), [])\n .map((p) => p.label);\n}\n\n/** The position of the last recorded value, or -1 when there is none. */\nexport function lastRecordedIndex(values: (number | null)[]): number {\n for (let i = values.length - 1; i >= 0; i -= 1) if (values[i] !== null) return i;\n return -1;\n}\n\n/** Whether any series has at least one recorded value. */\nexport function hasSeriesData(series: ChartSeries[]): boolean {\n return series.some((item) => item.points.some((point) => point.value !== null));\n}\n\n/** Recorded values across a set of series. */\nexport function seriesValues(series: ChartSeries[]): number[] {\n return series.flatMap((item) => item.points.flatMap((point) => (point.value === null ? [] : [point.value])));\n}\n\n/** Keeps the first four series and sums the rest into Other when there are more than five. */\nexport function foldSeries(series: ChartSeries[], otherName = 'Other'): ChartSeries[] {\n if (series.length <= MAX_SERIES) return series;\n const kept = series.slice(0, MAX_SERIES - 1);\n const rest = series.slice(MAX_SERIES - 1);\n const points = seriesLabels(rest).map((label, i) => {\n const values = rest.flatMap((item) => {\n const value = item.points[i]?.value;\n return value === null || value === undefined ? [] : [value];\n });\n return { label, value: values.length ? values.reduce((sum, value) => sum + value, 0) : null };\n });\n return [...kept, { id: 'other', name: otherName, points }];\n}\n\n/** Keeps the first four segments and sums the rest into Other when there are more than five. */\nexport function foldSegments(segments: ChartSegment[], otherLabel = 'Other'): ChartSegment[] {\n if (segments.length <= MAX_SERIES) return segments;\n const rest = segments.slice(MAX_SERIES - 1);\n return [\n ...segments.slice(0, MAX_SERIES - 1),\n { id: 'other', label: otherLabel, value: rest.reduce((sum, segment) => sum + segment.value, 0) },\n ];\n}\n\n/** Places a tooltip beside its anchor, flipping sides and clamping so that it stays inside the bounds. */\nexport function placeTooltip(\n anchor: ChartAnchor,\n tooltip: { width: number; height: number },\n bounds: { width: number; height: number },\n gap = 12,\n): { x: number; y: number } {\n const reach = anchor.reach ?? 0;\n const right = anchor.x + reach + gap;\n const left = anchor.x - reach - gap - tooltip.width;\n const x = right + tooltip.width <= bounds.width ? right : left;\n return {\n x: clamp(x, 0, Math.max(0, bounds.width - tooltip.width)),\n y: clamp(anchor.y - tooltip.height - gap / 2, 0, Math.max(0, bounds.height - tooltip.height)),\n };\n}\n","/** A plotted position, or `null` where nothing was recorded. */\nexport type PathPoint = { x: number; y: number } | null;\n\n/** Which way a bar grows from its baseline. Only that end is rounded. */\nexport type BarDirection = 'up' | 'down' | 'right' | 'left';\n\nconst round = (value: number) => Number(value.toFixed(2));\n\n/** Splits points into unbroken runs, so that a missing value leaves a gap. */\nfunction runs(points: PathPoint[]): { x: number; y: number }[][] {\n const result: { x: number; y: number }[][] = [];\n let current: { x: number; y: number }[] = [];\n for (const point of points) {\n if (point) current.push(point);\n else if (current.length) {\n result.push(current);\n current = [];\n }\n }\n if (current.length) result.push(current);\n return result;\n}\n\n/** SVG path for a line. A missing value breaks the line rather than dropping it to zero. */\nexport function linePath(points: PathPoint[]): string {\n return runs(points)\n .map((run) => {\n const [first, ...rest] = run;\n // A lone point has no length, so give it one the round cap can draw.\n const tail = rest.length ? rest.map((p) => `L${round(p.x)} ${round(p.y)}`).join('') : `h0.01`;\n return `M${round(first.x)} ${round(first.y)}${tail}`;\n })\n .join('');\n}\n\n/** SVG path for the wash under a line, closed along the baseline. */\nexport function areaPath(points: PathPoint[], baselineY: number): string {\n return runs(points)\n .filter((run) => run.length > 1)\n .map((run) => {\n const line = run.map((p, i) => `${i ? 'L' : 'M'}${round(p.x)} ${round(p.y)}`).join('');\n return `${line}L${round(run[run.length - 1].x)} ${round(baselineY)}L${round(run[0].x)} ${round(baselineY)}Z`;\n })\n .join('');\n}\n\n/** SVG path for a bar: rounded at the data end when `radius` is set, always square at the baseline. */\nexport function barPath(x: number, y: number, width: number, height: number, direction: BarDirection, radius = 0): string {\n const long = direction === 'up' || direction === 'down' ? height : width;\n const short = direction === 'up' || direction === 'down' ? width : height;\n const r = round(Math.max(0, Math.min(radius, short / 2, long)));\n const [x0, y0, x1, y1] = [round(x), round(y), round(x + width), round(y + height)];\n switch (direction) {\n case 'up':\n return `M${x0} ${y1}V${y0 + r}Q${x0} ${y0} ${x0 + r} ${y0}H${x1 - r}Q${x1} ${y0} ${x1} ${y0 + r}V${y1}Z`;\n case 'down':\n return `M${x0} ${y0}V${y1 - r}Q${x0} ${y1} ${x0 + r} ${y1}H${x1 - r}Q${x1} ${y1} ${x1} ${y1 - r}V${y0}Z`;\n case 'right':\n return `M${x0} ${y0}H${x1 - r}Q${x1} ${y0} ${x1} ${y0 + r}V${y1 - r}Q${x1} ${y1} ${x1 - r} ${y1}H${x0}Z`;\n case 'left':\n return `M${x1} ${y0}H${x0 + r}Q${x0} ${y0} ${x0} ${y0 + r}V${y1 - r}Q${x0} ${y1} ${x0 + r} ${y1}H${x1}Z`;\n }\n}\n\n/** A point on a circle. Angle 0 is 12 o'clock and angles run clockwise. */\nexport function polar(cx: number, cy: number, radius: number, angle: number): { x: number; y: number } {\n return { x: cx + radius * Math.sin(angle), y: cy - radius * Math.cos(angle) };\n}\n\n/**\n * SVG path for a ring segment between two angles. `gap` is the width in pixels of the space between\n * neighbouring segments: the angle is trimmed per radius so that the gap has parallel sides.\n */\nexport function arcPath(cx: number, cy: number, outer: number, inner: number, start: number, end: number, gap = 0): string {\n const full = end - start >= Math.PI * 2 - 1e-6;\n if (full) {\n const mid = start + Math.PI;\n return `${arcPath(cx, cy, outer, inner, start, mid)}${arcPath(cx, cy, outer, inner, mid, start + Math.PI * 2)}`;\n }\n const trim = (radius: number) => Math.min(gap / 2 / radius, (end - start) / 2);\n const [o0, o1] = [polar(cx, cy, outer, start + trim(outer)), polar(cx, cy, outer, end - trim(outer))];\n const [i0, i1] = [polar(cx, cy, inner, start + trim(inner)), polar(cx, cy, inner, end - trim(inner))];\n const large = end - start > Math.PI ? 1 : 0;\n return [\n `M${round(o0.x)} ${round(o0.y)}`,\n `A${outer} ${outer} 0 ${large} 1 ${round(o1.x)} ${round(o1.y)}`,\n `L${round(i1.x)} ${round(i1.y)}`,\n `A${inner} ${inner} 0 ${large} 0 ${round(i0.x)} ${round(i0.y)}`,\n 'Z',\n ].join('');\n}\n","/* Shared by every chart. A series colour class sets --chart-series-color and the marks read it, so colour stays in tokens. */\n.series1 {\n --chart-series-color: var(--color-chart-1);\n}\n\n.series2 {\n --chart-series-color: var(--color-chart-2);\n}\n\n.series3 {\n --chart-series-color: var(--color-chart-3);\n}\n\n.series4 {\n --chart-series-color: var(--color-chart-4);\n}\n\n.series5 {\n --chart-series-color: var(--color-chart-5);\n}\n\n.svg {\n display: block;\n overflow: visible;\n}\n\n.line {\n fill: none;\n stroke: var(--chart-series-color);\n stroke-width: var(--stroke-strong);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.wash {\n fill: var(--chart-series-color);\n fill-opacity: 0.1;\n stroke: none;\n}\n\n/* r = 5 with a 2 px stroke leaves an 8 px dot inside a 2 px surface ring. */\n.marker {\n fill: var(--chart-series-color);\n stroke: var(--color-bg-surface);\n stroke-width: var(--stroke-strong);\n}\n\n.bar {\n fill: var(--chart-series-color);\n stroke: none;\n}\n\n.crosshair {\n stroke: var(--color-icon-muted);\n stroke-width: var(--stroke-hairline);\n shape-rendering: crispedges;\n}\n\n.band {\n fill: var(--color-bg-subtle);\n stroke: none;\n}\n\n.valueLabel {\n fill: var(--color-text-primary);\n font: var(--font-label-s);\n font-variant-numeric: tabular-nums;\n}\n\n.srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import marks from './marks.module.css';\n\nconst COLOR_CLASSES = [marks.series1, marks.series2, marks.series3, marks.series4, marks.series5];\n\n/** Class that sets the colour of a series, by its fixed position: 0 is chart/1 and 4 is chart/5. */\nexport function seriesColorClass(index: number): string {\n return COLOR_CLASSES[index % COLOR_CLASSES.length];\n}\n\nexport { marks as chartMarks };\n","import { useCallback, useRef, useState, type ForwardedRef } from 'react';\n\nfunction assignRef<T>(ref: ForwardedRef<T> | undefined, node: T | null) {\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n}\n\n/** Measures an element's width with a ResizeObserver, so a chart fills its container. Width is 0 until first measured. */\nexport function useChartSize<T extends HTMLElement = HTMLDivElement>(forwardedRef?: ForwardedRef<T>) {\n const [width, setWidth] = useState(0);\n const observer = useRef<ResizeObserver | null>(null);\n\n const ref = useCallback(\n (node: T | null) => {\n observer.current?.disconnect();\n observer.current = null;\n if (node) {\n observer.current = new ResizeObserver(([entry]) => setWidth(Math.floor(entry.contentRect.width)));\n observer.current.observe(node);\n }\n assignRef(forwardedRef, node);\n },\n [forwardedRef],\n );\n\n return { ref, width };\n}\n","import { useState, type KeyboardEvent, type PointerEvent } from 'react';\nimport { clamp } from './scales';\n\n/** What set the active point. Only keyboard moves are announced, because a moving pointer would flood a screen reader. */\nexport type ChartHoverSource = 'pointer' | 'keyboard';\n\nexport interface UseChartHoverOptions {\n /** How many points the keyboard can move through. */\n count: number;\n /** Finds the point for a pointer position in plot pixels, or `null` when the pointer is near none. */\n locate: (x: number, y: number) => number | null;\n}\n\nexport interface ChartHover {\n /** The active point, or `null`. */\n activeIndex: number | null;\n /** What set the active point. */\n source: ChartHoverSource;\n /** Handlers to spread onto the focusable plot. */\n plotProps: {\n onPointerMove: (event: PointerEvent<HTMLElement>) => void;\n onPointerDown: (event: PointerEvent<HTMLElement>) => void;\n onPointerLeave: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n onBlur: () => void;\n };\n}\n\n/** Tracks a chart's active point from the pointer and the keyboard: arrows, Home and End move it, and Escape clears it. */\nexport function useChartHover({ count, locate }: UseChartHoverOptions): ChartHover {\n const [active, setActive] = useState<number | null>(null);\n const [source, setSource] = useState<ChartHoverSource>('pointer');\n const activeIndex = active !== null && active < count ? active : null;\n\n const fromPointer = (event: PointerEvent<HTMLElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n setSource('pointer');\n setActive(locate(event.clientX - rect.left, event.clientY - rect.top));\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (count === 0) return;\n if (event.key === 'Escape') {\n // Leave Escape to a surrounding dialog when there is nothing to clear here.\n if (activeIndex === null) return;\n event.stopPropagation();\n setActive(null);\n return;\n }\n const last = count - 1;\n let next: number;\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n next = activeIndex === null ? 0 : clamp(activeIndex + 1, 0, last);\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n next = activeIndex === null ? last : clamp(activeIndex - 1, 0, last);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = last;\n break;\n default:\n return;\n }\n event.preventDefault();\n setSource('keyboard');\n setActive(next);\n };\n\n return {\n activeIndex,\n source,\n plotProps: {\n onPointerMove: fromPointer,\n onPointerDown: fromPointer,\n onPointerLeave: () => setActive(null),\n onKeyDown,\n onBlur: () => setActive(null),\n },\n };\n}\n",".grid {\n stroke: var(--color-chart-grid);\n stroke-width: var(--stroke-hairline);\n shape-rendering: crispedges;\n}\n\n.label {\n fill: var(--color-text-tertiary);\n font: var(--font-caption);\n font-variant-numeric: tabular-nums;\n}\n\n.category {\n fill: var(--color-text-secondary);\n}\n","import { cx } from '../../lib/cx';\nimport type { PlotArea } from './types';\nimport styles from './ChartAxes.module.css';\n\n/** A labelled position along an axis. */\nexport interface AxisTick {\n /** Pixel position along the axis. */\n position: number;\n /** Text to show. */\n label: string;\n}\n\nexport interface ChartAxesProps {\n /** The rectangle the marks are drawn in. */\n plot: PlotArea;\n /** Labels under the plot. */\n xTicks?: AxisTick[];\n /** Labels to the left of the plot. */\n yTicks?: AxisTick[];\n /** Hairlines across the plot at each y tick. Turn off when the y axis names categories. */\n grid?: boolean;\n /** Whether the y labels name categories. They then read in a stronger text colour. */\n categoryY?: boolean;\n /** Draws a hairline up the left of the plot, as the baseline of horizontal bars. */\n leftBaseline?: boolean;\n}\n\n/** SVG axis labels and hairline gridlines. Render it inside an `svg`, before the marks. */\nexport function ChartAxes({ plot, xTicks = [], yTicks = [], grid = true, categoryY = false, leftBaseline = false }: ChartAxesProps) {\n return (\n <g>\n {yTicks.map((tick) => (\n <g key={`y-${tick.label}-${tick.position}`}>\n {grid && <line className={styles.grid} x1={plot.left} x2={plot.right} y1={tick.position} y2={tick.position} />}\n <text\n className={cx(styles.label, categoryY && styles.category)}\n x={plot.left - 8}\n y={tick.position}\n textAnchor=\"end\"\n dominantBaseline=\"central\"\n >\n {tick.label}\n </text>\n </g>\n ))}\n {leftBaseline && <line className={styles.grid} x1={plot.left} x2={plot.left} y1={plot.top} y2={plot.bottom} />}\n {xTicks.map((tick) => (\n <text key={`x-${tick.label}-${tick.position}`} className={styles.label} x={tick.position} y={plot.bottom + 16} textAnchor=\"middle\">\n {tick.label}\n </text>\n ))}\n </g>\n );\n}\n",".layer {\n position: relative;\n}\n\n.plot {\n height: 100%;\n border-radius: var(--radius-sm);\n touch-action: pan-y;\n}\n\n.plot:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.slot {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n width: max-content;\n pointer-events: none;\n}\n","import { forwardRef, useLayoutEffect, useRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { placeTooltip } from './scales';\nimport { chartMarks } from './series';\nimport type { ChartAnchor } from './types';\nimport type { ChartHover } from './useChartHover';\nimport styles from './ChartHoverLayer.module.css';\n\n/** A chart is an image to assistive technology. This one also takes focus, because its points are explored with the arrow keys. */\nconst PLOT_ROLE = 'img';\n\nexport interface ChartHoverLayerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** State and handlers from `useChartHover`. */\n hover: ChartHover;\n /** Accessible name of the plot. */\n label: string;\n /** Height of the plot in pixels. */\n height: number;\n /** Where the tooltip points. Leave unset when nothing is active. */\n anchor?: ChartAnchor | null;\n /** The tooltip for the active point. */\n tooltip?: ReactNode;\n /** Text read out by screen readers when the keyboard moves the active point. */\n announcement?: string;\n /** The chart's `svg`. */\n children?: ReactNode;\n}\n\n/** The focusable plot. Takes pointer and keyboard input, and keeps the tooltip beside the active point and inside the chart. */\nexport const ChartHoverLayer = forwardRef<HTMLDivElement, ChartHoverLayerProps>(function ChartHoverLayer(\n { hover, label, height, anchor, tooltip, announcement, className, style, children, ...props },\n ref,\n) {\n const slot = useRef<HTMLDivElement>(null);\n\n // The tooltip's size is only known once drawn, so place it before the browser paints.\n useLayoutEffect(() => {\n const element = slot.current;\n if (!element || !anchor) return;\n const layer = element.parentElement as HTMLElement;\n const layerRect = layer.getBoundingClientRect();\n const boundsRect = (element.closest('[data-chart-frame]') ?? layer).getBoundingClientRect();\n const offsetX = layerRect.left - boundsRect.left;\n const offsetY = layerRect.top - boundsRect.top;\n const place = placeTooltip(\n { ...anchor, x: anchor.x + offsetX, y: anchor.y + offsetY },\n { width: element.offsetWidth, height: element.offsetHeight },\n { width: boundsRect.width, height: boundsRect.height },\n );\n element.style.transform = `translate(${place.x - offsetX}px, ${place.y - offsetY}px)`;\n });\n\n return (\n <div ref={ref} className={cx(styles.layer, className)} style={{ ...style, height }} {...props}>\n <div\n role={PLOT_ROLE}\n tabIndex={0}\n aria-label={label}\n className={styles.plot}\n data-active-index={hover.activeIndex ?? undefined}\n {...hover.plotProps}\n >\n {children}\n </div>\n {anchor && tooltip && (\n <div ref={slot} className={styles.slot}>\n {tooltip}\n </div>\n )}\n <div role=\"status\" className={chartMarks.srOnly}>\n {hover.source === 'keyboard' && hover.activeIndex !== null ? announcement : ''}\n </div>\n </div>\n );\n});\n","import { chartMarks } from './series';\n\n/** One row of a chart's data table. */\nexport interface ChartDataTableRow {\n /** Stable identifier. */\n id: string;\n /** Text in the first cell, which names the row. */\n header: string;\n /** Remaining cells, in column order. */\n cells: string[];\n}\n\nexport interface ChartDataTableProps {\n /** Names the table. Usually the chart's accessible name. */\n caption: string;\n /** Column headings, including the one above the row names. */\n columns: string[];\n /** The values. */\n rows: ChartDataTableRow[];\n}\n\n/** Visually hidden table of a chart's values, so that nothing depends on seeing the marks or hovering them. */\nexport function ChartDataTable({ caption, columns, rows }: ChartDataTableProps) {\n return (\n // The wrapper does the hiding: a table ignores a 1 px width and would otherwise widen whatever scrolls around it.\n <div className={chartMarks.srOnly}>\n <table>\n <caption>{caption}</caption>\n <thead>\n <tr>\n {columns.map((column) => (\n <th key={column} scope=\"col\">\n {column}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row) => (\n <tr key={row.id}>\n <th scope=\"row\">{row.header}</th>\n {row.cells.map((cell, i) => (\n <td key={columns[i + 1] ?? i}>{cell}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n",".frame {\n position: relative;\n min-width: 0;\n background: var(--color-bg-surface);\n color: var(--color-text-primary);\n}\n\n.empty {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n padding: var(--space-16);\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n text-align: center;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './ChartFrame.module.css';\n\nexport interface ChartFrameProps extends HTMLAttributes<HTMLDivElement> {\n /** Height reserved for the message when there is nothing to draw. */\n height: number;\n /** Shows `emptyMessage` in place of the chart and draws nothing. */\n empty?: boolean;\n /** Explains why there is nothing to draw. */\n emptyMessage?: ReactNode;\n}\n\n/** Root of every chart. Sets the surface the marks sit on, bounds the tooltip and shows the empty message. */\nexport const ChartFrame = forwardRef<HTMLDivElement, ChartFrameProps>(function ChartFrame(\n { height, empty = false, emptyMessage = 'No data to show.', className, children, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.frame, className)} data-chart-frame=\"\" {...props}>\n {empty ? (\n <p className={styles.empty} style={{ minHeight: height }}>\n {emptyMessage}\n </p>\n ) : (\n children\n )}\n </div>\n );\n});\n",".item {\n display: inline-flex;\n align-items: center;\n min-height: 24px;\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-md);\n background: var(--color-bg-surface);\n color: var(--color-text-primary);\n font: var(--font-label-s);\n}\n\n.chip,\n.toggle {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n padding: var(--space-2) var(--space-6);\n border: 0;\n border-radius: var(--radius-md);\n background: transparent;\n color: inherit;\n font: inherit;\n}\n\n.toggle {\n cursor: pointer;\n}\n\n.toggle:hover,\n.only:hover {\n background: var(--color-bg-hover);\n}\n\n.toggle:focus-visible,\n.only:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.swatch {\n flex: none;\n box-sizing: border-box;\n width: 8px;\n height: 8px;\n border: var(--stroke-strong) solid var(--chart-series-color);\n border-radius: var(--radius-full);\n background: var(--chart-series-color);\n}\n\n/* Revealed by hover or focus, but always in the tab order. */\n.only {\n max-width: 0;\n padding: var(--space-2) var(--space-0);\n overflow: hidden;\n border: 0;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--color-text-secondary);\n font: var(--font-caption);\n cursor: pointer;\n}\n\n.item:hover .only,\n.item:focus-within .only,\n.isolated .only {\n max-width: 64px;\n padding: var(--space-2) var(--space-6) var(--space-2) var(--space-2);\n}\n\n@media (hover: none) {\n .only {\n max-width: 64px;\n padding: var(--space-2) var(--space-6) var(--space-2) var(--space-2);\n }\n}\n\n.hidden .swatch {\n background: transparent;\n}\n\n.hidden .label {\n color: var(--color-text-tertiary);\n}\n\n.hidden .toggle:hover .label {\n color: var(--color-text-secondary);\n}\n\n.isolated {\n background: var(--color-bg-subtle);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { seriesColorClass } from '../ChartCore';\nimport styles from './ChartLegendItem.module.css';\n\nexport interface ChartLegendItemProps extends HTMLAttributes<HTMLSpanElement> {\n /** Series name. */\n label: string;\n /** Position of the series, which sets the swatch colour. It stays the same while other series are hidden. */\n colorIndex?: number;\n /** Whether the series is hidden: the swatch becomes a hollow ring and the text recedes. */\n seriesHidden?: boolean;\n /** Whether this is the only series showing. */\n isolated?: boolean;\n /** Called when the chip is clicked. Without it, the chip only names the series. */\n onToggle?: () => void;\n /** Called when \"Only\" is clicked. Without it, there is no \"Only\" button. */\n onOnly?: () => void;\n /** Word on the isolate button. */\n onlyLabel?: string;\n}\n\n/** Names a series. With `onToggle` it is a chip that shows or hides the series, and with `onOnly` it can isolate it. */\nexport const ChartLegendItem = forwardRef<HTMLSpanElement, ChartLegendItemProps>(function ChartLegendItem(\n { label, colorIndex = 0, seriesHidden = false, isolated = false, onToggle, onOnly, onlyLabel = 'Only', className, ...props },\n ref,\n) {\n const content = (\n <>\n <span className={styles.swatch} aria-hidden=\"true\" />\n <span className={styles.label}>{label}</span>\n </>\n );\n return (\n <span\n ref={ref}\n className={cx(styles.item, seriesColorClass(colorIndex), seriesHidden && styles.hidden, isolated && styles.isolated, className)}\n {...props}\n >\n {onToggle ? (\n <button type=\"button\" className={styles.toggle} aria-pressed={!seriesHidden} onClick={onToggle}>\n {content}\n </button>\n ) : (\n <span className={styles.chip}>{content}</span>\n )}\n {onOnly && (\n <button type=\"button\" className={styles.only} aria-pressed={isolated} aria-label={`${onlyLabel} ${label}`} onClick={onOnly}>\n {onlyLabel}\n </button>\n )}\n </span>\n );\n});\n","import { MAX_SERIES } from '../ChartCore';\n\n/** A series as the legend sees it. */\nexport interface ChartLegendEntry {\n /** Stable identifier, matching the series. */\n id: string;\n /** Series name. */\n label: string;\n}\n\n/** A chip in the legend. Other stands in for several series. */\nexport interface LegendChip extends ChartLegendEntry {\n /** The series this chip controls. */\n memberIds: string[];\n /** Position of the chip, which sets its colour. */\n colorIndex: number;\n}\n\n/** Turns series into chips, folding the rest into Other when there are more than five. */\nexport function legendChips(items: ChartLegendEntry[], otherLabel = 'Other'): LegendChip[] {\n const chip = (item: ChartLegendEntry, colorIndex: number): LegendChip => ({ ...item, memberIds: [item.id], colorIndex });\n if (items.length <= MAX_SERIES) return items.map(chip);\n const kept = items.slice(0, MAX_SERIES - 1).map(chip);\n const rest = items.slice(MAX_SERIES - 1).map((item) => item.id);\n return [...kept, { id: 'other', label: otherLabel, memberIds: rest, colorIndex: MAX_SERIES - 1 }];\n}\n\n/** Hidden ids after clicking a chip. Clicking the only series still showing brings all of them back, so a chart is never left blank. */\nexport function toggleHidden(allIds: string[], hidden: string[], memberIds: string[]): string[] {\n const isHidden = memberIds.every((id) => hidden.includes(id));\n if (isHidden) return hidden.filter((id) => !memberIds.includes(id));\n const next = [...new Set([...hidden, ...memberIds])];\n return next.length >= allIds.length ? [] : next;\n}\n\n/** Hidden ids after clicking \"Only\". Clicking it again on the isolated series brings all of them back. */\nexport function isolateHidden(allIds: string[], hidden: string[], memberIds: string[]): string[] {\n const others = allIds.filter((id) => !memberIds.includes(id));\n const alreadyIsolated = others.every((id) => hidden.includes(id)) && !memberIds.some((id) => hidden.includes(id));\n return alreadyIsolated ? [] : others;\n}\n","import { useState } from 'react';\n\nexport interface UseLegendStateOptions {\n /** Hidden series ids, when controlled. */\n hiddenIds?: string[];\n /** Hidden series ids at first, when uncontrolled. */\n defaultHiddenIds?: string[];\n /** Called with the new hidden ids. */\n onHiddenChange?: (hiddenIds: string[]) => void;\n}\n\n/** Controlled or uncontrolled record of which series are hidden. */\nexport function useLegendState({ hiddenIds, defaultHiddenIds = [], onHiddenChange }: UseLegendStateOptions) {\n const [internal, setInternal] = useState(defaultHiddenIds);\n const hidden = hiddenIds ?? internal;\n const setHidden = (next: string[]) => {\n if (hiddenIds === undefined) setInternal(next);\n onHiddenChange?.(next);\n };\n return [hidden, setHidden] as const;\n}\n",".legend {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-8);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { ChartLegendItem } from './ChartLegendItem';\nimport { isolateHidden, legendChips, toggleHidden, type ChartLegendEntry } from './legendHelpers';\nimport { useLegendState } from './useLegendState';\nimport styles from './ChartLegend.module.css';\n\nexport interface ChartLegendProps extends HTMLAttributes<HTMLDivElement> {\n /** The series, in chart order. Past five, the rest fold into Other. */\n items: ChartLegendEntry[];\n /** Hidden series ids, when controlled. */\n hiddenIds?: string[];\n /** Hidden series ids at first, when uncontrolled. */\n defaultHiddenIds?: string[];\n /** Called with the new hidden ids. */\n onHiddenChange?: (hiddenIds: string[]) => void;\n /** Whether chips can hide and isolate series. Turn off to only name them. */\n interactive?: boolean;\n /** Name of the chip that gathers the series past five. */\n otherLabel?: string;\n /** Accessible name of the group. */\n 'aria-label'?: string;\n}\n\n/** Row of series chips. Click a chip to hide its series, or \"Only\" to isolate it. Colour follows the series, so hiding one never repaints the others. */\nexport const ChartLegend = forwardRef<HTMLDivElement, ChartLegendProps>(function ChartLegend(\n {\n items,\n hiddenIds,\n defaultHiddenIds,\n onHiddenChange,\n interactive = true,\n otherLabel,\n 'aria-label': ariaLabel = 'Series',\n className,\n ...props\n },\n ref,\n) {\n const [hidden, setHidden] = useLegendState({ hiddenIds, defaultHiddenIds, onHiddenChange });\n const allIds = items.map((item) => item.id);\n const canIsolate = items.length > 1;\n\n return (\n <div ref={ref} role=\"group\" aria-label={ariaLabel} className={cx(styles.legend, className)} {...props}>\n {legendChips(items, otherLabel).map((chip) => {\n const seriesHidden = chip.memberIds.every((id) => hidden.includes(id));\n const isolated = canIsolate && hidden.length > 0 && allIds.every((id) => chip.memberIds.includes(id) !== hidden.includes(id));\n return (\n <ChartLegendItem\n key={chip.id}\n label={chip.label}\n colorIndex={chip.colorIndex}\n seriesHidden={seriesHidden}\n isolated={isolated}\n onToggle={interactive ? () => setHidden(toggleHidden(allIds, hidden, chip.memberIds)) : undefined}\n onOnly={interactive && canIsolate ? () => setHidden(isolateHidden(allIds, hidden, chip.memberIds)) : undefined}\n />\n );\n })}\n </div>\n );\n});\n",".tooltip {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n min-width: 140px;\n padding: var(--space-8);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-md);\n background: var(--color-bg-surface);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n}\n\n.title {\n font: var(--font-label-s);\n}\n\n.row {\n display: flex;\n align-items: center;\n gap: var(--space-6);\n}\n\n.swatch {\n flex: none;\n width: 8px;\n height: 8px;\n border-radius: var(--radius-full);\n background: var(--chart-series-color);\n}\n\n.name {\n flex: 1;\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.value {\n margin-left: var(--space-16);\n font: var(--font-label-s);\n font-variant-numeric: tabular-nums;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { seriesColorClass } from '../ChartCore';\nimport styles from './ChartTooltip.module.css';\n\n/** One line of a chart tooltip. */\nexport interface ChartTooltipRow {\n /** Stable identifier. */\n id: string;\n /** Series name. */\n name: string;\n /** Formatted value. */\n value: string;\n /** Position of the series, which sets the swatch colour. Defaults to the row's position. */\n colorIndex?: number;\n}\n\nexport interface ChartTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** What the values belong to, such as a date or category. */\n title: ReactNode;\n /** One row per visible series. */\n rows: ChartTooltipRow[];\n}\n\n/** Exact values for one point across the visible series. The value is the strong element, and text stays in text tokens. */\nexport const ChartTooltip = forwardRef<HTMLDivElement, ChartTooltipProps>(function ChartTooltip({ title, rows, className, ...props }, ref) {\n return (\n <div ref={ref} role=\"tooltip\" className={cx(styles.tooltip, className)} {...props}>\n <div className={styles.title}>{title}</div>\n {rows.map((row, i) => (\n <div key={row.id} className={cx(styles.row, seriesColorClass(row.colorIndex ?? i))}>\n <span className={styles.swatch} aria-hidden=\"true\" />\n <span className={styles.name}>{row.name}</span>\n <span className={styles.value}>{row.value}</span>\n </div>\n ))}\n </div>\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport {\n ChartAxes,\n ChartDataTable,\n ChartFrame,\n ChartHoverLayer,\n areaPath,\n chartMarks,\n clamp,\n estimateTextWidth,\n foldSeries,\n formatTicks,\n formatValue as defaultFormatValue,\n hasSeriesData,\n lastRecordedIndex,\n linePath,\n linearScale,\n niceTicks,\n seriesColorClass,\n seriesLabels,\n seriesValues,\n thinTickIndexes,\n useChartHover,\n useChartSize,\n type ChartSeries,\n} from '../ChartCore';\nimport { ChartLegend, useLegendState } from '../ChartLegend';\nimport { ChartTooltip } from '../ChartTooltip';\n\n/** Props shared by LineChart and AreaChart. */\nexport interface SeriesChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The series to draw. Up to five; any more fold into Other. */\n series: ChartSeries[];\n /** Height of the plot in pixels, including the axis labels. Width fills the container. */\n height?: number;\n /** Accessible name of the chart. Say what it shows. */\n 'aria-label'?: string;\n /** Shown in place of the chart when there is no data. */\n emptyMessage?: ReactNode;\n /** Formats values in labels, tooltips and the data table. */\n formatValue?: (value: number) => string;\n /** Draws the end marker and end value of each series. Turn off for small charts inside a card. */\n showEndMarkers?: boolean;\n /** Hidden series ids, when controlled. */\n hiddenSeries?: string[];\n /** Hidden series ids at first, when uncontrolled. */\n defaultHiddenSeries?: string[];\n /** Called with the new hidden series ids. */\n onHiddenSeriesChange?: (hiddenSeries: string[]) => void;\n}\n\ninterface InternalProps extends SeriesChartProps {\n /** Adds the wash under each line. */\n wash: boolean;\n}\n\nconst MARKER_RADIUS = 5;\nconst LABEL_MIN_GAP = 16;\nconst MAX_LABELLED_SERIES = 4;\n\n/** The chart behind LineChart and AreaChart, which differ only in the wash. */\nexport const SeriesChartInternal = forwardRef<HTMLDivElement, InternalProps>(function SeriesChartInternal(\n {\n series,\n height = 240,\n 'aria-label': ariaLabel = 'Chart',\n emptyMessage,\n formatValue = defaultFormatValue,\n showEndMarkers = true,\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n wash,\n className,\n ...props\n },\n ref,\n) {\n const { ref: sizeRef, width } = useChartSize(ref);\n const [hidden, setHidden] = useLegendState({\n hiddenIds: hiddenSeries,\n defaultHiddenIds: defaultHiddenSeries,\n onHiddenChange: onHiddenSeriesChange,\n });\n\n const folded = foldSeries(series);\n const empty = !hasSeriesData(folded);\n const shown = folded.flatMap((item, colorIndex) => (hidden.includes(item.id) ? [] : [{ ...item, colorIndex }]));\n const labels = seriesLabels(folded);\n const count = labels.length;\n\n const values = seriesValues(shown);\n const ticks = niceTicks(Math.min(0, ...values), Math.max(1, ...values));\n const tickLabels = formatTicks(ticks);\n\n const ends = shown.flatMap((item) => {\n const index = lastRecordedIndex(item.points.map((point) => point.value));\n return index < 0 ? [] : [{ item, index, value: item.points[index].value as number }];\n });\n const showLabels = showEndMarkers && shown.length <= MAX_LABELLED_SERIES;\n const labelRoom = showLabels ? Math.max(0, ...ends.map((end) => estimateTextWidth(formatValue(end.value)))) + 12 : 0;\n\n const plot = {\n left: Math.max(...tickLabels.map(estimateTextWidth), 16) + 12,\n right: width - Math.max(labelRoom, MARKER_RADIUS + 1),\n top: 8,\n bottom: height - 24,\n };\n const step = count > 1 ? (plot.right - plot.left) / (count - 1) : 0;\n const xAt = (i: number) => (count > 1 ? plot.left + i * step : (plot.left + plot.right) / 2);\n const yAt = linearScale([ticks[0], ticks[ticks.length - 1]], [plot.bottom, plot.top]);\n\n const hover = useChartHover({\n count,\n locate: (x) => (count > 1 ? clamp(Math.round((x - plot.left) / step), 0, count - 1) : 0),\n });\n const active = hover.activeIndex;\n\n const activePoints =\n active === null\n ? []\n : shown.map((item) => {\n const value = item.points[active]?.value ?? null;\n return { item, value };\n });\n const recorded = activePoints.flatMap((point) => (point.value === null ? [] : [point.value]));\n const anchor = active === null ? null : { x: xAt(active), y: recorded.length ? yAt(Math.max(...recorded)) : plot.top };\n const rows = activePoints.map(({ item, value }) => ({\n id: item.id,\n name: item.name,\n value: value === null ? 'No data' : formatValue(value),\n colorIndex: item.colorIndex,\n }));\n const title = active === null ? '' : labels[active];\n\n // Labels that would collide are left to the tooltip and table, rather than nudged away from their lines.\n const placedLabels: number[] = [];\n const endLabels = showLabels\n ? [...ends]\n .sort((a, b) => yAt(a.value) - yAt(b.value))\n .filter((end) => {\n const y = yAt(end.value);\n if (placedLabels.some((placed) => Math.abs(placed - y) < LABEL_MIN_GAP)) return false;\n placedLabels.push(y);\n return true;\n })\n : [];\n\n const xTicks = thinTickIndexes(count, step).map((i) => ({ position: xAt(i), label: labels[i] }));\n const yTicks = ticks.map((tick, i) => ({ position: yAt(tick), label: tickLabels[i] }));\n\n return (\n <ChartFrame ref={sizeRef} height={height} empty={empty} emptyMessage={emptyMessage} className={className} {...props}>\n {folded.length > 1 && (\n <ChartLegend\n items={folded.map((item) => ({ id: item.id, label: item.name }))}\n hiddenIds={hidden}\n onHiddenChange={setHidden}\n style={{ marginBottom: 'var(--space-8)' }}\n />\n )}\n {width > 0 && (\n <ChartHoverLayer\n hover={hover}\n label={ariaLabel}\n height={height}\n anchor={anchor}\n tooltip={<ChartTooltip title={title} rows={rows} />}\n announcement={[title, ...rows.map((row) => `${row.name} ${row.value}`)].join(', ')}\n >\n <svg className={chartMarks.svg} width={width} height={height} aria-hidden=\"true\">\n <ChartAxes plot={plot} xTicks={xTicks} yTicks={yTicks} />\n {wash &&\n shown.map((item) => (\n <path\n key={item.id}\n className={cx(chartMarks.wash, seriesColorClass(item.colorIndex))}\n d={areaPath(\n item.points.map((point, i) => (point.value === null ? null : { x: xAt(i), y: yAt(point.value) })),\n yAt(Math.max(0, ticks[0])),\n )}\n />\n ))}\n {anchor && <line className={chartMarks.crosshair} x1={anchor.x} x2={anchor.x} y1={plot.top} y2={plot.bottom} />}\n {shown.map((item) => (\n <path\n key={item.id}\n className={cx(chartMarks.line, seriesColorClass(item.colorIndex))}\n d={linePath(item.points.map((point, i) => (point.value === null ? null : { x: xAt(i), y: yAt(point.value) })))}\n />\n ))}\n {showEndMarkers &&\n ends.map(({ item, index, value }) => (\n <circle\n key={item.id}\n className={cx(chartMarks.marker, seriesColorClass(item.colorIndex))}\n cx={xAt(index)}\n cy={yAt(value)}\n r={MARKER_RADIUS}\n />\n ))}\n {endLabels.map(({ item, index, value }) => (\n <text key={item.id} className={chartMarks.valueLabel} x={xAt(index) + 10} y={yAt(value)} dominantBaseline=\"central\">\n {formatValue(value)}\n </text>\n ))}\n {active !== null &&\n activePoints.map(({ item, value }) =>\n value === null ? null : (\n <circle\n key={item.id}\n className={cx(chartMarks.marker, seriesColorClass(item.colorIndex))}\n cx={xAt(active)}\n cy={yAt(value)}\n r={MARKER_RADIUS}\n />\n ),\n )}\n </svg>\n </ChartHoverLayer>\n )}\n <ChartDataTable\n caption={ariaLabel}\n columns={['Point', ...folded.map((item) => item.name)]}\n rows={labels.map((label, i) => ({\n id: `${label}-${i}`,\n header: label,\n cells: folded.map((item) => {\n const value = item.points[i]?.value ?? null;\n return value === null ? 'No data' : formatValue(value);\n }),\n }))}\n />\n </ChartFrame>\n );\n});\n","import { forwardRef } from 'react';\nimport { SeriesChartInternal, type SeriesChartProps } from '../LineChart/SeriesChartInternal';\n\nexport type AreaChartProps = SeriesChartProps;\n\n/** A line chart with a 10% wash down to a zero baseline, for volume over time. Areas overlap rather than stack. */\nexport const AreaChart = forwardRef<HTMLDivElement, AreaChartProps>(function AreaChart(\n { 'aria-label': ariaLabel = 'Area chart', ...props },\n ref,\n) {\n return <SeriesChartInternal ref={ref} aria-label={ariaLabel} wash {...props} />;\n});\n",".button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--space-6);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-md);\n font-family: inherit;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.button:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.button:disabled {\n background: var(--color-bg-disabled);\n border-color: transparent;\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.md {\n padding: var(--space-8) var(--space-14);\n font: var(--font-label-m);\n}\n\n.sm {\n padding: var(--space-6) var(--space-10);\n font: var(--font-label-s);\n}\n\n.primary {\n background: var(--color-bg-accent);\n color: var(--color-text-on-accent);\n}\n\n.primary:hover:not(:disabled) {\n background: var(--color-bg-accent-hover);\n}\n\n.inverse {\n background: var(--color-bg-inverse);\n color: var(--color-text-inverse);\n}\n\n.inverse:hover:not(:disabled) {\n background: var(--color-bg-inverse-hover);\n}\n\n.secondary {\n background: var(--color-bg-canvas);\n border-color: var(--color-border-default);\n color: var(--color-text-primary);\n}\n\n.secondary:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.secondary:disabled {\n background: var(--color-bg-canvas);\n border-color: var(--color-border-disabled);\n}\n\n.ghost {\n background: transparent;\n color: var(--color-text-primary);\n}\n\n.ghost:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.ghost:disabled {\n background: transparent;\n}\n\n.danger {\n background: var(--color-bg-danger);\n color: var(--color-text-on-danger);\n}\n\n.danger:hover:not(:disabled) {\n background: var(--color-bg-danger-hover);\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './Button.module.css';\n\nexport type ButtonVariant = 'primary' | 'inverse' | 'secondary' | 'ghost' | 'danger';\nexport type ButtonSize = 'md' | 'sm';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual emphasis. Use `primary` at most once per view. */\n variant?: ButtonVariant;\n /** Control height: `md` is 34 px and `sm` is 28 px. */\n size?: ButtonSize;\n /** Icon before the label. */\n leadingIcon?: IconName;\n /** Icon after the label, for direction or a menu. */\n trailingIcon?: IconName;\n}\n\n/** Triggers an action. For navigation, use Link instead. */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { variant = 'primary', size = 'md', leadingIcon, trailingIcon, className, children, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.button, styles[variant], styles[size], className)} {...props}>\n {leadingIcon && <Icon name={leadingIcon} />}\n {children}\n {trailingIcon && <Icon name={trailingIcon} />}\n </button>\n );\n});\n",".field {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n}\n\n.header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--space-12);\n}\n\n.label {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.hint {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.box {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-8);\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-lg);\n}\n\n.empty {\n border-style: dashed;\n}\n\n.error {\n border-color: var(--color-border-danger);\n}\n\n.thumbnail {\n display: block;\n flex: none;\n overflow: hidden;\n width: 72px;\n height: 48px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-md);\n}\n\n.empty .thumbnail {\n background: transparent;\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.text {\n flex: 1;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.empty .title {\n color: var(--color-text-secondary);\n}\n\n.description {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.error .description {\n color: var(--color-text-danger);\n}\n\n.input {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n}\n","import { forwardRef, useId, useRef, type ChangeEvent, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Button } from '../Button';\nimport styles from './AssetField.module.css';\n\nexport type AssetFieldState = 'filled' | 'empty' | 'error';\n\nexport interface AssetFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onChange'> {\n /** The name of the field. */\n label: ReactNode;\n /** A quieter note at the right of the label. */\n hint?: ReactNode;\n /** `filled` has a file, `empty` has none and `error` has a file that cannot be used. */\n state?: AssetFieldState;\n /** Thumbnail of the file. */\n src?: string;\n /** The first line in the box: the file name, or what is missing. */\n title?: ReactNode;\n /** The second line in the box. When `error`, say what is wrong. */\n description?: ReactNode;\n /** Text of the button. Defaults to `Choose…` when `empty`, and otherwise `Replace`. */\n actionLabel?: string;\n /** Accessible name of the file input. */\n inputLabel?: string;\n /** File types to accept, as for a file input. */\n accept?: string;\n /** Called with the file the person chose. */\n onFileSelect?: (file: File) => void;\n}\n\n/** Shows the file in a field and lets the person choose or replace it. */\nexport const AssetField = forwardRef<HTMLDivElement, AssetFieldProps>(function AssetField(\n {\n label,\n hint,\n state = 'filled',\n src,\n title,\n description,\n actionLabel,\n inputLabel = 'Choose a file',\n accept,\n onFileSelect,\n className,\n ...props\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const descriptionId = useId();\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (file) onFileSelect?.(file);\n // Lets the same file be chosen again.\n event.target.value = '';\n };\n\n return (\n <div ref={ref} className={cx(styles.field, className)} {...props}>\n <div className={styles.header}>\n <span className={styles.label}>{label}</span>\n {hint && <span className={styles.hint}>{hint}</span>}\n </div>\n <div className={cx(styles.box, styles[state])}>\n <span className={styles.thumbnail}>{src && state !== 'empty' && <img className={styles.image} src={src} alt=\"\" />}</span>\n <div className={styles.text}>\n <div className={styles.title}>{title}</div>\n {description && (\n <div id={descriptionId} className={styles.description}>\n {description}\n </div>\n )}\n </div>\n <input\n ref={inputRef}\n type=\"file\"\n className={styles.input}\n accept={accept}\n aria-label={inputLabel}\n aria-describedby={description ? descriptionId : undefined}\n aria-invalid={state === 'error' || undefined}\n tabIndex={-1}\n onChange={onChange}\n />\n <Button variant=\"ghost\" size=\"sm\" onClick={() => inputRef.current?.click()}>\n {actionLabel ?? (state === 'empty' ? 'Choose…' : 'Replace')}\n </Button>\n </div>\n </div>\n );\n});\n",".iconButton {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-md);\n cursor: pointer;\n}\n\n.iconButton:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.iconButton:disabled {\n background: var(--color-bg-disabled);\n border-color: transparent;\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.md {\n width: 34px;\n height: 34px;\n}\n\n.sm {\n width: 28px;\n height: 28px;\n}\n\n.primary {\n background: var(--color-bg-accent);\n color: var(--color-icon-on-accent);\n}\n\n.primary:hover:not(:disabled) {\n background: var(--color-bg-accent-hover);\n}\n\n.secondary {\n background: var(--color-bg-canvas);\n border-color: var(--color-border-default);\n color: var(--color-icon-primary);\n}\n\n.secondary:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.secondary:disabled {\n background: var(--color-bg-canvas);\n border-color: var(--color-border-disabled);\n}\n\n.ghost {\n background: transparent;\n color: var(--color-icon-primary);\n}\n\n.ghost:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.ghost:disabled {\n background: transparent;\n}\n\n.danger {\n background: var(--color-bg-danger);\n color: var(--color-icon-on-danger);\n}\n\n.danger:hover:not(:disabled) {\n background: var(--color-bg-danger-hover);\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './IconButton.module.css';\n\nexport type IconButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';\nexport type IconButtonSize = 'md' | 'sm';\n\nexport interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {\n /** Icon to draw. */\n icon: IconName;\n /** Accessible name, announced by screen readers because the button has no visible text. */\n label: string;\n /** Visual emphasis. Use `primary` at most once per view. */\n variant?: IconButtonVariant;\n /** Square size: `md` is 34 px and `sm` is 28 px. */\n size?: IconButtonSize;\n}\n\n/** Compact action with an icon only. Add a Tooltip if the icon is not universally understood. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { icon, label, variant = 'secondary', size = 'md', className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.iconButton, styles[variant], styles[size], className)} {...props} aria-label={label}>\n <Icon name={icon} />\n </button>\n );\n});\n",".banner {\n position: relative;\n display: flex;\n align-items: flex-start;\n gap: var(--space-8);\n padding: var(--space-14) var(--space-16);\n border-radius: var(--radius-lg);\n color: var(--color-text-primary);\n}\n\n.dismissible {\n padding-right: var(--space-40);\n}\n\n.icon {\n flex: none;\n margin-top: var(--space-2);\n}\n\n.content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n\n.title {\n font: var(--font-heading-s);\n}\n\n.body {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.action {\n margin-top: var(--space-2);\n font: var(--font-label-s);\n}\n\n.dismiss {\n position: absolute;\n top: var(--space-8);\n right: var(--space-8);\n}\n\n.info {\n background: var(--color-bg-subtle);\n}\n\n.info .icon {\n color: var(--color-icon-primary);\n}\n\n.accent {\n background: var(--color-bg-accent-subtle);\n}\n\n.accent .icon {\n color: var(--color-icon-accent);\n}\n\n.success {\n background: var(--color-bg-subtle);\n}\n\n.success .icon {\n color: var(--color-icon-success);\n}\n\n.warning {\n background: var(--color-bg-subtle);\n}\n\n.warning .icon {\n color: var(--color-icon-warning);\n}\n\n.danger {\n background: var(--color-bg-danger-subtle);\n}\n\n.danger .icon {\n color: var(--color-icon-danger);\n}\n\n.production {\n background: var(--color-bg-canvas);\n outline: var(--stroke-strong) solid var(--color-border-strong);\n outline-offset: calc(var(--stroke-strong) * -1);\n}\n\n.production .icon {\n color: var(--color-icon-primary);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport styles from './Banner.module.css';\n\nexport type BannerTone = 'info' | 'accent' | 'success' | 'warning' | 'danger' | 'production';\n\nconst TONE_ICONS: Record<BannerTone, IconName> = {\n info: 'info',\n accent: 'info',\n success: 'check-circle',\n warning: 'alert-triangle',\n danger: 'x-circle',\n production: 'lock',\n};\n\nexport interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** What the message is about. `production` marks actions that affect the live environment. */\n tone?: BannerTone;\n /** The headline. */\n title: ReactNode;\n /** What happened and what to do next. */\n children?: ReactNode;\n /** A follow-up, normally a Link. */\n action?: ReactNode;\n /** Shows a dismiss button, and is called when it is pressed. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss button. */\n dismissLabel?: string;\n}\n\n/** A page or section-level message. Danger is announced as an alert, every other tone as a status. */\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { tone = 'info', title, children, action, onDismiss, dismissLabel = 'Dismiss', className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n role={tone === 'danger' ? 'alert' : 'status'}\n className={cx(styles.banner, styles[tone], onDismiss && styles.dismissible, className)}\n {...props}\n >\n <Icon name={TONE_ICONS[tone]} className={styles.icon} />\n <div className={styles.content}>\n <div className={styles.title}>{title}</div>\n {children && <div className={styles.body}>{children}</div>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n {onDismiss && <IconButton className={styles.dismiss} icon=\"x\" label={dismissLabel} variant=\"ghost\" size=\"sm\" onClick={onDismiss} />}\n </div>\n );\n});\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport {\n ChartAxes,\n ChartDataTable,\n ChartFrame,\n ChartHoverLayer,\n barPath,\n chartMarks,\n clamp,\n estimateTextWidth,\n foldSeries,\n formatTicks,\n formatValue as defaultFormatValue,\n hasSeriesData,\n linearScale,\n niceTicks,\n seriesColorClass,\n seriesLabels,\n thinTickIndexes,\n useChartHover,\n useChartSize,\n type ChartSeries,\n} from '../ChartCore';\nimport { ChartLegend, useLegendState } from '../ChartLegend';\nimport { ChartTooltip } from '../ChartTooltip';\n\nexport type BarChartType = 'column' | 'grouped' | 'stacked' | 'horizontal';\n\nexport interface BarChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The series to draw. Up to five; any more fold into Other. */\n series: ChartSeries[];\n /** `column` and `grouped` stand on the x axis, `stacked` sums series in one bar, and `horizontal` suits long or ranked labels. */\n type?: BarChartType;\n /** Height of the plot in pixels, including the axis labels. Width fills the container. */\n height?: number;\n /** Accessible name of the chart. Say what it shows. */\n 'aria-label'?: string;\n /** Shown in place of the chart when there is no data. */\n emptyMessage?: ReactNode;\n /** Formats values in labels, tooltips and the data table. */\n formatValue?: (value: number) => string;\n /** Hidden series ids, when controlled. */\n hiddenSeries?: string[];\n /** Hidden series ids at first, when uncontrolled. */\n defaultHiddenSeries?: string[];\n /** Called with the new hidden series ids. */\n onHiddenSeriesChange?: (hiddenSeries: string[]) => void;\n}\n\nconst MAX_BAR = 24;\nconst GAP = 2;\nconst RADIUS = 4;\n\ninterface BarMark {\n key: string;\n colorIndex: number;\n d: string;\n}\n\ninterface BarLabel {\n key: string;\n x: number;\n y: number;\n anchor: 'middle' | 'start';\n text: string;\n}\n\n/** Compares categories. Bars are at most 24 px, rounded at the data end and square at the baseline, with 2 px gaps where they touch. */\nexport const BarChart = forwardRef<HTMLDivElement, BarChartProps>(function BarChart(\n {\n series,\n type = 'column',\n height = 240,\n 'aria-label': ariaLabel = 'Bar chart',\n emptyMessage,\n formatValue = defaultFormatValue,\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n className,\n ...props\n },\n ref,\n) {\n const { ref: sizeRef, width } = useChartSize(ref);\n const [hidden, setHidden] = useLegendState({\n hiddenIds: hiddenSeries,\n defaultHiddenIds: defaultHiddenSeries,\n onHiddenChange: onHiddenSeriesChange,\n });\n\n const folded = foldSeries(series);\n const empty = !hasSeriesData(folded);\n const shown = folded.flatMap((item, colorIndex) => (hidden.includes(item.id) ? [] : [{ ...item, colorIndex }]));\n const labels = seriesLabels(folded);\n const count = labels.length;\n const horizontal = type === 'horizontal';\n const stacked = type === 'stacked';\n\n const valueAt = (item: ChartSeries, i: number) => item.points[i]?.value ?? null;\n // Stacks only sum what is above zero, so that a stray negative cannot pull a stack apart.\n const stackTotal = (i: number) => shown.reduce((sum, item) => sum + Math.max(0, valueAt(item, i) ?? 0), 0);\n const extents = stacked\n ? labels.map((_, i) => stackTotal(i))\n : shown.flatMap((item) => item.points.flatMap((point) => (point.value === null ? [] : [point.value])));\n const ticks = niceTicks(Math.min(0, ...extents), Math.max(1, ...extents));\n const tickLabels = formatTicks(ticks);\n const lastTick = ticks[ticks.length - 1];\n\n const categoryRoom = Math.max(0, ...labels.map(estimateTextWidth)) + 12;\n const valueRoom = Math.max(0, ...extents.map((value) => estimateTextWidth(formatValue(value)))) + 12;\n const plot = horizontal\n ? { left: categoryRoom, right: width - valueRoom, top: 0, bottom: height }\n : { left: Math.max(...tickLabels.map(estimateTextWidth), 16) + 12, right: width - 4, top: 20, bottom: height - 24 };\n\n const bandSize = count ? (horizontal ? plot.bottom - plot.top : plot.right - plot.left) / count : 0;\n const bandStart = (i: number) => (horizontal ? plot.top : plot.left) + i * bandSize;\n const toPixel = linearScale([ticks[0], lastTick], horizontal ? [plot.left, plot.right] : [plot.bottom, plot.top]);\n const zero = toPixel(Math.max(0, ticks[0]));\n\n const slots = stacked ? 1 : Math.max(1, shown.length);\n const thickness = Math.max(2, Math.min(MAX_BAR, (bandSize * 0.72 - GAP * (slots - 1)) / slots));\n const groupSize = thickness * slots + GAP * (slots - 1);\n\n const bars: BarMark[] = [];\n labels.forEach((_, i) => {\n const start = bandStart(i) + (bandSize - groupSize) / 2;\n if (stacked) {\n const parts = shown.flatMap((item) => {\n const value = Math.max(0, valueAt(item, i) ?? 0);\n return value > 0 ? [{ item, value }] : [];\n });\n let sum = 0;\n parts.forEach(({ item, value }, partIndex) => {\n const bottom = toPixel(sum);\n const top = toPixel(sum + value);\n sum += value;\n const isFirst = partIndex === 0;\n const isLast = partIndex === parts.length - 1;\n // The gap comes off the baseline side of each upper part, so the top of the stack still reaches its total.\n const barHeight = Math.max(1, bottom - top - (isFirst ? 0 : GAP));\n bars.push({\n key: `${item.id}-${i}`,\n colorIndex: item.colorIndex,\n d: barPath(start, top, thickness, barHeight, 'up', isLast ? RADIUS : 0),\n });\n });\n return;\n }\n shown.forEach((item, slot) => {\n const value = valueAt(item, i);\n if (value === null || value === 0) return;\n const offset = start + slot * (thickness + GAP);\n const end = toPixel(value);\n const length = Math.abs(end - zero);\n const d = horizontal\n ? barPath(Math.min(end, zero), offset, length, thickness, value > 0 ? 'right' : 'left', RADIUS)\n : barPath(offset, Math.min(end, zero), thickness, length, value > 0 ? 'up' : 'down', RADIUS);\n bars.push({ key: `${item.id}-${i}`, colorIndex: item.colorIndex, d });\n });\n });\n\n // Value labels are selective: every ranked horizontal bar, or the highest and latest of a single column series.\n const barLabels: BarLabel[] = [];\n if (shown.length === 1 && !stacked) {\n const [only] = shown;\n const recorded = only.points.flatMap((point, i) => (point.value === null ? [] : [{ value: point.value, i }]));\n const labelled = horizontal\n ? recorded\n : recorded.filter(({ value, i }) => i === recorded[recorded.length - 1].i || value === Math.max(...recorded.map((r) => r.value)));\n labelled.forEach(({ value, i }) => {\n const centre = bandStart(i) + bandSize / 2;\n barLabels.push(\n horizontal\n ? { key: `${i}`, x: toPixel(value) + 6, y: centre, anchor: 'start', text: formatValue(value) }\n : { key: `${i}`, x: centre, y: toPixel(value) - 10, anchor: 'middle', text: formatValue(value) },\n );\n });\n }\n\n const hover = useChartHover({\n count,\n locate: (x, y) => {\n const position = horizontal ? y - plot.top : x - plot.left;\n return bandSize > 0 ? clamp(Math.floor(position / bandSize), 0, count - 1) : null;\n },\n });\n const active = hover.activeIndex;\n\n const rows =\n active === null\n ? []\n : shown.map((item) => {\n const value = valueAt(item, active);\n return { id: item.id, name: item.name, value: value === null ? 'No data' : formatValue(value), colorIndex: item.colorIndex };\n });\n const title = active === null ? '' : labels[active];\n let anchor = null;\n if (active !== null) {\n const centre = bandStart(active) + bandSize / 2;\n const reach = bandSize / 2;\n const peak = stacked ? stackTotal(active) : Math.max(0, ...shown.map((item) => valueAt(item, active) ?? 0));\n anchor = horizontal ? { x: toPixel(peak), y: centre, reach: 4 } : { x: centre, y: toPixel(peak), reach };\n }\n\n const xTicks = horizontal\n ? []\n : thinTickIndexes(count, bandSize, 32).map((i) => ({ position: bandStart(i) + bandSize / 2, label: labels[i] }));\n const yTicks = horizontal\n ? labels.map((label, i) => ({ position: bandStart(i) + bandSize / 2, label }))\n : ticks.map((tick, i) => ({ position: toPixel(tick), label: tickLabels[i] }));\n\n return (\n <ChartFrame ref={sizeRef} height={height} empty={empty} emptyMessage={emptyMessage} className={className} {...props}>\n {folded.length > 1 && (\n <ChartLegend\n items={folded.map((item) => ({ id: item.id, label: item.name }))}\n hiddenIds={hidden}\n onHiddenChange={setHidden}\n style={{ marginBottom: 'var(--space-8)' }}\n />\n )}\n {width > 0 && (\n <ChartHoverLayer\n hover={hover}\n label={ariaLabel}\n height={height}\n anchor={anchor}\n tooltip={<ChartTooltip title={title} rows={rows} />}\n announcement={[title, ...rows.map((row) => `${row.name} ${row.value}`)].join(', ')}\n >\n <svg className={chartMarks.svg} width={width} height={height} aria-hidden=\"true\">\n {active !== null &&\n (horizontal ? (\n <rect className={chartMarks.band} x={0} y={bandStart(active)} width={width} height={bandSize} />\n ) : (\n <rect className={chartMarks.band} x={bandStart(active)} y={plot.top} width={bandSize} height={plot.bottom - plot.top} />\n ))}\n <ChartAxes plot={plot} xTicks={xTicks} yTicks={yTicks} grid={!horizontal} categoryY={horizontal} leftBaseline={horizontal} />\n {bars.map((bar) => (\n <path key={bar.key} className={cx(chartMarks.bar, seriesColorClass(bar.colorIndex))} d={bar.d} />\n ))}\n {barLabels.map((label) => (\n <text\n key={label.key}\n className={chartMarks.valueLabel}\n x={label.x}\n y={label.y}\n textAnchor={label.anchor}\n dominantBaseline=\"central\"\n >\n {label.text}\n </text>\n ))}\n </svg>\n </ChartHoverLayer>\n )}\n <ChartDataTable\n caption={ariaLabel}\n columns={['Category', ...folded.map((item) => item.name)]}\n rows={labels.map((label, i) => ({\n id: `${label}-${i}`,\n header: label,\n cells: folded.map((item) => {\n const value = valueAt(item, i);\n return value === null ? 'No data' : formatValue(value);\n }),\n }))}\n />\n </ChartFrame>\n );\n});\n",".header {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-10) var(--space-0);\n border-bottom: var(--stroke-hairline) solid var(--color-border-default);\n}\n\n.kind {\n flex: none;\n width: 120px;\n color: var(--color-text-secondary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.title {\n flex: 1;\n min-width: 0;\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.meta {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n white-space: nowrap;\n}\n\n.error {\n border-bottom-color: var(--color-border-danger);\n}\n\n.error .kind,\n.error .meta {\n color: var(--color-text-danger);\n}\n\n.grip {\n flex: none;\n color: var(--color-icon-muted);\n}\n","import { forwardRef, type HTMLAttributes, type MouseEventHandler, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Button } from '../Button';\nimport { IconButton } from '../IconButton';\nimport styles from './BlockHeader.module.css';\n\nexport type BlockHeaderState = 'expanded' | 'error' | 'locked';\n\nexport interface BlockHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** `expanded` is open for editing, `error` also has problems to fix and `locked` is read-only. */\n state?: BlockHeaderState;\n /** A short overline at the left, such as the kind of block. */\n kind?: ReactNode;\n /** The title of the block. */\n title: ReactNode;\n /** A quieter note at the right. When `error`, say how many problems there are. */\n meta?: ReactNode;\n /** Text of the action button. Defaults to `Done`, or `View` when `locked`. */\n actionLabel?: string;\n /** Called by the action button. */\n onAction?: MouseEventHandler<HTMLButtonElement>;\n /** Called by the More button. Without it, no button is shown. */\n onMore?: MouseEventHandler<HTMLButtonElement>;\n /** Accessible name of the More button. Name the block. */\n moreLabel?: string;\n}\n\n/** The bar at the top of an editable block, with its title, state and actions. */\nexport const BlockHeader = forwardRef<HTMLDivElement, BlockHeaderProps>(function BlockHeader(\n { state = 'expanded', kind, title, meta, actionLabel, onAction, onMore, moreLabel = 'More actions', className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.header, styles[state], className)} {...props}>\n <svg className={styles.grip} width=\"8\" height=\"14\" viewBox=\"0 0 8 14\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"1.5\" cy=\"2\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"2\" r=\"1\" />\n <circle cx=\"1.5\" cy=\"7\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"7\" r=\"1\" />\n <circle cx=\"1.5\" cy=\"12\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"12\" r=\"1\" />\n </svg>\n {kind && <span className={styles.kind}>{kind}</span>}\n <div className={styles.title}>{title}</div>\n {meta && <span className={styles.meta}>{meta}</span>}\n <Button variant=\"ghost\" size=\"sm\" onClick={onAction}>\n {actionLabel ?? (state === 'locked' ? 'View' : 'Done')}\n </Button>\n {onMore && <IconButton icon=\"more\" label={moreLabel} variant=\"ghost\" size=\"sm\" onClick={onMore} />}\n </div>\n );\n});\n",".list {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-6);\n margin: var(--space-0);\n padding: var(--space-0);\n list-style: none;\n}\n\n.collapsed {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n}\n\n.ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: var(--space-2);\n border: none;\n border-radius: var(--radius-sm);\n background: transparent;\n color: var(--color-text-secondary);\n cursor: pointer;\n}\n\n.ellipsis:hover {\n background: var(--color-bg-hover);\n color: var(--color-text-primary);\n}\n\n.ellipsis:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.separator {\n flex: none;\n color: var(--color-icon-secondary);\n}\n","import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactElement,\n} from 'react';\nimport { Icon } from '../../icons';\nimport type { BreadcrumbItemProps } from './BreadcrumbItem';\nimport styles from './Breadcrumb.module.css';\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n /** Above this many items, the middle ones collapse into an ellipsis that expands when pressed. */\n maxItems?: number;\n /** Accessible name of the ellipsis button, given the number of hidden items. */\n expandLabel?: (hiddenCount: number) => string;\n}\n\n/** Shows where the page sits in the hierarchy. The last item is the current page and is not a link. */\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n { maxItems, expandLabel = (count) => `Show ${count} hidden levels`, children, 'aria-label': ariaLabel = 'Breadcrumb', ...props },\n ref,\n) {\n const [expanded, setExpanded] = useState(false);\n const listRef = useRef<HTMLOListElement>(null);\n const items = Children.toArray(children).filter(isValidElement) as ReactElement<BreadcrumbItemProps>[];\n const last = items.length - 1;\n const tailCount = Math.max((maxItems ?? 0) - 1, 1);\n const collapsed = !expanded && maxItems !== undefined && items.length > maxItems && items.length - tailCount > 1;\n const hiddenCount = collapsed ? items.length - tailCount - 1 : 0;\n\n useEffect(() => {\n // The ellipsis has gone, so focus moves to the first level it revealed.\n if (expanded) listRef.current?.children[1]?.querySelector('a')?.focus();\n }, [expanded]);\n\n const renderItem = (item: ReactElement<BreadcrumbItemProps>, index: number) =>\n cloneElement(item, { current: index === last, separator: index !== last });\n\n return (\n <nav ref={ref} aria-label={ariaLabel} {...props}>\n <ol ref={listRef} className={styles.list}>\n {collapsed ? (\n <>\n {renderItem(items[0], 0)}\n <li className={styles.collapsed}>\n <button type=\"button\" className={styles.ellipsis} aria-label={expandLabel(hiddenCount)} onClick={() => setExpanded(true)}>\n <Icon name=\"more\" />\n </button>\n <Icon name=\"chevron-right\" size={14} className={styles.separator} />\n </li>\n {items.slice(-tailCount).map((item, index) => renderItem(item, items.length - tailCount + index))}\n </>\n ) : (\n items.map(renderItem)\n )}\n </ol>\n </nav>\n );\n});\n",".link {\n display: inline-flex;\n align-items: center;\n gap: var(--space-4);\n border-radius: var(--radius-sm);\n text-decoration: none;\n text-underline-offset: var(--space-2);\n cursor: pointer;\n}\n\n.link:hover {\n text-decoration: underline;\n}\n\n.link:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.md {\n font: var(--font-label-m);\n}\n\n.sm {\n font: var(--font-label-s);\n}\n\n.default {\n color: var(--color-text-link);\n}\n\n.default:hover {\n color: var(--color-text-link-hover);\n}\n\n.muted {\n color: var(--color-text-secondary);\n}\n\n.muted:hover {\n color: var(--color-text-primary);\n}\n\n.link.disabled {\n color: var(--color-text-disabled);\n text-decoration: none;\n cursor: not-allowed;\n}\n","import { forwardRef, type AnchorHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './Link.module.css';\n\nexport type LinkTone = 'default' | 'muted';\nexport type LinkSize = 'md' | 'sm';\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Colour: `default` is the link colour, `muted` is for quieter links. */\n tone?: LinkTone;\n /** Text size: `md` is 13 px and `sm` is 12 px. */\n size?: LinkSize;\n /** Icon after the text. Defaults to `external-link` when `external` is set. */\n icon?: IconName;\n /** Leaves the product: opens a new tab, sets a safe `rel` and shows the external-link icon. */\n external?: boolean;\n /** Removes the link from the tab order and blocks navigation, while still exposing it as a disabled link. */\n disabled?: boolean;\n /** Text announced with an `external` link to say that it opens a new tab. */\n newTabLabel?: string;\n}\n\nconst ICON_SIZE: Record<LinkSize, number> = { md: 14, sm: 12 };\n\n/** Navigates somewhere rather than performing an action. For actions, use Button instead. */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n tone = 'default',\n size = 'md',\n icon,\n external = false,\n disabled = false,\n newTabLabel = '(opens in a new tab)',\n href,\n target,\n rel,\n onClick,\n tabIndex,\n className,\n children,\n ...props\n },\n ref,\n) {\n const trailingIcon = icon ?? (external ? 'external-link' : undefined);\n // An anchor without href has no implicit role and cannot take focus, so a disabled link keeps its role explicitly.\n const behaviour = disabled\n ? ({ role: 'link', 'aria-disabled': true } as const)\n : {\n href,\n target: target ?? (external ? '_blank' : undefined),\n rel: rel ?? (external ? 'noopener noreferrer' : undefined),\n onClick,\n tabIndex,\n };\n\n return (\n <a ref={ref} className={cx(styles.link, styles[tone], styles[size], disabled && styles.disabled, className)} {...props} {...behaviour}>\n {children}\n {trailingIcon && <Icon name={trailingIcon} size={ICON_SIZE[size]} label={external && !disabled ? newTabLabel : undefined} />}\n </a>\n );\n});\n",".item {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n font: var(--font-label-m);\n white-space: nowrap;\n}\n\n.current {\n color: var(--color-text-primary);\n}\n\n.plain {\n color: var(--color-text-secondary);\n}\n\n.separator {\n flex: none;\n color: var(--color-icon-secondary);\n}\n","import { forwardRef, type LiHTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Link } from '../Link';\nimport styles from './BreadcrumbItem.module.css';\n\nexport interface BreadcrumbItemProps extends LiHTMLAttributes<HTMLLIElement> {\n /** Address of this level. The current page has no link. */\n href?: string;\n /** Marks the current page with `aria-current=\"page\"`. Breadcrumb sets this on the last item. */\n current?: boolean;\n /** Draws the chevron after this item. Breadcrumb sets this on every item but the last. */\n separator?: boolean;\n}\n\n/** One level in a Breadcrumb. */\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(function BreadcrumbItem(\n { href, current = false, separator = false, className, children, ...props },\n ref,\n) {\n return (\n <li ref={ref} className={cx(styles.item, className)} {...props}>\n {current ? (\n <span className={styles.current} aria-current=\"page\">\n {children}\n </span>\n ) : href !== undefined ? (\n <Link tone=\"muted\" href={href}>\n {children}\n </Link>\n ) : (\n <span className={styles.plain}>{children}</span>\n )}\n {separator && <Icon name=\"chevron-right\" size={14} className={styles.separator} />}\n </li>\n );\n});\n","/* Months sit side by side, and wrap into one column when the container is too narrow for both. */\n.calendar {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-16) var(--space-24);\n justify-content: center;\n color: var(--color-text-primary);\n}\n\n.month {\n display: flex;\n flex: none;\n flex-direction: column;\n gap: var(--space-8);\n width: 252px;\n}\n\n.grid {\n width: 252px;\n border-collapse: collapse;\n table-layout: fixed;\n}\n\n.weekday {\n height: 28px;\n padding: 0;\n font: var(--font-caption);\n color: var(--color-text-secondary);\n text-align: center;\n}\n",".cell {\n width: 36px;\n padding: var(--space-2) 0;\n}\n\n/* The whole cell is the button. Its ::before is the range band, and .number is the square that takes hover and selection. */\n.day {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 32px;\n padding: 0;\n background: transparent;\n border: 0;\n font: var(--font-body-s);\n color: var(--color-text-primary);\n cursor: pointer;\n}\n\n.day:focus-visible {\n z-index: 1;\n outline: 0;\n}\n\n.day:focus-visible .number {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.number {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n border-radius: var(--radius-md);\n}\n\n.day:hover .number,\n.day[data-state='hover'] .number {\n background: var(--color-bg-hover);\n}\n\n.inRange::before,\n.rangeStart::before,\n.rangeEnd::before {\n position: absolute;\n inset: 0;\n background: var(--color-bg-accent-subtle);\n content: '';\n}\n\n/* The band starts and stops at the middle of the end days, so it sits under their filled square. */\n.rangeStart::before {\n left: 50%;\n}\n\n.rangeEnd::before {\n right: 50%;\n}\n\n/* Round the band where it breaks, at the ends of a row and of a month. */\n.cell:first-child .inRange::before,\n.cell:first-child .rangeEnd::before,\n.monthStart.inRange::before,\n.monthStart.rangeEnd::before {\n border-top-left-radius: var(--radius-md);\n border-bottom-left-radius: var(--radius-md);\n}\n\n.cell:last-child .inRange::before,\n.cell:last-child .rangeStart::before,\n.monthEnd.inRange::before,\n.monthEnd.rangeStart::before {\n border-top-right-radius: var(--radius-md);\n border-bottom-right-radius: var(--radius-md);\n}\n\n.filled .number,\n.filled:hover .number,\n.filled[data-state='hover'] .number {\n background: var(--color-bg-accent);\n font: var(--font-label-m);\n color: var(--color-text-on-accent);\n}\n\n.filled:hover .number,\n.filled[data-state='hover'] .number {\n background: var(--color-bg-accent-hover);\n}\n\n/* The end of a preview isn't selected yet, so it gets a neutral outline instead of the accent fill. */\n.previewEnd .number {\n border: var(--stroke-hairline) solid var(--color-border-strong);\n}\n\n.outsideMonth {\n color: var(--color-text-secondary);\n}\n\n.disabled,\n.disabled .number {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.disabled .number {\n text-decoration: line-through;\n}\n\n.disabled:hover .number,\n.disabled[data-state='hover'] .number {\n background: transparent;\n}\n\n/* A selected end stays readable even when the day is disabled, such as a start date a minimum length rules out. */\n.disabled.filled .number,\n.disabled.filled:hover .number {\n background: var(--color-bg-accent);\n color: var(--color-text-on-accent);\n text-decoration: none;\n}\n\n/* Sits on the day number, so the number stays centred. It is neutral because orange means selected. */\n.todayDot {\n position: absolute;\n bottom: var(--space-2);\n left: 50%;\n width: 4px;\n height: 4px;\n background: var(--color-icon-secondary);\n border-radius: var(--radius-full);\n transform: translateX(-50%);\n}\n\n.filled .todayDot {\n background: var(--color-icon-on-accent);\n}\n\n.disabled .todayDot {\n background: var(--color-icon-muted);\n}\n","/**\n * Pure date maths for the calendar components.\n *\n * A date here is a local calendar day. Every calculation goes through the year, month and day numbers, never through\n * a count of milliseconds, so a daylight saving change or a time zone can't move a date onto another day.\n */\n\n/** A range of local calendar days. Either end can be empty while it is being chosen. */\nexport interface DateRange {\n /** The first day of the range. */\n start: Date | null;\n /** The last day of the range. */\n end: Date | null;\n}\n\n/** The first column of the month grid: 0 is Sunday, 1 is Monday and 6 is Saturday. */\nexport type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/** The limits on which days can be chosen. */\nexport interface DateLimits {\n /** The earliest day that can be chosen. */\n min?: Date;\n /** The latest day that can be chosen. */\n max?: Date;\n /** Returns true for a day that can't be chosen. */\n isDateDisabled?: (date: Date) => boolean;\n}\n\n/** The limits on a whole range. */\nexport interface RangeLimits extends DateLimits {\n /** The fewest days a range can include, counting both ends. */\n minDays?: number;\n /** The most days a range can include, counting both ends. */\n maxDays?: number;\n /** Lets a range run across a disabled day. Neither end can be on one. */\n allowDisabledInRange?: boolean;\n}\n\nconst MS_PER_DAY = 86_400_000;\nconst WEEKS_IN_GRID = 6;\nconst DAYS_IN_WEEK = 7;\n\n/** The day as a whole number, the same in every time zone. Good for comparing days and counting between them. */\nconst dayNumber = (date: Date) => Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) / MS_PER_DAY;\n\n/** The same calendar day at local midnight. */\nexport function startOfDay(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/** True when both are the same calendar day. Empty values are never the same. */\nexport function isSameDay(a: Date | null | undefined, b: Date | null | undefined) {\n return Boolean(a && b) && dayNumber(a as Date) === dayNumber(b as Date);\n}\n\n/** True when both are in the same month of the same year. */\nexport function isSameMonth(a: Date, b: Date) {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\n/** Negative when `a` is the earlier day, positive when it is the later day, and 0 when they are the same day. */\nexport function compareDays(a: Date, b: Date) {\n return dayNumber(a) - dayNumber(b);\n}\n\n/** The number of days from `a` to `b`. Negative when `b` is earlier. */\nexport function daysBetween(a: Date, b: Date) {\n return dayNumber(b) - dayNumber(a);\n}\n\n/** The number of days in a range, counting both ends. */\nexport function rangeLength(a: Date, b: Date) {\n return Math.abs(daysBetween(a, b)) + 1;\n}\n\n/** The calendar day `amount` days away. */\nexport function addDays(date: Date, amount: number) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n}\n\n/** The same day `amount` months away. A day the target month doesn't have becomes its last day: 31 Jan to 28 Feb. */\nexport function addMonths(date: Date, amount: number) {\n const firstOfTarget = new Date(date.getFullYear(), date.getMonth() + amount, 1);\n const lastDay = new Date(firstOfTarget.getFullYear(), firstOfTarget.getMonth() + 1, 0).getDate();\n return new Date(firstOfTarget.getFullYear(), firstOfTarget.getMonth(), Math.min(date.getDate(), lastDay));\n}\n\n/** The same day `amount` years away. 29 Feb becomes 28 Feb when the target year isn't a leap year. */\nexport function addYears(date: Date, amount: number) {\n return addMonths(date, amount * 12);\n}\n\n/** The first day of the month. */\nexport function startOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), 1);\n}\n\n/** The last day of the month. */\nexport function endOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0);\n}\n\n/** The first day of the week containing `date`. */\nexport function startOfWeek(date: Date, weekStartsOn: WeekStart = 1) {\n return addDays(date, -((date.getDay() - weekStartsOn + DAYS_IN_WEEK) % DAYS_IN_WEEK));\n}\n\n/** The last day of the week containing `date`. */\nexport function endOfWeek(date: Date, weekStartsOn: WeekStart = 1) {\n return addDays(startOfWeek(date, weekStartsOn), DAYS_IN_WEEK - 1);\n}\n\n/** The month as six full weeks, so the grid keeps its height from month to month. */\nexport function monthWeeks(month: Date, weekStartsOn: WeekStart = 1) {\n const first = startOfWeek(startOfMonth(month), weekStartsOn);\n return Array.from({ length: WEEKS_IN_GRID }, (_, week) =>\n Array.from({ length: DAYS_IN_WEEK }, (_unused, day) => addDays(first, week * DAYS_IN_WEEK + day)),\n );\n}\n\n/** Seven days in column order, for naming the columns of the grid. 1 Jan 2024 was a Monday. */\nexport function weekdayDates(weekStartsOn: WeekStart = 1) {\n return Array.from({ length: DAYS_IN_WEEK }, (_, offset) => new Date(2024, 0, 1 + ((weekStartsOn + 6 + offset) % DAYS_IN_WEEK)));\n}\n\n/** The day moved just enough to sit between `min` and `max`. */\nexport function clampDay(date: Date, min?: Date, max?: Date) {\n if (min && compareDays(date, min) < 0) return startOfDay(min);\n if (max && compareDays(date, max) > 0) return startOfDay(max);\n return date;\n}\n\n/** True when a day can't be chosen, because of `min`, `max` or `isDateDisabled`. */\nexport function isDayDisabled(date: Date, { min, max, isDateDisabled }: DateLimits) {\n if (min && compareDays(date, min) < 0) return true;\n if (max && compareDays(date, max) > 0) return true;\n return Boolean(isDateDisabled?.(date));\n}\n\n/** The range with its ends in order. Days are kept at local midnight. */\nexport function sortRange(a: Date, b: Date): { start: Date; end: Date } {\n return compareDays(a, b) <= 0 ? { start: startOfDay(a), end: startOfDay(b) } : { start: startOfDay(b), end: startOfDay(a) };\n}\n\n/** Whether the range length is inside `minDays` and `maxDays`. */\nfunction fitsLength(a: Date, b: Date, { minDays, maxDays }: RangeLimits) {\n const length = rangeLength(a, b);\n return (minDays === undefined || length >= minDays) && (maxDays === undefined || length <= maxDays);\n}\n\n/**\n * Makes a test for which days can end a range that begins at `start`, once a start date is chosen. It remembers the\n * nearest disabled day found on each side, so testing a whole month of days doesn't walk the calendar each time.\n */\nexport function createEndDateTest(start: Date, limits: RangeLimits) {\n const { isDateDisabled, allowDisabledInRange } = limits;\n const edge = { before: { reached: 0, blocked: false }, after: { reached: 0, blocked: false } };\n\n /** True when a disabled day sits strictly between the start date and `distance` days away from it. */\n const crossesDisabled = (distance: number) => {\n if (!isDateDisabled || allowDisabledInRange || distance === 0) return false;\n const side = distance > 0 ? edge.after : edge.before;\n const step = Math.sign(distance);\n const target = Math.abs(distance);\n if (side.blocked && side.reached < target) return true;\n for (let walked = side.reached + 1; walked < target; walked += 1) {\n side.reached = walked;\n if (isDateDisabled(addDays(start, walked * step))) {\n side.blocked = true;\n return true;\n }\n }\n return false;\n };\n\n return (date: Date) => !isDayDisabled(date, limits) && fitsLength(start, date, limits) && !crossesDisabled(daysBetween(start, date));\n}\n\n/** True when a whole range can be used, for example a preset. */\nexport function isRangeAllowed(range: DateRange, limits: RangeLimits) {\n if (!range.start || !range.end) return false;\n const { start, end } = sortRange(range.start, range.end);\n return !isDayDisabled(start, limits) && createEndDateTest(start, limits)(end);\n}\n\n/** The day as `YYYY-MM-DD`, in local time. */\nexport function toISODay(date: Date) {\n const year = String(date.getFullYear()).padStart(4, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\n/** Building a formatter is slow and a month has many cells, so they are kept. The grid is always Gregorian, so the text is too. */\nfunction dateFormat(locale: string | undefined, options: Intl.DateTimeFormatOptions) {\n const key = `${locale ?? ''}|${JSON.stringify(options)}`;\n let format = formatters.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(locale, { calendar: 'gregory', ...options });\n formatters.set(key, format);\n }\n return format;\n}\n\n/** Short date for the triggers: `12 Mar 2026`. */\nexport function formatShortDate(date: Date, locale?: string) {\n return dateFormat(locale, { day: 'numeric', month: 'short', year: 'numeric' }).format(date);\n}\n\n/** Long date for announcements: `12 March 2026`. */\nexport function formatLongDate(date: Date, locale?: string) {\n return dateFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The full name of a day cell: `Thursday 12 March 2026`. */\nexport function formatFullDate(date: Date, locale?: string) {\n return dateFormat(locale, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The month heading: `March 2026`. */\nexport function formatMonthLabel(date: Date, locale?: string) {\n return dateFormat(locale, { month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The column heading of a weekday: `Mon`, or `Monday` when `long`. */\nexport function formatWeekday(date: Date, locale?: string, long = false) {\n return dateFormat(locale, { weekday: long ? 'long' : 'short' }).format(date);\n}\n\n/** The number in a day cell, in the digits of the locale but without a suffix such as the Japanese 日. */\nexport function formatDayNumber(date: Date, locale?: string) {\n return new Intl.NumberFormat(locale, { useGrouping: false }).format(date.getDate());\n}\n\n/** A range for a trigger: `12 Mar 2026 – 18 Mar 2026`. An empty end leaves the dash open. Null when there is no start. */\nexport function formatRangeText(range: DateRange | null | undefined, locale?: string) {\n if (!range?.start && !range?.end) return null;\n const first = (range.start ?? range.end) as Date;\n if (!range.start || !range.end) return `${formatShortDate(first, locale)} –`;\n const { start, end } = sortRange(range.start, range.end);\n return `${formatShortDate(start, locale)} – ${formatShortDate(end, locale)}`;\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './CalendarDay.module.css';\nimport { addDays, formatDayNumber, formatFullDate, isSameMonth, toISODay } from './dateUtils';\n\nexport interface CalendarDayProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'value'> {\n /** The day this cell shows. */\n date: Date;\n /** BCP 47 locale for the number and the accessible name. Leave out to use the browser's locale. */\n locale?: string;\n /** Marks the current day with a dot and `aria-current=\"date\"`. */\n today?: boolean;\n /** Fills the day with the accent colour. */\n selected?: boolean;\n /** The first day of a range. */\n rangeStart?: boolean;\n /** The last day of a range. */\n rangeEnd?: boolean;\n /** A day between the two ends of a range. */\n inRange?: boolean;\n /** The range state on this day is only a preview, while the end date is being chosen. It isn't selected yet. */\n preview?: boolean;\n /** A day from the month before or after the one shown. */\n outsideMonth?: boolean;\n /** The day can't be chosen. It uses `aria-disabled`, so the keyboard can still reach it and hear why. */\n disabled?: boolean;\n}\n\n/** One day of the month grid: a grid cell holding a button. Render it inside a row of a `role=\"grid\"` table. */\nexport const CalendarDay = forwardRef<HTMLButtonElement, CalendarDayProps>(function CalendarDay(\n { date, locale, today, selected, rangeStart, rangeEnd, inRange, preview, outsideMonth, disabled, className, onClick, ...props },\n ref,\n) {\n const rangeEnds = rangeStart || rangeEnd;\n const filled = selected || (rangeEnds && !preview);\n const inAnyRange = rangeEnds || inRange;\n return (\n <td role=\"gridcell\" aria-selected={Boolean(selected || (inAnyRange && !preview))} className={styles.cell}>\n <button\n ref={ref}\n type=\"button\"\n data-date={toISODay(date)}\n data-range={inAnyRange ? (rangeStart && rangeEnd ? 'single' : rangeStart ? 'start' : rangeEnd ? 'end' : 'middle') : undefined}\n data-preview={(inAnyRange && preview) || undefined}\n aria-label={formatFullDate(date, locale)}\n aria-current={today ? 'date' : undefined}\n aria-disabled={disabled || undefined}\n className={cx(\n styles.day,\n rangeStart && !rangeEnd && styles.rangeStart,\n rangeEnd && !rangeStart && styles.rangeEnd,\n inRange && styles.inRange,\n date.getDate() === 1 && styles.monthStart,\n !isSameMonth(date, addDays(date, 1)) && styles.monthEnd,\n filled && styles.filled,\n rangeEnds && preview && styles.previewEnd,\n outsideMonth && styles.outsideMonth,\n disabled && styles.disabled,\n className,\n )}\n onClick={disabled ? undefined : onClick}\n {...props}\n >\n <span className={styles.number}>\n {formatDayNumber(date, locale)}\n {today && <span className={styles.todayDot} />}\n </span>\n </button>\n </td>\n );\n});\n",".header {\n display: flex;\n align-items: center;\n gap: var(--space-4);\n height: 28px;\n}\n\n.label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n font: var(--font-heading-s);\n color: var(--color-text-primary);\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Holds the place of a left-out button, so the label stays centred over the grid. */\n.spacer {\n flex: none;\n width: 28px;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport styles from './CalendarHeader.module.css';\nimport { formatMonthLabel } from './dateUtils';\n\nexport interface CalendarHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /** Any day in the month to name. */\n month: Date;\n /** BCP 47 locale for the month name. Leave out to use the browser's locale. */\n locale?: string;\n /** The id of the month label, so a grid can name itself with it. */\n labelId?: string;\n /** Called when the previous month button is used. */\n onPrevious?: () => void;\n /** Called when the next month button is used. */\n onNext?: () => void;\n /** Stops the previous month button, at the first month allowed. */\n previousDisabled?: boolean;\n /** Stops the next month button, at the last month allowed. */\n nextDisabled?: boolean;\n /** Leaves out the previous month button, for the later months of a multi-month calendar. Its space stays. */\n hidePrevious?: boolean;\n /** Leaves out the next month button, for the earlier months of a multi-month calendar. Its space stays. */\n hideNext?: boolean;\n /** Accessible name of the previous month button. */\n previousLabel?: string;\n /** Accessible name of the next month button. */\n nextLabel?: string;\n}\n\n/** The month name with previous and next buttons, above a month grid. Month changes are announced politely. */\nexport const CalendarHeader = forwardRef<HTMLDivElement, CalendarHeaderProps>(function CalendarHeader(\n {\n month,\n locale,\n labelId,\n onPrevious,\n onNext,\n previousDisabled,\n nextDisabled,\n hidePrevious,\n hideNext,\n previousLabel = 'Previous month',\n nextLabel = 'Next month',\n className,\n ...props\n },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.header, className)} {...props}>\n {hidePrevious ? (\n <span className={styles.spacer} />\n ) : (\n <IconButton variant=\"ghost\" size=\"sm\" icon=\"chevron-left\" label={previousLabel} disabled={previousDisabled} onClick={onPrevious} />\n )}\n <div id={labelId} className={styles.label} aria-live=\"polite\">\n {formatMonthLabel(month, locale)}\n </div>\n {hideNext ? (\n <span className={styles.spacer} />\n ) : (\n <IconButton variant=\"ghost\" size=\"sm\" icon=\"chevron-right\" label={nextLabel} disabled={nextDisabled} onClick={onNext} />\n )}\n </div>\n );\n});\n","import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState, type HTMLAttributes, type KeyboardEvent } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Calendar.module.css';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarHeader } from './CalendarHeader';\nimport {\n addDays,\n addMonths,\n addYears,\n clampDay,\n compareDays,\n endOfMonth,\n endOfWeek,\n formatWeekday,\n isDayDisabled,\n isSameDay,\n isSameMonth,\n monthWeeks,\n sortRange,\n startOfDay,\n startOfMonth,\n startOfWeek,\n toISODay,\n weekdayDates,\n type DateRange,\n type WeekStart,\n} from './dateUtils';\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The selected day, when controlled. Use a Date at local midnight. */\n value?: Date | null;\n /** The first selected day, when uncontrolled. */\n defaultValue?: Date | null;\n /** Called with the day, at local midnight, when a day is chosen. */\n onChange?: (date: Date) => void;\n /** Shows a range instead of a single day. The parent decides what a chosen day does to it. */\n range?: DateRange;\n /** While `range` has only a start, previews the range from the start to this day. */\n rangePreview?: Date | null;\n /** Called when the pointer or keyboard focus reaches a day that can be chosen. */\n onDayPreview?: (date: Date) => void;\n /** The first month shown, when controlled. */\n month?: Date;\n /** The first month shown at the start, when uncontrolled. Defaults to the selected month, or else `today`. */\n defaultMonth?: Date;\n /** Called with the first day of the first month shown, when it changes. */\n onMonthChange?: (month: Date) => void;\n /** The earliest day that can be chosen. */\n min?: Date;\n /** The latest day that can be chosen. */\n max?: Date;\n /** Returns true for a day that can't be chosen. */\n isDateDisabled?: (date: Date) => boolean;\n /** BCP 47 locale for names and numbers. Leave out to use the browser's locale. */\n locale?: string;\n /** The first column of the grid: 0 is Sunday and 1 is Monday. */\n weekStartsOn?: WeekStart;\n /** How many months to show. Two months sit side by side, and stack when the container is narrow. */\n months?: 1 | 2;\n /** The day marked as today. Defaults to now. Pass it for repeatable tests. */\n today?: Date;\n /** Shows days of the months around a month. Defaults to true for one month. With two months it would repeat days. */\n showOutsideDays?: boolean;\n /** Moves focus to the current day when the calendar appears, as a date picker popup does. */\n autoFocusDay?: boolean;\n /** Accessible name of the previous month button. */\n previousMonthLabel?: string;\n /** Accessible name of the next month button. */\n nextMonthLabel?: string;\n}\n\n/** The day range the calendar paints, with its ends in order. */\nfunction paintedRange(range: DateRange | undefined, rangePreview: Date | null | undefined) {\n if (!range?.start && !range?.end) return null;\n const anchor = (range.start ?? range.end) as Date;\n if (range.start && range.end) return { ...sortRange(range.start, range.end), anchor: null };\n return { ...sortRange(anchor, rangePreview ?? anchor), anchor };\n}\n\n/**\n * A month grid for choosing a day, following the WAI-ARIA grid pattern with a roving tabindex. Arrow keys move by day\n * and week, Home and End to the ends of the week, PageUp and PageDown by month, and with Shift by year.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n {\n value,\n defaultValue,\n onChange,\n range,\n rangePreview,\n onDayPreview,\n month: monthProp,\n defaultMonth,\n onMonthChange,\n min,\n max,\n isDateDisabled,\n locale,\n weekStartsOn = 1,\n months = 1,\n today: todayProp,\n showOutsideDays = months === 1,\n autoFocusDay = false,\n previousMonthLabel,\n nextMonthLabel,\n className,\n ...props\n },\n ref,\n) {\n const baseId = useId();\n const [now] = useState(() => startOfDay(new Date()));\n const today = todayProp ?? now;\n const [innerValue, setInnerValue] = useState<Date | null>(defaultValue ?? null);\n const selected = value !== undefined ? value : innerValue;\n const [innerMonth, setInnerMonth] = useState(() =>\n startOfMonth(defaultMonth ?? clampDay(selected ?? range?.start ?? range?.end ?? today, min, max)),\n );\n const firstMonth = monthProp ? startOfMonth(monthProp) : innerMonth;\n const [focused, setFocused] = useState<Date | null>(null);\n\n const rootRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement);\n // Set when the next render should move DOM focus to the current day.\n const pendingFocus = useRef(autoFocusDay);\n\n const limits = { min, max, isDateDisabled };\n const shownMonths = Array.from({ length: months }, (_, index) => addMonths(firstMonth, index));\n const lastDayShown = endOfMonth(shownMonths[shownMonths.length - 1]);\n const isShown = (date: Date) => compareDays(date, firstMonth) >= 0 && compareDays(date, lastDayShown) <= 0;\n\n /** The one day in the tab order: the last one focused, or else the most useful day on show. */\n const currentDay = (() => {\n if (focused && isShown(focused)) return focused;\n const candidates = [selected, range?.start, range?.end, today];\n const candidate = candidates.find((date) => date && isShown(date) && !isDayDisabled(date, limits));\n if (candidate) return startOfDay(candidate);\n for (let date = firstMonth; compareDays(date, lastDayShown) <= 0; date = addDays(date, 1)) {\n if (!isDayDisabled(date, limits)) return date;\n }\n return firstMonth;\n })();\n\n useEffect(() => {\n if (!pendingFocus.current) return;\n pendingFocus.current = false;\n rootRef.current?.querySelector<HTMLElement>(`[data-date=\"${toISODay(currentDay)}\"]`)?.focus();\n });\n\n const showMonth = (next: Date) => {\n if (isSameMonth(next, firstMonth)) return;\n setInnerMonth(next);\n onMonthChange?.(next);\n };\n\n /** Makes a day the current one, and brings its month into view if needed. */\n const moveTo = (target: Date) => {\n const date = clampDay(target, min, max);\n setFocused(date);\n pendingFocus.current = true;\n if (compareDays(date, firstMonth) < 0) showMonth(startOfMonth(date));\n else if (compareDays(date, lastDayShown) > 0) showMonth(startOfMonth(addMonths(date, 1 - months)));\n };\n\n const onGridKeyDown = (event: KeyboardEvent<HTMLTableElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const moves: Record<string, () => Date> = {\n ArrowLeft: () => addDays(currentDay, -1),\n ArrowRight: () => addDays(currentDay, 1),\n ArrowUp: () => addDays(currentDay, -7),\n ArrowDown: () => addDays(currentDay, 7),\n Home: () => startOfWeek(currentDay, weekStartsOn),\n End: () => endOfWeek(currentDay, weekStartsOn),\n PageUp: () => (event.shiftKey ? addYears(currentDay, -1) : addMonths(currentDay, -1)),\n PageDown: () => (event.shiftKey ? addYears(currentDay, 1) : addMonths(currentDay, 1)),\n };\n const move = Object.hasOwn(moves, event.key) ? moves[event.key] : undefined;\n if (!move) return;\n event.preventDefault();\n moveTo(move());\n };\n\n const choose = (date: Date) => {\n moveTo(date);\n if (value === undefined && !range) setInnerValue(date);\n onChange?.(date);\n };\n\n const previousDisabled = Boolean(min && compareDays(addDays(firstMonth, -1), min) < 0);\n const nextDisabled = Boolean(max && compareDays(addDays(lastDayShown, 1), max) > 0);\n\n /** Moves the months with a header button. The button disables itself at the limit, so focus moves off it first. */\n const stepMonth = (step: 1 | -1) => {\n const next = addMonths(firstMonth, step);\n const reachedLimit = step < 0 ? min && compareDays(addDays(next, -1), min) < 0 : max && compareDays(addMonths(next, months), max) > 0;\n if (reachedLimit) pendingFocus.current = true;\n showMonth(next);\n };\n\n const painted = paintedRange(range, rangePreview);\n const columns = weekdayDates(weekStartsOn);\n\n return (\n <div ref={rootRef} role=\"group\" className={cx(styles.calendar, className)} {...props}>\n {shownMonths.map((shownMonth, index) => {\n const labelId = `${baseId}-month-${index}`;\n return (\n // Keyed by position, so the header buttons survive a month change and keep focus.\n <div key={index} className={styles.month}>\n <CalendarHeader\n month={shownMonth}\n locale={locale}\n labelId={labelId}\n hidePrevious={index > 0}\n hideNext={index < months - 1}\n previousDisabled={previousDisabled}\n nextDisabled={nextDisabled}\n previousLabel={previousMonthLabel}\n nextLabel={nextMonthLabel}\n onPrevious={() => stepMonth(-1)}\n onNext={() => stepMonth(1)}\n />\n <table role=\"grid\" aria-labelledby={labelId} className={styles.grid} onKeyDown={onGridKeyDown}>\n <thead>\n <tr>\n {columns.map((column) => (\n <th key={column.getDay()} scope=\"col\" aria-label={formatWeekday(column, locale, true)} className={styles.weekday}>\n {formatWeekday(column, locale)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {monthWeeks(shownMonth, weekStartsOn).map((week) => (\n <tr key={toISODay(week[0])}>\n {week.map((date) => {\n const outsideMonth = !isSameMonth(date, shownMonth);\n if (outsideMonth && !showOutsideDays) return <td key={toISODay(date)} role=\"gridcell\" />;\n const disabled = isDayDisabled(date, limits);\n const isStart = painted ? isSameDay(date, painted.start) : false;\n const isEnd = painted ? isSameDay(date, painted.end) : false;\n const isBetween = painted ? compareDays(date, painted.start) > 0 && compareDays(date, painted.end) < 0 : false;\n return (\n <CalendarDay\n key={toISODay(date)}\n date={date}\n locale={locale}\n today={isSameDay(date, today)}\n selected={!range && isSameDay(date, selected)}\n rangeStart={isStart}\n rangeEnd={isEnd}\n inRange={isBetween}\n preview={Boolean(painted?.anchor) && !isSameDay(date, painted?.anchor)}\n outsideMonth={outsideMonth}\n disabled={disabled}\n tabIndex={!outsideMonth && isSameDay(date, currentDay) ? 0 : -1}\n onClick={() => choose(date)}\n onFocus={() => {\n setFocused(date);\n if (!disabled) onDayPreview?.(date);\n }}\n onMouseEnter={disabled ? undefined : () => onDayPreview?.(date)}\n />\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n })}\n </div>\n );\n});\n",".card {\n padding: var(--card-padding, 0);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n background: var(--color-bg-surface);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n/* These let CardHeader and CardFooter reach the card's edges. Both fall back to their own padding when they are unset. */\n.md {\n --card-padding: var(--space-16);\n --card-bleed: calc(var(--space-16) * -1);\n}\n\n.lg {\n --card-padding: var(--space-24);\n --card-bleed: calc(var(--space-24) * -1);\n}\n\n.none {\n --card-padding: initial;\n --card-bleed: initial;\n}\n","import { forwardRef, type ElementType, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Card.module.css';\n\nexport type CardPadding = 'md' | 'lg' | 'none';\n\nexport interface CardProps extends HTMLAttributes<HTMLElement> {\n /** Inner padding: `md` is 16 px and `lg` is 24 px. Use `none` for content that touches the edges, such as a table. */\n padding?: CardPadding;\n /** Element to render, such as `section` or `article`. */\n as?: ElementType;\n}\n\n/** Bordered container for a group of related content. It has no shadow. */\nexport const Card = forwardRef<HTMLElement, CardProps>(function Card({ padding = 'md', as: Component = 'div', className, ...props }, ref) {\n return <Component ref={ref} className={cx(styles.card, styles[padding], className)} {...props} />;\n});\n",".cardFooter {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n margin: var(--card-padding, 0) var(--card-bleed, 0) var(--card-bleed, 0);\n padding: var(--card-padding, var(--space-16));\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.start {\n justify-content: flex-start;\n}\n\n.end {\n justify-content: flex-end;\n}\n\n.between {\n justify-content: space-between;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './CardFooter.module.css';\n\nexport type CardFooterAlign = 'start' | 'end' | 'between';\n\nexport interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {\n /** How the content sits along the footer. */\n align?: CardFooterAlign;\n}\n\n/** Bottom section of a Card, usually for actions. Use it as the last child of the card. */\nexport const CardFooter = forwardRef<HTMLDivElement, CardFooterProps>(function CardFooter({ align = 'end', className, ...props }, ref) {\n return <div ref={ref} className={cx(styles.cardFooter, styles[align], className)} {...props} />;\n});\n",".cardHeader {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--space-12);\n margin: var(--card-bleed, 0) var(--card-bleed, 0) var(--card-padding, 0);\n padding: var(--card-padding, var(--space-16));\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n min-width: 0;\n}\n\n.title {\n margin: 0;\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.description {\n margin: 0;\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.actions {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--space-8);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './CardHeader.module.css';\n\nexport type CardHeadingLevel = 2 | 3 | 4 | 5 | 6;\n\nexport interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Card title, rendered as a heading. */\n title: ReactNode;\n /** Supporting text under the title. */\n description?: ReactNode;\n /** Controls at the end of the header, such as an IconButton. */\n actions?: ReactNode;\n /** Heading level of the title, to fit the outline of the page. */\n headingLevel?: CardHeadingLevel;\n}\n\n/** Top section of a Card, with a title and optional description and actions. Use it as the first child of the card. */\nexport const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(function CardHeader(\n { title, description, actions, headingLevel = 3, className, children, ...props },\n ref,\n) {\n const Heading = `h${headingLevel}` as const;\n return (\n <div ref={ref} className={cx(styles.cardHeader, className)} {...props}>\n <div className={styles.text}>\n <Heading className={styles.title}>{title}</Heading>\n {description && <p className={styles.description}>{description}</p>}\n {children}\n </div>\n {actions && <div className={styles.actions}>{actions}</div>}\n </div>\n );\n});\n",".card {\n display: flex;\n flex-direction: column;\n gap: var(--space-12);\n width: 360px;\n max-width: 100%;\n padding: var(--space-20);\n}\n\n.header {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n}\n\n.tile {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-md);\n color: var(--color-icon-primary);\n}\n\n.names {\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.subtitle {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.description {\n margin: var(--space-0);\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-8);\n margin-top: var(--space-4);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Card } from '../Card';\nimport styles from './CatalogCard.module.css';\n\nexport interface CatalogCardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {\n /** Icon in the tile at the top left. */\n icon?: IconName;\n /** The name of the item. */\n title: ReactNode;\n /** A short line below the name. */\n subtitle?: ReactNode;\n /** What the item does. */\n description?: ReactNode;\n /** A quieter action at the bottom left, such as a docs Button. */\n secondaryAction?: ReactNode;\n /** The main action at the bottom right, normally a Button. */\n primaryAction?: ReactNode;\n}\n\n/** An item that can be added or started, in a catalog of choices. */\nexport const CatalogCard = forwardRef<HTMLElement, CatalogCardProps>(function CatalogCard(\n { icon, title, subtitle, description, secondaryAction, primaryAction, className, ...props },\n ref,\n) {\n return (\n <Card ref={ref} as=\"article\" padding=\"none\" className={cx(styles.card, className)} {...props}>\n <div className={styles.header}>\n {icon && (\n <span className={styles.tile}>\n <Icon name={icon} size={20} />\n </span>\n )}\n <div className={styles.names}>\n <div className={styles.title}>{title}</div>\n {subtitle && <div className={styles.subtitle}>{subtitle}</div>}\n </div>\n </div>\n {description && <p className={styles.description}>{description}</p>}\n {(secondaryAction || primaryAction) && (\n <div className={styles.footer}>\n <span>{secondaryAction}</span>\n <span>{primaryAction}</span>\n </div>\n )}\n </Card>\n );\n});\n",".segment {\n padding: var(--space-4) var(--space-10);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--color-text-secondary);\n font: var(--font-label-s);\n white-space: nowrap;\n cursor: pointer;\n}\n\n.segment:hover:not(:disabled),\n.segment[data-state='hover'] {\n color: var(--color-text-primary);\n}\n\n.segment:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.segment:disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.selected {\n border-color: var(--color-border-default);\n background: var(--color-bg-canvas);\n box-shadow: var(--elevation-card);\n color: var(--color-text-primary);\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Segment.module.css';\n\nexport interface SegmentProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Raises this segment as the selected one. */\n selected?: boolean;\n}\n\n/** One choice in RangeTabs. The selected segment is raised and uses no colour. */\nexport const Segment = forwardRef<HTMLButtonElement, SegmentProps>(function Segment(\n { selected = false, className, type = 'button', tabIndex, ...props },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n role=\"radio\"\n aria-checked={selected}\n tabIndex={tabIndex ?? (selected ? 0 : -1)}\n className={cx(styles.segment, selected && styles.selected, className)}\n {...props}\n />\n );\n});\n",".rangeTabs {\n display: inline-flex;\n align-items: center;\n gap: var(--space-2);\n padding: var(--space-2);\n border-radius: var(--radius-lg);\n background: var(--color-bg-subtle);\n}\n","import {\n forwardRef,\n useState,\n type ForwardedRef,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactElement,\n type RefAttributes,\n} from 'react';\nimport { cx } from '../../lib/cx';\nimport { Segment } from './Segment';\nimport styles from './RangeTabs.module.css';\n\nexport interface RangeTabsOption<T extends string = string> {\n /** The value reported when this option is chosen. */\n value: T;\n /** The visible text. */\n label: string;\n /** Blocks this option. */\n disabled?: boolean;\n}\n\nexport interface RangeTabsProps<T extends string = string> extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** The choices, in order. */\n options: RangeTabsOption<T>[];\n /** The chosen value, when controlled. */\n value?: T;\n /** The first chosen value, when uncontrolled. Defaults to the first option that is enabled. */\n defaultValue?: T;\n /** Called with the value the user chooses. */\n onChange?: (value: T) => void;\n}\n\nconst MOVES: Record<string, 1 | -1> = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };\n\nfunction RangeTabsInner<T extends string = string>(\n { options, value, defaultValue, onChange, className, ...props }: RangeTabsProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const [innerValue, setInnerValue] = useState<T | undefined>(defaultValue);\n const enabled = options.filter((option) => !option.disabled);\n const current = value ?? innerValue ?? enabled[0]?.value;\n // If nothing valid is chosen, the first enabled option still has to be reachable with Tab.\n const tabStop = enabled.some((option) => option.value === current) ? current : enabled[0]?.value;\n\n const choose = (next: T) => {\n setInnerValue(next);\n if (next !== current) onChange?.(next);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>, optionValue: T) => {\n const move = MOVES[event.key];\n if (!move) return;\n event.preventDefault();\n const index = enabled.findIndex((option) => option.value === optionValue);\n const next = enabled[(index + move + enabled.length) % enabled.length];\n const group = event.currentTarget.closest('[role=\"radiogroup\"]');\n choose(next.value);\n group?.querySelector<HTMLButtonElement>(`[data-value=\"${CSS.escape(next.value)}\"]`)?.focus();\n };\n\n return (\n <div ref={ref} role=\"radiogroup\" className={cx(styles.rangeTabs, className)} {...props}>\n {options.map((option) => (\n <Segment\n key={option.value}\n data-value={option.value}\n selected={option.value === current}\n disabled={option.disabled}\n tabIndex={option.value === tabStop ? 0 : -1}\n onClick={() => choose(option.value)}\n onKeyDown={(event) => handleKeyDown(event, option.value)}\n >\n {option.label}\n </Segment>\n ))}\n </div>\n );\n}\n\n/** Segmented control for switching a time range or view. Use one per chart group. */\nexport const RangeTabs = forwardRef(RangeTabsInner) as <T extends string = string>(\n props: RangeTabsProps<T> & RefAttributes<HTMLDivElement>,\n) => ReactElement;\n",".card {\n display: flex;\n flex-direction: column;\n gap: var(--space-12);\n}\n\n.header {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--space-12);\n}\n\n.titles {\n min-width: 0;\n}\n\n.title {\n margin: 0;\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.subtitle {\n margin: 0;\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Card } from '../Card';\nimport { RangeTabs } from '../RangeTabs';\nimport styles from './ChartCard.module.css';\n\n/** One choice in the range control. */\nexport interface ChartCardRange {\n /** Stable value reported on change. */\n value: string;\n /** Text on the tab. */\n label: string;\n}\n\nexport interface ChartCardProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'onChange'> {\n /** What the chart is about. */\n title: ReactNode;\n /** What the chart shows and where the data comes from. */\n subtitle?: ReactNode;\n /** Heading level of the title, to fit the page's outline. */\n headingLevel?: 2 | 3 | 4 | 5;\n /** Choices for the range control. Without them there is no control. */\n ranges?: ChartCardRange[];\n /** Selected range, when controlled. */\n rangeValue?: string;\n /** Selected range at first, when uncontrolled. */\n defaultRangeValue?: string;\n /** Called with the new range. */\n onRangeChange?: (value: string) => void;\n /** Accessible name of the range control. */\n rangeLabel?: string;\n /** The chart. */\n children?: ReactNode;\n}\n\n/** A titled container for any chart, with a time range control. */\nexport const ChartCard = forwardRef<HTMLElement, ChartCardProps>(function ChartCard(\n {\n title,\n subtitle,\n headingLevel = 3,\n ranges,\n rangeValue,\n defaultRangeValue,\n onRangeChange,\n rangeLabel = 'Time range',\n className,\n children,\n ...props\n },\n ref,\n) {\n const titleId = useId();\n const Heading = `h${headingLevel}` as const;\n return (\n <Card ref={ref} as=\"section\" aria-labelledby={titleId} className={cx(styles.card, className)} {...props}>\n <div className={styles.header}>\n <div className={styles.titles}>\n <Heading id={titleId} className={styles.title}>\n {title}\n </Heading>\n {subtitle && <p className={styles.subtitle}>{subtitle}</p>}\n </div>\n {ranges && ranges.length > 0 && (\n <RangeTabs\n options={ranges}\n value={rangeValue}\n defaultValue={defaultRangeValue ?? ranges[0].value}\n onChange={onRangeChange}\n aria-label={rangeLabel}\n />\n )}\n </div>\n {children}\n </Card>\n );\n});\n",".root {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--space-8);\n cursor: pointer;\n}\n\n.control {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n margin-top: var(--space-2);\n}\n\n/* The native input stays on top of the box, invisible, so it keeps its behaviour and hit area. */\n.input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n}\n\n.box {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n color: var(--color-icon-on-accent);\n}\n\n.checkIcon,\n.minusIcon {\n display: none;\n}\n\n.input:hover + .box,\n.input[data-state='hover'] + .box {\n border-color: var(--color-border-strong);\n}\n\n.input:checked + .box,\n.input:indeterminate + .box {\n background: var(--color-control-on);\n border-color: var(--color-control-on);\n}\n\n.input:checked:hover + .box,\n.input:indeterminate:hover + .box,\n.input:checked[data-state='hover'] + .box,\n.input:indeterminate[data-state='hover'] + .box {\n background: var(--color-bg-accent-hover);\n border-color: var(--color-bg-accent-hover);\n}\n\n.input:checked:not(:indeterminate) + .box .checkIcon,\n.input:indeterminate + .box .minusIcon {\n display: block;\n}\n\n.input:focus-visible + .box {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.input:disabled + .box {\n background: var(--color-control-disabled);\n border-color: var(--color-control-disabled);\n color: var(--color-icon-muted);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n}\n\n.label {\n font: var(--font-body-s);\n color: var(--color-text-primary);\n}\n\n.description {\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n\n.disabled {\n cursor: not-allowed;\n}\n\n.disabled .label,\n.disabled .description {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, useEffect, useId, useImperativeHandle, useRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './Checkbox.module.css';\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {\n /** The visible label. Leave it out for a bare box, and give the box an `aria-label`. */\n label?: ReactNode;\n /** Longer text below the label. */\n description?: ReactNode;\n /** Shows the mixed state, for a parent whose children are only partly selected. */\n indeterminate?: boolean;\n}\n\n/** Selects any number of options, applied on save. Built on a native checkbox. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n {\n label,\n description,\n indeterminate = false,\n className,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const descriptionId = `${baseId}-description`;\n\n // Runs after every render: clicking clears the native property, so a controlled mixed state has to be put back.\n useEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = indeterminate;\n });\n\n return (\n <label className={cx(styles.root, props.disabled && styles.disabled, className)}>\n <span className={styles.control}>\n <input\n ref={inputRef}\n type=\"checkbox\"\n className={styles.input}\n aria-labelledby={ariaLabelledBy ?? (label ? labelId : undefined)}\n aria-describedby={[ariaDescribedBy, description ? descriptionId : undefined].filter(Boolean).join(' ') || undefined}\n {...props}\n />\n <span className={styles.box}>\n <Icon name=\"check\" size={12} className={styles.checkIcon} />\n <Icon name=\"minus\" size={12} className={styles.minusIcon} />\n </span>\n </span>\n {(label || description) && (\n <span className={styles.text}>\n {label && (\n <span id={labelId} className={styles.label}>\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className={styles.description}>\n {description}\n </span>\n )}\n </span>\n )}\n </label>\n );\n});\n",".spinner {\n display: inline-block;\n flex: none;\n border: var(--stroke-strong) solid var(--color-border-default);\n border-top-color: var(--color-icon-secondary);\n border-radius: var(--radius-full);\n animation: spin 800ms linear infinite;\n}\n\n.sm {\n width: 16px;\n height: 16px;\n}\n\n.md {\n width: 20px;\n height: 20px;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Spinner.module.css';\n\nexport type SpinnerSize = 'sm' | 'md';\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {\n /** Diameter: `sm` is 16 px and `md` is 20 px. */\n size?: SpinnerSize;\n /** Accessible name, announced as a status message. */\n label?: string;\n}\n\n/** Shows that something is loading, for a wait of unknown length. */\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n { size = 'md', label = 'Loading', className, ...props },\n ref,\n) {\n return <span ref={ref} className={cx(styles.spinner, styles[size], className)} role=\"status\" aria-label={label} {...props} />;\n});\n",".item {\n display: flex;\n align-items: flex-start;\n gap: var(--space-8);\n padding: var(--space-8) var(--space-0);\n}\n\n.icon {\n display: inline-flex;\n flex: none;\n padding-top: var(--space-2);\n}\n\n.text {\n flex: 1;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.detail {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.result {\n font: var(--font-label-s);\n white-space: nowrap;\n}\n\n.pass .icon,\n.pass .result {\n color: var(--color-text-success);\n}\n\n.fail .icon,\n.fail .result {\n color: var(--color-text-danger);\n}\n\n.warn .icon,\n.warn .result {\n color: var(--color-text-warning);\n}\n\n.pending .icon,\n.pending .result {\n color: var(--color-text-secondary);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Spinner } from '../Spinner';\nimport styles from './ChecklistItem.module.css';\n\nexport type ChecklistItemResult = 'pass' | 'fail' | 'warn' | 'pending';\n\nexport interface ChecklistItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The outcome of the check. */\n result?: ChecklistItemResult;\n /** What is being checked. */\n title: ReactNode;\n /** More about the check. */\n detail?: ReactNode;\n /** The outcome in words. Defaults to Passed, Blocked, Review or Checking. */\n resultLabel?: ReactNode;\n}\n\nconst RESULT_ICON: Record<Exclude<ChecklistItemResult, 'pending'>, IconName> = { pass: 'check', fail: 'x-circle', warn: 'alert-triangle' };\nconst RESULT_LABEL: Record<ChecklistItemResult, string> = { pass: 'Passed', fail: 'Blocked', warn: 'Review', pending: 'Checking' };\n\n/** One check in a list, with its outcome as an icon and text. */\nexport const ChecklistItem = forwardRef<HTMLDivElement, ChecklistItemProps>(function ChecklistItem(\n { result = 'pending', title, detail, resultLabel, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.item, styles[result], className)} {...props}>\n <span className={styles.icon}>\n {result === 'pending' ? (\n <Spinner size=\"sm\" aria-hidden=\"true\" role=\"presentation\" aria-label={undefined} />\n ) : (\n <Icon name={RESULT_ICON[result]} />\n )}\n </span>\n <div className={styles.text}>\n <div className={styles.title}>{title}</div>\n {detail && <div className={styles.detail}>{detail}</div>}\n </div>\n <span className={styles.result}>{resultLabel ?? RESULT_LABEL[result]}</span>\n </div>\n );\n});\n","import { createContext, useCallback, useContext, useId, useMemo, useState } from 'react';\n\nexport interface DialogContextValue {\n titleId: string;\n descriptionId: string;\n /** Marks the title or description as present. Returns a function that removes it again. */\n registerLabel: (kind: 'title' | 'description') => () => void;\n /** Closes the surrounding modal. Undefined when it can't be dismissed by the user. */\n onClose?: () => void;\n}\n\nexport const DialogContext = createContext<DialogContextValue | null>(null);\n\nexport const useDialogContext = () => useContext(DialogContext);\n\n/** Builds the context and ARIA attributes that tie a modal surface to its DialogHeader. */\nexport function useDialogLabels(dismissible: boolean, close: () => void) {\n const titleId = useId();\n const descriptionId = useId();\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n\n const registerLabel = useCallback((kind: 'title' | 'description') => {\n const setPresent = kind === 'title' ? setHasTitle : setHasDescription;\n setPresent(true);\n return () => setPresent(false);\n }, []);\n\n const onClose = dismissible ? close : undefined;\n const context = useMemo(() => ({ titleId, descriptionId, registerLabel, onClose }), [titleId, descriptionId, registerLabel, onClose]);\n\n return {\n context,\n labelProps: {\n 'aria-labelledby': hasTitle ? titleId : undefined,\n 'aria-describedby': hasDescription ? descriptionId : undefined,\n },\n };\n}\n","import { useCallback, useEffect, useRef, useState, type RefObject } from 'react';\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'area[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'summary',\n 'iframe',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n '[tabindex]',\n].join(',');\n\n/** Every element inside `container` that Tab can reach, in DOM order. */\nexport function getFocusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(\n (element) => element.tabIndex >= 0 && element.getClientRects().length > 0,\n );\n}\n\n/** Open modals, oldest first. Only the top one responds to keys and backdrop presses. */\nconst modalStack: object[] = [];\n\nlet scrollLocks = 0;\nlet bodyOverflow = '';\nlet bodyPaddingRight = '';\n\nfunction lockBodyScroll() {\n if (scrollLocks === 0) {\n const { style } = document.body;\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n bodyOverflow = style.overflow;\n bodyPaddingRight = style.paddingRight;\n style.overflow = 'hidden';\n if (scrollbarWidth > 0) style.paddingRight = `${scrollbarWidth}px`;\n }\n scrollLocks += 1;\n}\n\nfunction unlockBodyScroll() {\n scrollLocks -= 1;\n if (scrollLocks === 0) {\n document.body.style.overflow = bodyOverflow;\n document.body.style.paddingRight = bodyPaddingRight;\n }\n}\n\nexport interface ModalBehaviourOptions {\n /** Whether the modal is showing. All behaviour is active only while this is true. */\n open: boolean;\n /** The modal surface. Focus is kept inside it. It needs `tabIndex={-1}` in case it holds nothing focusable. */\n containerRef: RefObject<HTMLElement | null>;\n /** The backdrop element. A press that starts and ends on it counts as a dismissal. */\n backdropRef?: RefObject<HTMLElement | null>;\n /** Element to focus on open. Defaults to the first focusable element, then the container. */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /** Whether Escape and backdrop presses call `onDismiss`. */\n dismissible?: boolean;\n /** Called when the user dismisses the modal. */\n onDismiss?: () => void;\n}\n\n/**\n * Shared modal behaviour for Dialog and Drawer: focus trap, focus restore, body scroll lock,\n * and Escape and backdrop dismissal. Stacked modals are supported; only the top one responds.\n *\n * Non-modal layers rendered in a portal, such as Popover, set `data-focus-scope` so the trap leaves\n * their Tab handling alone, and call `preventDefault` on keys they consume so Escape closes one layer at a time.\n */\nexport function useModalBehaviour({\n open,\n containerRef,\n backdropRef,\n initialFocusRef,\n dismissible = true,\n onDismiss,\n}: ModalBehaviourOptions) {\n const latest = useRef({ dismissible, onDismiss });\n useEffect(() => {\n latest.current = { dismissible, onDismiss };\n });\n\n useEffect(() => {\n if (!open) return;\n\n const token = {};\n const isTop = () => modalStack[modalStack.length - 1] === token;\n const dismiss = () => {\n if (latest.current.dismissible) latest.current.onDismiss?.();\n };\n\n modalStack.push(token);\n lockBodyScroll();\n\n const previouslyFocused = document.activeElement as HTMLElement | null;\n const container = containerRef.current;\n if (container) (initialFocusRef?.current ?? getFocusableElements(container)[0] ?? container).focus();\n\n const trapTab = (event: KeyboardEvent) => {\n if (!container) return;\n const active = document.activeElement;\n const inContainer = container.contains(active);\n if (!inContainer && active?.closest('[data-focus-scope]')) return;\n\n const focusable = getFocusableElements(container);\n if (focusable.length === 0) {\n event.preventDefault();\n container.focus();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (event.shiftKey && (!inContainer || active === first || active === container)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (!inContainer || active === last)) {\n event.preventDefault();\n first.focus();\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.defaultPrevented || !isTop()) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n dismiss();\n } else if (event.key === 'Tab') {\n trapTab(event);\n }\n };\n\n let pressStart: EventTarget | null = null;\n const onPointerDown = (event: PointerEvent) => {\n pressStart = event.target;\n };\n const onClick = (event: MouseEvent) => {\n const backdrop = backdropRef?.current;\n if (backdrop && isTop() && event.target === backdrop && pressStart === backdrop) dismiss();\n };\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('pointerdown', onPointerDown);\n document.addEventListener('click', onClick);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('pointerdown', onPointerDown);\n document.removeEventListener('click', onClick);\n modalStack.splice(modalStack.indexOf(token), 1);\n unlockBodyScroll();\n if (previouslyFocused?.isConnected) previouslyFocused.focus();\n };\n }, [open, containerRef, backdropRef, initialFocusRef]);\n}\n\n/** Open state for an overlay that works both controlled (`open`) and uncontrolled (`defaultOpen`). */\nexport function useOverlayOpen(open: boolean | undefined, defaultOpen: boolean, onClose?: () => void) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const close = useCallback(() => {\n setInternalOpen(false);\n onClose?.();\n }, [onClose]);\n return [open ?? internalOpen, close] as const;\n}\n",".backdrop {\n --dialog-backdrop: color-mix(in srgb, var(--mono-950) 40%, transparent);\n\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--space-24);\n background: var(--dialog-backdrop);\n}\n\n.panel {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: 100%;\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-xl);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n.panel:focus-visible {\n outline: none;\n}\n\n.sm {\n max-width: 400px;\n}\n\n.md {\n max-width: 560px;\n}\n\n.lg {\n max-width: 720px;\n}\n","import { forwardRef, useImperativeHandle, useRef, type HTMLAttributes, type RefObject } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport { DialogContext, useDialogLabels } from './dialogContext';\nimport { useModalBehaviour, useOverlayOpen } from './useModalBehaviour';\nimport styles from './Dialog.module.css';\n\nexport type DialogSize = 'sm' | 'md' | 'lg';\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the dialog is showing. Leave undefined to use `defaultOpen` and let the dialog manage itself. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the user closes the dialog. */\n onClose?: () => void;\n /** Whether Escape, a backdrop press and the header's close button can close the dialog. */\n dismissible?: boolean;\n /** Panel width: `sm` is 400 px, `md` is 560 px and `lg` is 720 px. */\n size?: DialogSize;\n /** Element to focus on open. Defaults to the first focusable element. */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /** `alertdialog` for a message that interrupts and needs a response. */\n role?: 'dialog' | 'alertdialog';\n}\n\n/**\n * A modal window. Compose it from DialogHeader, DialogBody and DialogFooter. Traps focus, restores it on close,\n * locks body scroll and renders in a portal. A DialogHeader names and describes the dialog automatically.\n */\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(\n { open, defaultOpen = false, onClose, dismissible = true, size = 'md', initialFocusRef, role = 'dialog', className, children, ...props },\n ref,\n) {\n const [isOpen, close] = useOverlayOpen(open, defaultOpen, onClose);\n const panelRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const { context, labelProps } = useDialogLabels(dismissible, close);\n\n useImperativeHandle(ref, () => panelRef.current as HTMLDivElement);\n useModalBehaviour({ open: isOpen, containerRef: panelRef, backdropRef, initialFocusRef, dismissible, onDismiss: close });\n\n if (!isOpen) return null;\n\n return createPortal(\n <div ref={backdropRef} className={styles.backdrop}>\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n tabIndex={-1}\n className={cx(styles.panel, styles[size], className)}\n {...labelProps}\n {...props}\n >\n <DialogContext.Provider value={context}>{children}</DialogContext.Provider>\n </div>\n </div>,\n document.body,\n );\n});\n",".header {\n display: flex;\n align-items: flex-start;\n gap: var(--space-12);\n padding: var(--space-20) var(--space-24) var(--space-12);\n}\n\n.text {\n display: flex;\n flex: 1;\n flex-direction: column;\n gap: var(--space-4);\n min-width: 0;\n}\n\n.title {\n margin: 0;\n color: var(--color-text-primary);\n font: var(--font-heading-m);\n letter-spacing: var(--tracking-heading-m);\n}\n\n.description {\n margin: 0;\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n","import { forwardRef, useEffect, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport { useDialogContext } from './dialogContext';\nimport styles from './DialogHeader.module.css';\n\nexport interface DialogHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The title, which also becomes the modal's accessible name. */\n title: ReactNode;\n /** Supporting text, which also becomes the modal's accessible description. */\n description?: ReactNode;\n /** Called by the close button. Defaults to closing the surrounding modal, when it is dismissible. */\n onClose?: () => void;\n /** Accessible name of the close button. */\n closeLabel?: string;\n /** Hides the close button even when the modal can be closed. */\n hideClose?: boolean;\n}\n\n/** Title, optional description and close button at the top of a Dialog or Drawer. */\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(function DialogHeader(\n { title, description, onClose, closeLabel = 'Close', hideClose = false, className, ...props },\n ref,\n) {\n const context = useDialogContext();\n const fallbackId = useId();\n const registerLabel = context?.registerLabel;\n const hasDescription = Boolean(description);\n\n useEffect(() => registerLabel?.('title'), [registerLabel]);\n useEffect(() => (hasDescription ? registerLabel?.('description') : undefined), [registerLabel, hasDescription]);\n\n const handleClose = onClose ?? context?.onClose;\n\n return (\n <div ref={ref} className={cx(styles.header, className)} {...props}>\n <div className={styles.text}>\n <h2 id={context?.titleId ?? fallbackId} className={styles.title}>\n {title}\n </h2>\n {description && (\n <p id={context?.descriptionId} className={styles.description}>\n {description}\n </p>\n )}\n </div>\n {handleClose && !hideClose && <IconButton icon=\"x\" label={closeLabel} variant=\"ghost\" size=\"sm\" onClick={handleClose} />}\n </div>\n );\n});\n",".body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: var(--space-4) var(--space-24) var(--space-20);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './DialogBody.module.css';\n\nexport type DialogBodyProps = HTMLAttributes<HTMLDivElement>;\n\n/** The main content of a Dialog or Drawer. Scrolls when the content is taller than the space available. */\nexport const DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(function DialogBody({ className, ...props }, ref) {\n return <div ref={ref} className={cx(styles.body, className)} {...props} />;\n});\n",".footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-end;\n gap: var(--space-8);\n padding: var(--space-16) var(--space-24);\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './DialogFooter.module.css';\n\nexport type DialogFooterProps = HTMLAttributes<HTMLDivElement>;\n\n/** Right-aligned actions at the bottom of a Dialog or Drawer. Use at most one primary Button. */\nexport const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(function DialogFooter({ className, ...props }, ref) {\n return <div ref={ref} className={cx(styles.footer, className)} {...props} />;\n});\n",".item {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n padding: var(--space-8) var(--space-12);\n border-radius: var(--radius-md);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n cursor: pointer;\n}\n\n.active {\n background: var(--color-bg-hover);\n}\n\n.icon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n\n.label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './CommandPaletteItem.module.css';\n\nexport interface CommandPaletteItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /** What the command does. */\n label: string;\n /** Icon before the label. */\n icon?: IconName;\n /** Whether this option has the keyboard highlight. */\n active?: boolean;\n /** Called when the option is pressed. */\n onSelect?: () => void;\n}\n\n/** One option in a CommandPalette. Must sit inside an element with `role=\"listbox\"` or `role=\"group\"`. */\nexport const CommandPaletteItem = forwardRef<HTMLDivElement, CommandPaletteItemProps>(function CommandPaletteItem(\n { label, icon, active = false, onSelect, className, onClick, onKeyDown, onMouseDown, ...props },\n ref,\n) {\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n onSelect?.();\n };\n // Keeps focus in the search input, as the combobox pattern requires.\n const handleMouseDown = (event: MouseEvent<HTMLDivElement>) => {\n onMouseDown?.(event);\n event.preventDefault();\n };\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.key === 'Enter') onSelect?.();\n };\n\n return (\n <div\n ref={ref}\n role=\"option\"\n aria-selected={active}\n tabIndex={-1}\n className={cx(styles.item, active && styles.active, className)}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n {...props}\n >\n {icon && <Icon name={icon} className={styles.icon} />}\n <span className={styles.label}>{label}</span>\n </div>\n );\n});\n",".palette {\n align-self: flex-start;\n max-height: 440px;\n overflow: hidden;\n}\n\n.search {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--space-8);\n padding: var(--space-12) var(--space-16);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.searchIcon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n\n.input {\n flex: 1;\n min-width: 0;\n padding: 0;\n background: transparent;\n border: 0;\n outline: none;\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n.input::placeholder {\n color: var(--color-text-tertiary);\n}\n\n.list {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: var(--space-8);\n}\n\n.group + .group {\n margin-top: var(--space-8);\n}\n\n.groupLabel {\n padding: var(--space-6) var(--space-12);\n color: var(--color-text-tertiary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.status {\n padding: var(--space-24) var(--space-16);\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n text-align: center;\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type RefObject,\n} from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Dialog } from '../Dialog';\nimport { CommandPaletteItem } from './CommandPaletteItem';\nimport styles from './CommandPalette.module.css';\n\nexport interface CommandPaletteCommand {\n /** Unique id. */\n id: string;\n /** What the command does. Searched against the query. */\n label: string;\n /** Heading the command is listed under. Commands without one go in an unnamed group. */\n group?: string;\n /** Icon before the label. */\n icon?: IconName;\n}\n\nexport interface CommandPaletteProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {\n /** Whether the palette is showing. Leave undefined to use `defaultOpen` and let the palette manage itself. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the palette closes, whether from Escape, a backdrop press or a command running. */\n onClose?: () => void;\n /** The commands to search. */\n commands: readonly CommandPaletteCommand[];\n /** Called with the command the user runs. */\n onRun?: (command: CommandPaletteCommand) => void;\n /** Placeholder and accessible name of the search input. */\n searchLabel?: string;\n /** Accessible name of the results list. */\n resultsLabel?: string;\n /** Shown when nothing matches. */\n emptyMessage?: string;\n}\n\ninterface CommandGroup {\n name: string;\n commands: { command: CommandPaletteCommand; index: number }[];\n}\n\ninterface PaletteContentProps extends Required<Pick<CommandPaletteProps, 'commands' | 'searchLabel' | 'resultsLabel' | 'emptyMessage'>> {\n inputRef: RefObject<HTMLInputElement | null>;\n onRun: (command: CommandPaletteCommand) => void;\n}\n\n/** Holds the query and highlight. It mounts on open, so both reset every time. */\nfunction PaletteContent({ commands, searchLabel, resultsLabel, emptyMessage, inputRef, onRun }: PaletteContentProps) {\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(0);\n const baseId = useId();\n const listId = `${baseId}-list`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n const activeRef = useRef<HTMLDivElement>(null);\n\n const matches = useMemo(() => {\n const term = query.trim().toLowerCase();\n return commands.filter((command) => command.label.toLowerCase().includes(term));\n }, [commands, query]);\n\n // Grouped display order must match the arrow-key order, so flatten groups before indexing.\n const groups = useMemo(() => {\n const byName = new Map<string, CommandGroup>();\n for (const command of matches) {\n const name = command.group ?? '';\n if (!byName.has(name)) byName.set(name, { name, commands: [] });\n byName.get(name)?.commands.push({ command, index: 0 });\n }\n const ordered = Array.from(byName.values());\n let next = 0;\n for (const group of ordered) for (const entry of group.commands) entry.index = next++;\n return ordered;\n }, [matches]);\n\n const ordered = useMemo(() => groups.flatMap((group) => group.commands.map((entry) => entry.command)), [groups]);\n const hasResults = ordered.length > 0;\n\n useEffect(() => {\n activeRef.current?.scrollIntoView?.({ block: 'nearest' });\n }, [activeIndex]);\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n setQuery(event.target.value);\n setActiveIndex(0);\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (!hasResults) return;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n setActiveIndex((index) => (index + 1) % ordered.length);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n setActiveIndex((index) => (index - 1 + ordered.length) % ordered.length);\n } else if (event.key === 'Enter') {\n event.preventDefault();\n onRun(ordered[activeIndex]);\n }\n };\n\n return (\n <>\n <div className={styles.search}>\n <Icon name=\"search\" className={styles.searchIcon} />\n <input\n ref={inputRef}\n className={styles.input}\n type=\"text\"\n role=\"combobox\"\n aria-label={searchLabel}\n aria-autocomplete=\"list\"\n aria-expanded={hasResults}\n aria-controls={hasResults ? listId : undefined}\n aria-activedescendant={hasResults ? optionId(activeIndex) : undefined}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchLabel}\n value={query}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n </div>\n {hasResults && (\n <div id={listId} role=\"listbox\" aria-label={resultsLabel} className={styles.list}>\n {groups.map((group) => (\n <div\n key={group.name}\n role=\"group\"\n aria-labelledby={group.name ? `${baseId}-group-${group.name}` : undefined}\n aria-label={group.name ? undefined : resultsLabel}\n className={styles.group}\n >\n {group.name && (\n <div id={`${baseId}-group-${group.name}`} role=\"presentation\" className={styles.groupLabel}>\n {group.name}\n </div>\n )}\n {group.commands.map(({ command, index }) => (\n <CommandPaletteItem\n key={command.id}\n ref={index === activeIndex ? activeRef : undefined}\n id={optionId(index)}\n label={command.label}\n icon={command.icon}\n active={index === activeIndex}\n onMouseMove={() => setActiveIndex(index)}\n onSelect={() => onRun(command)}\n />\n ))}\n </div>\n ))}\n </div>\n )}\n <div role=\"status\" className={cx(styles.status, hasResults && styles.visuallyHidden)}>\n {hasResults ? `${ordered.length} ${ordered.length === 1 ? 'result' : 'results'}` : emptyMessage}\n </div>\n </>\n );\n}\n\n/** A searchable list of commands in a Dialog. Arrow keys move the highlight, Enter runs it and Escape closes the palette. */\nexport const CommandPalette = forwardRef<HTMLDivElement, CommandPaletteProps>(function CommandPalette(\n {\n open,\n defaultOpen = false,\n onClose,\n commands,\n onRun,\n searchLabel = 'Search commands',\n resultsLabel = 'Commands',\n emptyMessage = 'No commands found.',\n className,\n ...props\n },\n ref,\n) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const inputRef = useRef<HTMLInputElement>(null);\n const isOpen = open ?? internalOpen;\n\n const close = () => {\n setInternalOpen(false);\n onClose?.();\n };\n\n return (\n <Dialog\n ref={ref}\n open={isOpen}\n onClose={close}\n size=\"md\"\n aria-label={searchLabel}\n initialFocusRef={inputRef}\n className={cx(styles.palette, className)}\n {...props}\n >\n <PaletteContent\n commands={commands}\n searchLabel={searchLabel}\n resultsLabel={resultsLabel}\n emptyMessage={emptyMessage}\n inputRef={inputRef}\n onRun={(command) => {\n onRun?.(command);\n close();\n }}\n />\n </Dialog>\n );\n});\n","import { forwardRef, useRef, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport { Button } from '../Button';\nimport { Dialog, DialogFooter, DialogHeader, type DialogSize } from '../Dialog';\n\nexport type ConfirmDialogTone = 'default' | 'danger';\n\nexport interface ConfirmDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'role'> {\n /** Whether the dialog is showing. Leave undefined to use `defaultOpen` and let the dialog manage itself. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** The question being asked. */\n title: ReactNode;\n /** What happens if the user confirms. */\n description?: ReactNode;\n /** Label of the confirm button. */\n confirmLabel?: string;\n /** Label of the cancel button. */\n cancelLabel?: string;\n /** `danger` is for destructive actions: the confirm button turns red and focus starts on cancel. */\n tone?: ConfirmDialogTone;\n /** Called when the user confirms. */\n onConfirm?: () => void;\n /** Called when the user cancels, including with Escape or a backdrop press. */\n onCancel?: () => void;\n /** Panel width. */\n size?: DialogSize;\n}\n\n/** Asks the user to confirm or cancel an action. Built on Dialog with the `alertdialog` role. */\nexport const ConfirmDialog = forwardRef<HTMLDivElement, ConfirmDialogProps>(function ConfirmDialog(\n {\n open,\n defaultOpen = false,\n title,\n description,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n tone = 'default',\n onConfirm,\n onCancel,\n size = 'sm',\n ...props\n },\n ref,\n) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n const isOpen = open ?? internalOpen;\n\n const cancel = () => {\n setInternalOpen(false);\n onCancel?.();\n };\n const confirm = () => {\n setInternalOpen(false);\n onConfirm?.();\n };\n\n return (\n <Dialog\n ref={ref}\n open={isOpen}\n onClose={cancel}\n size={size}\n role=\"alertdialog\"\n initialFocusRef={tone === 'danger' ? cancelRef : confirmRef}\n {...props}\n >\n <DialogHeader title={title} description={description} hideClose />\n <DialogFooter>\n <Button ref={cancelRef} variant=\"secondary\" onClick={cancel}>\n {cancelLabel}\n </Button>\n <Button ref={confirmRef} variant={tone === 'danger' ? 'danger' : 'primary'} onClick={confirm}>\n {confirmLabel}\n </Button>\n </DialogFooter>\n </Dialog>\n );\n});\n",".status {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.dot {\n flex: none;\n width: 8px;\n height: 8px;\n border-radius: var(--radius-full);\n}\n\n.success {\n background: var(--color-status-success);\n}\n\n.warning {\n background: var(--color-status-warning);\n}\n\n.danger {\n background: var(--color-status-danger);\n}\n\n.info {\n background: var(--color-status-info);\n}\n\n.neutral {\n background: var(--color-status-neutral);\n}\n\n.pending {\n background: transparent;\n border: var(--stroke-strong) solid var(--color-status-pending);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Status.module.css';\n\nexport type StatusTone = 'success' | 'warning' | 'danger' | 'info' | 'neutral' | 'pending';\n\nexport interface StatusProps extends HTMLAttributes<HTMLSpanElement> {\n /** State of the object. Sets the dot colour; `pending` draws a hollow ring. */\n tone?: StatusTone;\n}\n\n/** Dot plus text, for object state in tables, cards and headers. The text always states the status, so colour is never the only signal. */\nexport const Status = forwardRef<HTMLSpanElement, StatusProps>(function Status({ tone = 'neutral', className, children, ...props }, ref) {\n return (\n <span ref={ref} className={cx(styles.status, className)} {...props}>\n <span className={cx(styles.dot, styles[tone])} aria-hidden=\"true\" />\n {children}\n </span>\n );\n});\n",".row {\n display: grid;\n grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 90px 110px 70px;\n align-items: center;\n gap: var(--space-16);\n padding: var(--space-10) var(--space-0);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.row:hover,\n.row[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.names {\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.subtitle {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.type {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.tags {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.updated {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n text-align: right;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Status, type StatusTone } from '../Status';\nimport styles from './ContentRow.module.css';\n\nexport interface ContentRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The name of the content. */\n title: ReactNode;\n /** A quieter line below the name, such as its path. */\n subtitle?: ReactNode;\n /** The kind of content. */\n type?: ReactNode;\n /** Short tags, such as languages. */\n tags?: ReactNode;\n /** Tone of the status dot. */\n statusTone?: StatusTone;\n /** The status text. */\n statusLabel?: ReactNode;\n /** When it last changed. */\n updated?: ReactNode;\n}\n\n/** One item in a list of content. */\nexport const ContentRow = forwardRef<HTMLDivElement, ContentRowProps>(function ContentRow(\n { title, subtitle, type, tags, statusTone = 'neutral', statusLabel, updated, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.row, className)} {...props}>\n <div className={styles.names}>\n <div className={styles.title}>{title}</div>\n {subtitle && <div className={styles.subtitle}>{subtitle}</div>}\n </div>\n <div className={styles.type}>{type}</div>\n <div className={styles.tags}>{tags}</div>\n <div>{statusLabel && <Status tone={statusTone}>{statusLabel}</Status>}</div>\n <div className={styles.updated}>{updated}</div>\n </div>\n );\n});\n",".row {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-12) var(--space-14);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.icon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n\n.names {\n flex: 1;\n min-width: 0;\n}\n\n.name {\n color: var(--color-text-primary);\n font: var(--font-mono-m);\n overflow-wrap: anywhere;\n}\n\n.reference {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n overflow-wrap: anywhere;\n}\n\n.valueState {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n white-space: nowrap;\n}\n\n.meta {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './CredentialRow.module.css';\n\nexport interface CredentialRowProps extends HTMLAttributes<HTMLDivElement> {\n /** The name of the credential. */\n name: ReactNode;\n /** Where it is stored. Never put the secret itself here. */\n reference?: ReactNode;\n /** Icon at the left. */\n icon?: IconName;\n /** The state of the value, such as `Value hidden`. */\n valueState?: ReactNode;\n /** A short fact, such as when it was last rotated. */\n meta?: ReactNode;\n /** The control at the right, normally a ghost Button. */\n action?: ReactNode;\n}\n\n/** One stored credential, showing where it is kept and never its value. */\nexport const CredentialRow = forwardRef<HTMLDivElement, CredentialRowProps>(function CredentialRow(\n { name, reference, icon = 'lock', valueState, meta, action, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.row, className)} {...props}>\n <Icon name={icon} className={styles.icon} />\n <div className={styles.names}>\n <div className={styles.name}>{name}</div>\n {reference && <div className={styles.reference}>{reference}</div>}\n </div>\n {valueState && <span className={styles.valueState}>{valueState}</span>}\n {meta && <span className={styles.meta}>{meta}</span>}\n {action}\n </div>\n );\n});\n",".menu {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n width: 240px;\n padding: var(--space-4);\n overflow-y: auto;\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Menu.module.css';\n\nexport type MenuProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * The floating surface for a list of MenuItems. It is visual only and has no behaviour, so give it the `role` the\n * content needs. For interactive lists use Select, MultiSelect or DropdownMenu.\n */\nexport const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu({ className, ...props }, ref) {\n return <div ref={ref} className={cx(styles.menu, className)} {...props} />;\n});\n",".item {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--space-8);\n padding: var(--space-6) var(--space-8);\n border-radius: var(--radius-sm);\n font: var(--font-body-s);\n color: var(--color-text-primary);\n cursor: default;\n}\n\n.item:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.item:hover:not(.disabled),\n.active:not(.disabled),\n.item:focus:not(.disabled) {\n background: var(--color-bg-hover);\n}\n\n.label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.shortcut {\n font: var(--font-mono-s);\n color: var(--color-text-secondary);\n}\n\n.check {\n flex-shrink: 0;\n color: var(--color-icon-accent);\n}\n\n.danger {\n color: var(--color-text-danger);\n}\n\n.disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.disabled .shortcut {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './MenuItem.module.css';\n\nexport interface MenuItemProps extends HTMLAttributes<HTMLDivElement> {\n /** Icon before the label. */\n icon?: IconName;\n /** Shows the orange check for the chosen item. */\n selected?: boolean;\n /** Shows the highlight, for the item under the pointer or the keyboard. */\n active?: boolean;\n /** Dims the item and sets `aria-disabled`. */\n disabled?: boolean;\n /** Uses the danger colour, for destructive actions. */\n danger?: boolean;\n /** Keyboard shortcut shown at the end of the row. */\n shortcut?: string;\n /** Replaces the icon, for a control such as a checkbox. */\n leading?: ReactNode;\n}\n\n/** One row of a Menu. It is visual only, so give it the `role` and handlers the list needs. */\nexport const MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(function MenuItem(\n { icon, selected, active, disabled, danger, shortcut, leading, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(styles.item, active && styles.active, disabled && styles.disabled, danger && styles.danger, className)}\n aria-disabled={disabled || undefined}\n {...props}\n >\n {leading ?? (icon && <Icon name={icon} />)}\n <span className={styles.label}>{children}</span>\n {shortcut && <span className={styles.shortcut}>{shortcut}</span>}\n {selected && <Icon name=\"check\" className={styles.check} />}\n </div>\n );\n});\n","import { useCallback, useEffect, useLayoutEffect, useRef, type CSSProperties, type RefObject } from 'react';\n\n/** Which edge of the trigger the popup lines up with. It opens below, and flips above when there is no room. */\nexport type PopupPlacement = 'bottom-start' | 'bottom-end';\n\n/** Why the popup asked to close. */\nexport type PopupCloseReason = 'outside' | 'escape';\n\nexport interface UsePopupOptions {\n /** Whether the popup is rendered. The hook only positions and listens while this is true. */\n open: boolean;\n /** Called on a pointer press outside the trigger and popup, and on Escape. The caller sets `open` to false. */\n onClose: (reason: PopupCloseReason) => void;\n /** Which edge of the trigger to line up with. */\n placement?: PopupPlacement;\n /** Gap between trigger and popup, in pixels. */\n offset?: number;\n /** Makes the popup exactly as wide as the trigger. */\n matchTriggerWidth?: boolean;\n /** Set to false if the caller handles Escape itself. */\n closeOnEscape?: boolean;\n}\n\nexport interface UsePopupResult<TTrigger extends HTMLElement, TPopup extends HTMLElement> {\n /** Attach to the element the popup is anchored to. */\n triggerRef: RefObject<TTrigger | null>;\n /** Attach to the popup element. */\n popupRef: RefObject<TPopup | null>;\n /** Spread as `style` on the popup element. */\n popupStyle: CSSProperties;\n /** Measures and positions again. Scrolling and resizing already do this. */\n reposition: () => void;\n}\n\nconst VIEWPORT_MARGIN = 8;\nconst popupStyle: CSSProperties = { position: 'fixed', top: 0, left: 0, zIndex: 1100 };\n\n/**\n * Positions a portalled popup against a trigger, and dismisses it.\n *\n * The popup uses `position: fixed` and is positioned by writing to its style, so moving it does not re-render.\n * It flips above the trigger when there is no room below, stays inside the viewport and limits its own height.\n * While `open`, it follows scrolling, resizing and size changes of the trigger or popup. A pointer press outside\n * both elements or Escape calls `onClose`. `data-placement` on the popup is `top` or `bottom`.\n *\n * The caller renders the popup and owns focus:\n *\n * ```tsx\n * const { triggerRef, popupRef, popupStyle } = usePopup<HTMLButtonElement>({ open, onClose: () => setOpen(false) });\n * <button ref={triggerRef} onClick={() => setOpen(!open)}>Open</button>\n * {open && createPortal(<div ref={popupRef} style={popupStyle}>Content</div>, document.body)}\n * ```\n */\nexport function usePopup<TTrigger extends HTMLElement = HTMLElement, TPopup extends HTMLElement = HTMLDivElement>({\n open,\n onClose,\n placement = 'bottom-start',\n offset = 4,\n matchTriggerWidth = false,\n closeOnEscape = true,\n}: UsePopupOptions): UsePopupResult<TTrigger, TPopup> {\n const triggerRef = useRef<TTrigger | null>(null);\n const popupRef = useRef<TPopup | null>(null);\n\n const reposition = useCallback(() => {\n const trigger = triggerRef.current;\n const popup = popupRef.current;\n if (!trigger || !popup) return;\n\n const rect = trigger.getBoundingClientRect();\n if (matchTriggerWidth) popup.style.width = `${rect.width}px`;\n\n // Measure the natural height, without the limit set by the last pass.\n popup.style.maxHeight = '';\n const height = popup.offsetHeight;\n const width = popup.offsetWidth;\n\n const roomBelow = window.innerHeight - rect.bottom - offset - VIEWPORT_MARGIN;\n const roomAbove = rect.top - offset - VIEWPORT_MARGIN;\n const above = height > roomBelow && roomAbove > roomBelow;\n const room = Math.max(above ? roomAbove : roomBelow, 0);\n const shownHeight = Math.min(height, room);\n if (height > room) popup.style.maxHeight = `${room}px`;\n\n const wantedLeft = placement === 'bottom-end' ? rect.right - width : rect.left;\n const maxLeft = window.innerWidth - width - VIEWPORT_MARGIN;\n popup.style.left = `${Math.max(Math.min(wantedLeft, maxLeft), VIEWPORT_MARGIN)}px`;\n popup.style.top = `${above ? rect.top - offset - shownHeight : rect.bottom + offset}px`;\n popup.dataset.placement = above ? 'top' : 'bottom';\n }, [matchTriggerWidth, offset, placement]);\n\n useLayoutEffect(() => {\n if (!open) return;\n reposition();\n\n const observer = new ResizeObserver(reposition);\n if (triggerRef.current) observer.observe(triggerRef.current);\n if (popupRef.current) observer.observe(popupRef.current);\n window.addEventListener('scroll', reposition, { capture: true, passive: true });\n window.addEventListener('resize', reposition);\n return () => {\n observer.disconnect();\n window.removeEventListener('scroll', reposition, { capture: true });\n window.removeEventListener('resize', reposition);\n };\n }, [open, reposition]);\n\n useEffect(() => {\n if (!open) return;\n\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (triggerRef.current?.contains(target) || popupRef.current?.contains(target)) return;\n onClose('outside');\n };\n // Capture and stop, so Escape in a popup inside a dialog closes only the popup.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !closeOnEscape) return;\n event.preventDefault();\n event.stopPropagation();\n onClose('escape');\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n document.addEventListener('keydown', onKeyDown, true);\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('keydown', onKeyDown, true);\n };\n }, [closeOnEscape, onClose, open]);\n\n return { triggerRef, popupRef, popupStyle, reposition };\n}\n","import { createContext } from 'react';\n\nexport interface DropdownMenuContextValue {\n /** Closes the menu and returns focus to its trigger. */\n close: () => void;\n}\n\nexport const DropdownMenuContext = createContext<DropdownMenuContextValue | null>(null);\n","import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { Menu, usePopup, type PopupPlacement } from '../Menu';\nimport { DropdownMenuContext } from './DropdownMenuContext';\n\nconst ITEM_SELECTOR = '[role=\"menuitem\"]:not([aria-disabled=\"true\"]),[role=\"menuitemcheckbox\"]:not([aria-disabled=\"true\"])';\nconst TYPE_AHEAD_RESET_MS = 500;\n\n/** Props a custom trigger must spread onto its button. */\nexport interface DropdownMenuTriggerProps {\n ref: Ref<HTMLElement>;\n id: string;\n 'aria-haspopup': 'menu';\n 'aria-expanded': boolean;\n 'aria-controls'?: string;\n onClick: (event: MouseEvent<HTMLElement>) => void;\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n}\n\ntype TriggerElementProps = Partial<Pick<DropdownMenuTriggerProps, 'onClick' | 'onKeyDown'>>;\n\nexport interface DropdownMenuProps {\n /** The button that opens the menu: an element such as `<Button>`, or a function that spreads the given props onto one. */\n trigger: ReactElement<TriggerElementProps> | ((props: DropdownMenuTriggerProps) => ReactNode);\n /** DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuLabel and DropdownMenuSeparator rows. */\n children: ReactNode;\n /** Whether the menu is open, when controlled. */\n open?: boolean;\n /** Whether the menu starts open, when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the menu asks to open or close. */\n onOpenChange?: (open: boolean) => void;\n /** Which edge of the trigger the menu lines up with. */\n placement?: PopupPlacement;\n /** Class name for the popup. */\n className?: string;\n}\n\n/** Renders the trigger with the menu button props, keeping any handlers it already has. */\nfunction TriggerSlot({ trigger, triggerProps }: { trigger: DropdownMenuProps['trigger']; triggerProps: DropdownMenuTriggerProps }) {\n if (typeof trigger === 'function') return trigger(triggerProps);\n const own = trigger.props;\n return cloneElement(trigger, {\n ...triggerProps,\n onClick: (event: MouseEvent<HTMLElement>) => {\n own.onClick?.(event);\n triggerProps.onClick(event);\n },\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => {\n own.onKeyDown?.(event);\n triggerProps.onKeyDown(event);\n },\n } as TriggerElementProps);\n}\n\n/** Action menu with a button trigger, following the WAI-ARIA menu button pattern. For choosing a value use Select. */\nexport function DropdownMenu({\n trigger,\n children,\n open,\n defaultOpen = false,\n onOpenChange,\n placement = 'bottom-start',\n className,\n}: DropdownMenuProps) {\n const [innerOpen, setInnerOpen] = useState(defaultOpen);\n const isOpen = open ?? innerOpen;\n const baseId = useId();\n const triggerId = `${baseId}-trigger`;\n const menuId = `${baseId}-menu`;\n const initialFocus = useRef<'first' | 'last'>('first');\n const typed = useRef({ text: '', time: 0 });\n\n const setOpenState = useCallback(\n (next: boolean) => {\n if (open === undefined) setInnerOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange, open],\n );\n\n const closeAndFocus = useCallback(() => {\n setOpenState(false);\n document.getElementById(triggerId)?.focus();\n }, [setOpenState, triggerId]);\n\n const { triggerRef, popupRef, popupStyle } = usePopup<HTMLElement>({ open: isOpen, onClose: closeAndFocus, placement });\n\n // Focus moves into the menu when it opens.\n useEffect(() => {\n if (!isOpen) return;\n const items = popupRef.current?.querySelectorAll<HTMLElement>(ITEM_SELECTOR);\n if (!items?.length) return;\n (initialFocus.current === 'last' ? items[items.length - 1] : items[0]).focus();\n initialFocus.current = 'first';\n }, [isOpen, popupRef]);\n\n const context = useMemo(() => ({ close: closeAndFocus }), [closeAndFocus]);\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n initialFocus.current = event.key === 'ArrowUp' ? 'last' : 'first';\n setOpenState(true);\n }\n };\n\n const onMenuKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const items = [...event.currentTarget.querySelectorAll<HTMLElement>(ITEM_SELECTOR)];\n if (items.length === 0) return;\n const index = items.indexOf(document.activeElement as HTMLElement);\n const focusAt = (next: number) => {\n event.preventDefault();\n items[(next + items.length) % items.length].focus();\n };\n if (event.key === 'ArrowDown') focusAt(index + 1);\n else if (event.key === 'ArrowUp') focusAt(index - 1);\n else if (event.key === 'Home') focusAt(0);\n else if (event.key === 'End') focusAt(items.length - 1);\n // Focus goes to the trigger first, so Tab carries on from there as the browser moves it.\n else if (event.key === 'Tab') closeAndFocus();\n else if (event.key.length === 1 && event.key !== ' ' && !event.altKey && !event.ctrlKey && !event.metaKey) {\n const buffer = typed.current;\n buffer.text = (event.timeStamp - buffer.time > TYPE_AHEAD_RESET_MS ? event.key : buffer.text + event.key).toLowerCase();\n buffer.time = event.timeStamp;\n const repeated = [...buffer.text].every((letter) => letter === buffer.text[0]);\n const search = repeated ? buffer.text[0] : buffer.text;\n const start = repeated ? index + 1 : Math.max(index, 0);\n for (let offset = 0; offset < items.length; offset += 1) {\n const item = items[(start + offset) % items.length];\n if (item.textContent?.trim().toLowerCase().startsWith(search)) {\n item.focus();\n break;\n }\n }\n }\n };\n\n const triggerProps: DropdownMenuTriggerProps = {\n ref: triggerRef,\n id: triggerId,\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n onClick: () => setOpenState(!isOpen),\n onKeyDown: onTriggerKeyDown,\n };\n\n return (\n <>\n <TriggerSlot trigger={trigger} triggerProps={triggerProps} />\n {isOpen &&\n createPortal(\n <DropdownMenuContext.Provider value={context}>\n <Menu\n ref={popupRef}\n id={menuId}\n role=\"menu\"\n aria-labelledby={triggerId}\n style={popupStyle}\n className={className}\n onKeyDown={onMenuKeyDown}\n >\n {children}\n </Menu>\n </DropdownMenuContext.Provider>,\n document.body,\n )}\n </>\n );\n}\n","import { forwardRef, useState, type HTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';\nimport { MenuItem } from '../Menu';\n\nexport interface DropdownMenuCheckboxItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Whether the item is ticked, when controlled. */\n checked?: boolean;\n /** Whether the item starts ticked, when uncontrolled. */\n defaultChecked?: boolean;\n /** Called with the new state. The menu stays open, so several items can be changed. */\n onCheckedChange?: (checked: boolean) => void;\n /** Stops the item changing, and keyboard navigation skips it. */\n disabled?: boolean;\n}\n\n/** An on or off setting in a DropdownMenu. The orange check shows when it is on. */\nexport const DropdownMenuCheckboxItem = forwardRef<HTMLDivElement, DropdownMenuCheckboxItemProps>(function DropdownMenuCheckboxItem(\n { checked, defaultChecked = false, onCheckedChange, disabled, onClick, onKeyDown, onMouseEnter, ...props },\n ref,\n) {\n const [innerChecked, setInnerChecked] = useState(defaultChecked);\n const isChecked = checked ?? innerChecked;\n return (\n <MenuItem\n ref={ref}\n role=\"menuitemcheckbox\"\n tabIndex={-1}\n aria-checked={isChecked}\n selected={isChecked}\n disabled={disabled}\n onClick={(event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (disabled) return;\n if (checked === undefined) setInnerChecked(!isChecked);\n onCheckedChange?.(!isChecked);\n }}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n event.currentTarget.click();\n }\n }}\n onMouseEnter={(event: MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n if (!disabled) event.currentTarget.focus();\n }}\n {...props}\n />\n );\n});\n","import { forwardRef, useContext, type HTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';\nimport type { IconName } from '../../icons';\nimport { MenuItem } from '../Menu';\nimport { DropdownMenuContext } from './DropdownMenuContext';\n\nexport interface DropdownMenuItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /** Icon before the label. */\n icon?: IconName;\n /** Keyboard shortcut shown at the end of the row. It is a hint only and does not bind the key. */\n shortcut?: string;\n /** Uses the danger colour, for destructive actions. */\n danger?: boolean;\n /** Stops the item being chosen, and keyboard navigation skips it. */\n disabled?: boolean;\n /** Called when the item is chosen with the pointer, Enter or Space. The menu then closes. */\n onSelect?: () => void;\n}\n\n/** One action in a DropdownMenu. */\nexport const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(function DropdownMenuItem(\n { icon, shortcut, danger, disabled, onSelect, onClick, onKeyDown, onMouseEnter, ...props },\n ref,\n) {\n const menu = useContext(DropdownMenuContext);\n return (\n <MenuItem\n ref={ref}\n role=\"menuitem\"\n tabIndex={-1}\n icon={icon}\n shortcut={shortcut}\n danger={danger}\n disabled={disabled}\n onClick={(event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (disabled) return;\n onSelect?.();\n menu?.close();\n }}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n event.currentTarget.click();\n }\n }}\n onMouseEnter={(event: MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n if (!disabled) event.currentTarget.focus();\n }}\n {...props}\n />\n );\n});\n",".label {\n padding: var(--space-6) var(--space-8) var(--space-2);\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './DropdownMenuLabel.module.css';\n\nexport type DropdownMenuLabelProps = HTMLAttributes<HTMLDivElement>;\n\n/** A heading for the items that follow it in a DropdownMenu. */\nexport const DropdownMenuLabel = forwardRef<HTMLDivElement, DropdownMenuLabelProps>(function DropdownMenuLabel(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} role=\"presentation\" className={cx(styles.label, className)} {...props} />;\n});\n",".separator {\n flex-shrink: 0;\n height: 1px;\n margin: var(--space-2) 0;\n background: var(--color-border-subtle);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './DropdownMenuSeparator.module.css';\n\nexport type DropdownMenuSeparatorProps = HTMLAttributes<HTMLDivElement>;\n\n/** A line between groups of items in a DropdownMenu. */\nexport const DropdownMenuSeparator = forwardRef<HTMLDivElement, DropdownMenuSeparatorProps>(function DropdownMenuSeparator(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} role=\"separator\" className={cx(styles.separator, className)} {...props} />;\n});\n",".emptyState {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--space-4);\n padding: var(--space-40) var(--space-24);\n color: var(--color-text-primary);\n text-align: center;\n}\n\n.icon {\n margin-bottom: var(--space-8);\n color: var(--color-icon-secondary);\n}\n\n.title {\n font: var(--font-heading-m);\n letter-spacing: var(--tracking-heading-m);\n}\n\n.description {\n max-width: 400px;\n margin: 0;\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n\n.action {\n margin-top: var(--space-12);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './EmptyState.module.css';\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Icon above the title. */\n icon?: IconName;\n /** What is empty. */\n title: ReactNode;\n /** Why it is empty, or what to do about it. */\n description?: ReactNode;\n /** The next step, normally a Button. */\n action?: ReactNode;\n}\n\n/** Fills a space that has no content yet, and points to the next step. */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n { icon, title, description, action, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.emptyState, className)} {...props}>\n {icon && <Icon name={icon} size={24} className={styles.icon} />}\n <div className={styles.title}>{title}</div>\n {description && <p className={styles.description}>{description}</p>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n );\n});\n",".chip {\n display: inline-flex;\n align-items: center;\n gap: var(--space-4);\n height: 24px;\n padding: var(--space-0) var(--space-8);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-full);\n font: var(--font-caption);\n white-space: nowrap;\n}\n\n.applied {\n background: var(--color-bg-accent-subtle);\n color: var(--color-text-primary);\n}\n\n/* data-state='hover' lets a story show the hover state without a pointer. */\n.applied:hover,\n.applied[data-state='hover'] {\n border-color: var(--color-border-focus);\n}\n\n.field {\n color: var(--color-text-secondary);\n}\n\n.value {\n font: var(--font-label-s);\n}\n\n.remove {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: var(--space-0);\n background: transparent;\n border: none;\n border-radius: var(--radius-sm);\n color: var(--color-text-primary);\n cursor: pointer;\n}\n\n.remove:focus-visible,\n.add:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.add {\n background: transparent;\n border: var(--stroke-hairline) dashed var(--color-border-default);\n color: var(--color-text-secondary);\n font-family: inherit;\n cursor: pointer;\n}\n\n.add:hover {\n background: var(--color-bg-hover);\n color: var(--color-text-primary);\n}\n","import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes, type MouseEventHandler, type ReactNode, type Ref } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './FilterChip.module.css';\n\nexport type FilterChipState = 'applied' | 'hover' | 'add';\n\nexport interface FilterChipProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n /** `applied` shows one filter. `hover` forces the hover look. `add` is the button that adds a filter. */\n state?: FilterChipState;\n /** The field being filtered, such as `Status`. */\n field?: ReactNode;\n /** The chosen values, such as `Healthy, Degraded`. */\n value?: ReactNode;\n /** Called when the remove button is pressed. Without it, no remove button is shown. */\n onRemove?: MouseEventHandler<HTMLButtonElement>;\n /** Accessible name of the remove button. */\n removeLabel?: string;\n /** Text of the `add` chip. */\n addLabel?: ReactNode;\n}\n\n/** One applied filter above a table, or the button that adds another. Orange tint marks it as a selection. */\nexport const FilterChip = forwardRef<HTMLElement, FilterChipProps>(function FilterChip(\n { state = 'applied', field, value, onRemove, removeLabel, addLabel = 'Add filter', className, ...props },\n ref,\n) {\n if (state === 'add') {\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n className={cx(styles.chip, styles.add, className)}\n {...(props as ButtonHTMLAttributes<HTMLButtonElement>)}\n >\n <Icon name=\"plus\" size={14} />\n {addLabel}\n </button>\n );\n }\n return (\n <span ref={ref} className={cx(styles.chip, styles.applied, className)} data-state={state === 'hover' ? 'hover' : undefined} {...props}>\n <span className={styles.field}>{field}:</span>\n <span className={styles.value}>{value}</span>\n {onRemove && (\n <button type=\"button\" className={styles.remove} aria-label={removeLabel ?? 'Remove filter'} onClick={onRemove}>\n <Icon name=\"x\" size={14} />\n </button>\n )}\n </span>\n );\n});\n","import { createContext } from 'react';\n\nexport interface FieldContextValue {\n /** The id the label points at. */\n controlId: string;\n /** The id of the label, for controls that need `aria-labelledby`. */\n labelId: string;\n /** The id of the help or error text, if either is showing. */\n describedById?: string;\n /** True when the field shows an error. */\n invalid: boolean;\n /** True when the field is disabled. */\n disabled: boolean;\n /** True when the field is locked. */\n locked: boolean;\n /** True when the field is required. */\n required: boolean;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n","import { useContext } from 'react';\nimport { FieldContext } from './FieldContext';\n\nexport interface FieldControlInput {\n /** The control's own id. A surrounding Field's id takes priority, so its label stays connected. */\n id?: string;\n /** The control's own error state. */\n invalid?: boolean;\n /** The control's own disabled state. */\n disabled?: boolean;\n /** The control's own locked state. */\n locked?: boolean;\n /** The control's own required state. */\n required?: boolean;\n /** Extra descriptions, kept beside the Field's help or error text. */\n 'aria-describedby'?: string;\n /** The control's own label reference. */\n 'aria-labelledby'?: string;\n}\n\nexport interface FieldControlResult {\n /** Use as the control's `id`. */\n id?: string;\n /** Show the error state and set `aria-invalid`. */\n invalid: boolean;\n /** Disable the control. */\n disabled: boolean;\n /** Show the locked state. */\n locked: boolean;\n /** Mark the control as required. */\n required: boolean;\n /** Use as `aria-describedby`. */\n describedBy?: string;\n /** The Field's label id, or the control's own `aria-labelledby`. Custom controls such as a combobox use this. */\n labelledBy?: string;\n}\n\n/** Merges a control's own props with the surrounding Field, if there is one. Build custom Field controls with this. */\nexport function useFieldControl(props: FieldControlInput = {}): FieldControlResult {\n const field = useContext(FieldContext);\n const describedBy = [field?.describedById, props['aria-describedby']].filter(Boolean).join(' ');\n return {\n id: field?.controlId ?? props.id,\n invalid: Boolean(props.invalid || field?.invalid),\n disabled: Boolean(props.disabled || field?.disabled),\n locked: Boolean(props.locked || field?.locked),\n required: Boolean(props.required || field?.required),\n describedBy: describedBy || undefined,\n labelledBy: props['aria-labelledby'] ?? field?.labelId,\n };\n}\n","/* The box shared by the text-like controls: Input, Textarea, Search, DateField, NumberField, Select and MultiSelect. */\n.control {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n width: 100%;\n padding: var(--space-8) var(--space-12);\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-md);\n font: var(--font-body-m);\n color: var(--color-text-primary);\n}\n\n/* data-state='hover' lets a story show the hover state without a pointer. */\n.control:hover,\n.control[data-state='hover'],\n.control:has(> [data-state='hover']) {\n border-color: var(--color-border-strong);\n}\n\n.invalid,\n.invalid:hover,\n.invalid[data-state='hover'],\n.invalid:has(> [data-state='hover']) {\n border-color: var(--color-border-danger);\n}\n\n.control:has(> .field:focus-visible),\n.control:focus-visible,\n.control[aria-expanded='true'] {\n border-color: var(--color-border-focus);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: calc(var(--stroke-hairline) * -1);\n}\n\n.locked,\n.locked:hover {\n background: var(--color-bg-subtle);\n border-color: var(--color-border-subtle);\n color: var(--color-text-secondary);\n}\n\n.disabled,\n.disabled:hover {\n background: var(--color-bg-disabled);\n border-color: transparent;\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n/* The native element inside the box. */\n.field {\n flex: 1;\n min-width: 0;\n width: 100%;\n padding: 0;\n background: transparent;\n border: 0;\n outline: 0;\n font: inherit;\n color: inherit;\n}\n\n.field::placeholder {\n color: var(--color-text-tertiary);\n opacity: 1;\n}\n\n.field:disabled {\n cursor: not-allowed;\n}\n\n.field:disabled::placeholder {\n color: var(--color-text-disabled);\n}\n\n.icon {\n flex-shrink: 0;\n color: var(--color-icon-primary);\n}\n\n.disabled .icon {\n color: var(--color-icon-muted);\n}\n\n.lockedTag {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--space-6);\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n",".input {\n appearance: none;\n}\n\n.input::-webkit-search-cancel-button {\n appearance: none;\n}\n\n.shortcut {\n flex-shrink: 0;\n padding: 0 var(--space-6);\n background: var(--color-bg-subtle);\n border-radius: var(--radius-sm);\n font: var(--font-mono-s);\n color: var(--color-text-secondary);\n}\n\n.clear {\n display: inline-flex;\n flex-shrink: 0;\n padding: 0;\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--color-icon-secondary);\n cursor: pointer;\n}\n\n.clear:hover {\n color: var(--color-icon-primary);\n}\n\n.clear:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n","import { forwardRef, useImperativeHandle, useRef, useState, type InputHTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport styles from './Search.module.css';\n\nexport interface SearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue'> {\n /** The query, when controlled. */\n value?: string;\n /** The first query, when uncontrolled. */\n defaultValue?: string;\n /** Keyboard shortcut chip, such as \"Ctrl K\". It is hidden while there is a value. */\n shortcut?: string;\n /** Called after the clear button empties the box. `onChange` fires first. */\n onClear?: () => void;\n /** Accessible name of the clear button. */\n clearLabel?: string;\n}\n\n/** Search box with an optional keyboard shortcut and a clear button. Sits at the top of a sidebar or table. */\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(function Search(\n {\n value,\n defaultValue = '',\n shortcut,\n onClear,\n clearLabel = 'Clear search',\n onChange,\n id,\n disabled,\n className,\n 'aria-describedby': describedBy,\n ...props\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const [innerValue, setInnerValue] = useState(defaultValue);\n const current = value ?? innerValue;\n const field = useFieldControl({ id, disabled, 'aria-describedby': describedBy });\n\n const clear = () => {\n const input = inputRef.current;\n if (!input) return;\n // Use the native setter and event, so a caller's onChange runs just as it does for typing.\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, '');\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.focus();\n onClear?.();\n };\n\n return (\n <div className={cx(control.control, field.invalid && control.invalid, field.disabled && control.disabled, className)}>\n <Icon name=\"search\" className={control.icon} />\n <input\n ref={inputRef}\n id={field.id}\n type=\"search\"\n className={cx(control.field, styles.input)}\n value={current}\n disabled={field.disabled}\n aria-invalid={field.invalid || undefined}\n aria-describedby={field.describedBy}\n onChange={(event) => {\n setInnerValue(event.target.value);\n onChange?.(event);\n }}\n {...props}\n />\n {current && !field.disabled ? (\n <button type=\"button\" className={styles.clear} aria-label={clearLabel} onClick={clear}>\n <Icon name=\"x\" />\n </button>\n ) : (\n shortcut && <kbd className={styles.shortcut}>{shortcut}</kbd>\n )}\n </div>\n );\n});\n",".menu {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n width: 264px;\n padding: var(--space-12);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n box-shadow: var(--elevation-overlay);\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.options {\n display: flex;\n flex-direction: column;\n gap: var(--space-6);\n overflow-y: auto;\n padding: var(--space-4);\n}\n\n.option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-8);\n}\n\n.count {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.noMatches {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n gap: var(--space-8);\n}\n","import { forwardRef, useId, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Button } from '../Button';\nimport { Checkbox } from '../Checkbox';\nimport { Search } from '../Search';\nimport styles from './FilterMenu.module.css';\n\nexport interface FilterOption {\n /** Stored when the option is chosen. */\n value: string;\n /** Shown to the person. */\n label: string;\n /** How many rows have this value. */\n count?: number;\n}\n\nexport interface FilterMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'defaultValue' | 'onChange'> {\n /** The field being filtered, such as `Status`. */\n title: ReactNode;\n /** The options to choose from. */\n options: FilterOption[];\n /** The chosen values, when controlled. They are a draft until Apply. */\n value?: string[];\n /** The first chosen values, when uncontrolled. */\n defaultValue?: string[];\n /** Called whenever a box is ticked or cleared. */\n onChange?: (value: string[]) => void;\n /** Called with the chosen values when Apply is pressed. */\n onApply?: (value: string[]) => void;\n /** Called after Clear empties the choices. */\n onClear?: () => void;\n /** Hides the search box, for a short list. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown when the search matches no option. */\n noMatchesLabel?: ReactNode;\n /** Text of the Clear button. */\n clearLabel?: string;\n /** Text of the Apply button. */\n applyLabel?: string;\n}\n\n/** A panel of checkbox options with counts. Choices apply only when Apply is pressed. Place it in a popup. */\nexport const FilterMenu = forwardRef<HTMLDivElement, FilterMenuProps>(function FilterMenu(\n {\n title,\n options,\n value,\n defaultValue = [],\n onChange,\n onApply,\n onClear,\n searchable = true,\n searchPlaceholder = 'Find an option…',\n noMatchesLabel = 'No matching options',\n clearLabel = 'Clear',\n applyLabel = 'Apply',\n className,\n role = 'group',\n ...props\n },\n ref,\n) {\n const titleId = useId();\n const [innerValue, setInnerValue] = useState(defaultValue);\n const [query, setQuery] = useState('');\n const current = value ?? innerValue;\n const needle = query.trim().toLowerCase();\n const shown = options.filter((option) => option.label.toLowerCase().includes(needle));\n\n const update = (next: string[]) => {\n setInnerValue(next);\n onChange?.(next);\n };\n\n return (\n <div ref={ref} role={role} aria-labelledby={titleId} className={cx(styles.menu, className)} {...props}>\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n {searchable && (\n <Search\n value={query}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n onChange={(event) => setQuery(event.target.value)}\n />\n )}\n <div className={styles.options}>\n {shown.map((option) => (\n <div key={option.value} className={styles.option}>\n <Checkbox\n label={option.label}\n checked={current.includes(option.value)}\n onChange={(event) =>\n update(event.target.checked ? [...current, option.value] : current.filter((item) => item !== option.value))\n }\n />\n {option.count !== undefined && <span className={styles.count}>{option.count}</span>}\n </div>\n ))}\n {shown.length === 0 && <div className={styles.noMatches}>{noMatchesLabel}</div>}\n </div>\n <div className={styles.footer}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n update([]);\n onClear?.();\n }}\n >\n {clearLabel}\n </Button>\n <Button size=\"sm\" onClick={() => onApply?.(current)}>\n {applyLabel}\n </Button>\n </div>\n </div>\n );\n});\n",".bar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-8);\n}\n","import { forwardRef, type HTMLAttributes, type MouseEventHandler } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Button } from '../Button';\nimport styles from './FilterBar.module.css';\n\nexport interface FilterBarProps extends HTMLAttributes<HTMLDivElement> {\n /** Called when Clear all is pressed. Without it, no Clear all button is shown. */\n onClearAll?: MouseEventHandler<HTMLButtonElement>;\n /** Text of the Clear all button. */\n clearAllLabel?: string;\n}\n\n/** A row of FilterChip children, followed by Clear all. */\nexport const FilterBar = forwardRef<HTMLDivElement, FilterBarProps>(function FilterBar(\n { onClearAll, clearAllLabel = 'Clear all', className, children, role = 'group', 'aria-label': ariaLabel = 'Applied filters', ...props },\n ref,\n) {\n return (\n <div ref={ref} role={role} aria-label={ariaLabel} className={cx(styles.bar, className)} {...props}>\n {children}\n {onClearAll && (\n <Button variant=\"ghost\" size=\"sm\" onClick={onClearAll}>\n {clearAllLabel}\n </Button>\n )}\n </div>\n );\n});\n",".pagination {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-16);\n}\n\n.summary {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.controls {\n display: flex;\n align-items: center;\n gap: var(--space-2);\n margin-left: auto;\n}\n\n.page {\n box-sizing: border-box;\n min-width: 28px;\n height: 28px;\n padding: var(--space-0) var(--space-6);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--color-text-secondary);\n font: var(--font-label-s);\n cursor: pointer;\n}\n\n.page:hover {\n background: var(--color-bg-hover);\n color: var(--color-text-primary);\n}\n\n.page:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.current,\n.current:hover {\n border-color: var(--color-border-default);\n background: var(--color-bg-subtle);\n color: var(--color-text-primary);\n}\n\n.gap {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n color: var(--color-icon-secondary);\n}\n","import { forwardRef, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport styles from './Pagination.module.css';\n\nexport interface PaginationProps extends HTMLAttributes<HTMLElement> {\n /** The one-based current page, when controlled. */\n page?: number;\n /** The first one-based page, when uncontrolled. */\n defaultPage?: number;\n /** How many pages there are. */\n pageCount: number;\n /** Called with the one-based page the user chooses. */\n onPageChange?: (page: number) => void;\n /** Text at the left, such as \"Showing 1–5 of 42\". */\n summary?: ReactNode;\n /** Accessible name of the previous button. */\n previousLabel?: string;\n /** Accessible name of the next button. */\n nextLabel?: string;\n /** Accessible name of a page button, given its number. */\n pageLabel?: (page: number) => string;\n}\n\ntype PageEntry = number | 'gap-start' | 'gap-end';\n\n/** The first and last page and the neighbours of the current one, with a gap for any run of two or more pages left out. */\nfunction pageEntries(page: number, pageCount: number): PageEntry[] {\n const shown = [1, page - 1, page, page + 1, pageCount].filter((entry) => entry >= 1 && entry <= pageCount);\n const unique = [...new Set(shown)].sort((a, b) => a - b);\n const entries: PageEntry[] = [];\n unique.forEach((entry, index) => {\n const gap = entry - (unique[index - 1] ?? entry);\n if (gap === 2) entries.push(entry - 1);\n if (gap > 2) entries.push(entry <= page ? 'gap-start' : 'gap-end');\n entries.push(entry);\n });\n return entries;\n}\n\n/** Moves through a long list one page at a time. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(function Pagination(\n {\n page,\n defaultPage = 1,\n pageCount,\n onPageChange,\n summary,\n previousLabel = 'Previous page',\n nextLabel = 'Next page',\n pageLabel = (number) => `Page ${number}`,\n className,\n 'aria-label': ariaLabel = 'Pagination',\n ...props\n },\n ref,\n) {\n const [innerPage, setInnerPage] = useState(defaultPage);\n const count = Math.max(pageCount, 1);\n const current = Math.min(Math.max(page ?? innerPage, 1), count);\n\n const go = (next: number) => {\n setInnerPage(next);\n onPageChange?.(next);\n };\n\n return (\n <nav ref={ref} aria-label={ariaLabel} className={cx(styles.pagination, className)} {...props}>\n {summary && <div className={styles.summary}>{summary}</div>}\n <div className={styles.controls}>\n <IconButton\n icon=\"chevron-left\"\n label={previousLabel}\n variant=\"ghost\"\n size=\"sm\"\n disabled={current <= 1}\n onClick={() => go(current - 1)}\n />\n {pageEntries(current, count).map((entry) =>\n typeof entry === 'number' ? (\n <button\n key={entry}\n type=\"button\"\n className={cx(styles.page, entry === current && styles.current)}\n aria-label={pageLabel(entry)}\n aria-current={entry === current ? 'page' : undefined}\n onClick={() => go(entry)}\n >\n {entry}\n </button>\n ) : (\n <span key={entry} className={styles.gap} aria-hidden=\"true\">\n <Icon name=\"more\" />\n </span>\n ),\n )}\n <IconButton\n icon=\"chevron-right\"\n label={nextLabel}\n variant=\"ghost\"\n size=\"sm\"\n disabled={current >= count}\n onClick={() => go(current + 1)}\n />\n </div>\n </nav>\n );\n});\n",".skeleton {\n display: block;\n background-color: var(--color-bg-subtle);\n background-image: linear-gradient(90deg, var(--color-bg-subtle), var(--color-bg-sunken), var(--color-bg-subtle));\n background-repeat: no-repeat;\n background-size: 200% 100%;\n}\n\n.text {\n height: 1em;\n border-radius: var(--radius-sm);\n}\n\n.circle {\n border-radius: var(--radius-full);\n}\n\n.rect {\n border-radius: var(--radius-md);\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .skeleton {\n animation: shimmer 1600ms linear infinite;\n }\n}\n\n@keyframes shimmer {\n from {\n background-position: 200% 0;\n }\n\n to {\n background-position: -200% 0;\n }\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Skeleton.module.css';\n\nexport type SkeletonVariant = 'text' | 'circle' | 'rect';\n\nexport interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {\n /** Shape: `text` is one line of text, `circle` is an avatar and `rect` is any block. */\n variant?: SkeletonVariant;\n /** Width, in pixels or any CSS length. Defaults to 32 px for `circle` and the full width otherwise. */\n width?: number | string;\n /** Height, in pixels or any CSS length. Defaults to the width for `circle`, one line for `text` and 80 px for `rect`. */\n height?: number | string;\n}\n\nconst DEFAULT_WIDTH: Record<SkeletonVariant, number | string> = { text: '100%', circle: 32, rect: '100%' };\nconst DEFAULT_HEIGHT: Record<SkeletonVariant, number | string | undefined> = { text: undefined, circle: undefined, rect: 80 };\n\n/** Placeholder for content that is still loading. Hidden from assistive technology: announce loading with a Spinner or a status message. */\nexport const Skeleton = forwardRef<HTMLSpanElement, SkeletonProps>(function Skeleton(\n { variant = 'text', width, height, className, style, ...props },\n ref,\n) {\n const resolvedWidth = width ?? DEFAULT_WIDTH[variant];\n const resolvedHeight = height ?? (variant === 'circle' ? resolvedWidth : DEFAULT_HEIGHT[variant]);\n return (\n <span\n ref={ref}\n className={cx(styles.skeleton, styles[variant], className)}\n style={{ width: resolvedWidth, height: resolvedHeight, ...style }}\n aria-hidden=\"true\"\n {...props}\n />\n );\n});\n","import { createContext } from 'react';\n\nexport type TableDensity = 'default' | 'dense';\n\n/** Passes the density of a Table to its cells. */\nexport const TableDensityContext = createContext<TableDensity>('default');\n",".scroll {\n width: 100%;\n overflow-x: auto;\n}\n\n.table {\n width: 100%;\n border-collapse: collapse;\n color: var(--color-text-primary);\n font: var(--font-body-s);\n}\n","import { forwardRef, type TableHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { TableDensityContext, type TableDensity } from './TableContext';\nimport styles from './Table.module.css';\n\nexport type { TableDensity } from './TableContext';\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n /** Row height: `default` is 52 px and `dense` is 40 px. */\n density?: TableDensity;\n}\n\n/** The semantic table. Compose it with `thead`, `tbody`, TableHeaderRow, TableRow and TableCell. Give it a `caption`, `aria-label` or `aria-labelledby`. */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table({ density = 'default', className, ...props }, ref) {\n return (\n <TableDensityContext.Provider value={density}>\n <div className={styles.scroll}>\n <table ref={ref} className={cx(styles.table, className)} {...props} />\n </div>\n </TableDensityContext.Provider>\n );\n});\n",".cell {\n height: 36px;\n padding: var(--space-0) var(--space-12);\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n white-space: nowrap;\n}\n\n.left {\n text-align: left;\n}\n\n.right {\n text-align: right;\n}\n\n.center {\n text-align: center;\n}\n\n.sorted {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.button {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n padding: var(--space-0);\n background: transparent;\n border: none;\n border-radius: var(--radius-sm);\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n\n.button:hover {\n color: var(--color-text-primary);\n}\n\n.button:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import { forwardRef, type MouseEventHandler, type ThHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './TableHeaderCell.module.css';\n\nexport type TableHeaderCellSort = 'none' | 'sortable' | 'ascending' | 'descending';\nexport type TableHeaderCellAlign = 'left' | 'right' | 'center';\n\nexport interface TableHeaderCellProps extends ThHTMLAttributes<HTMLTableCellElement> {\n /** `none` is plain text. The others render a button: `sortable` is unsorted, `ascending` and `descending` show the current direction. */\n sort?: TableHeaderCellSort;\n /** Called when the sort button is pressed. */\n onSort?: MouseEventHandler<HTMLButtonElement>;\n /** Horizontal alignment. Match the cells below. */\n align?: TableHeaderCellAlign;\n /** Column width, in pixels or any CSS length. */\n width?: number | string;\n /** Keeps the text for assistive technology only, for columns such as row actions. */\n hideLabel?: boolean;\n}\n\nconst SORT_ICON: Record<Exclude<TableHeaderCellSort, 'none'>, IconName> = {\n sortable: 'chevrons-up-down',\n ascending: 'arrow-up',\n descending: 'arrow-down',\n};\n\nconst ARIA_SORT = { sortable: 'none', ascending: 'ascending', descending: 'descending' } as const;\n\n/** A column header, with `aria-sort` and a real button when the column can be sorted. */\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(function TableHeaderCell(\n { sort = 'none', onSort, align = 'left', width, hideLabel = false, className, style, children, ...props },\n ref,\n) {\n const label = hideLabel ? <span className={styles.visuallyHidden}>{children}</span> : children;\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sort === 'none' ? undefined : ARIA_SORT[sort]}\n className={cx(styles.cell, styles[align], (sort === 'ascending' || sort === 'descending') && styles.sorted, className)}\n style={width === undefined ? style : { width, ...style }}\n {...props}\n >\n {sort === 'none' ? (\n label\n ) : (\n <button type=\"button\" className={styles.button} onClick={onSort}>\n {label}\n <Icon name={SORT_ICON[sort]} />\n </button>\n )}\n </th>\n );\n});\n",".row {\n background: var(--color-bg-subtle);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableHeaderRow.module.css';\n\nexport type TableHeaderRowProps = HTMLAttributes<HTMLTableRowElement>;\n\n/** The row of column headers. Place it inside `thead`, with TableHeaderCell children. */\nexport const TableHeaderRow = forwardRef<HTMLTableRowElement, TableHeaderRowProps>(function TableHeaderRow({ className, ...props }, ref) {\n return <tr ref={ref} className={cx(styles.row, className)} {...props} />;\n});\n",".row {\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n/* data-state='hover' lets a story show the hover state without a pointer. */\n.row:hover,\n.row[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.selected,\n.selected:hover,\n.selected[data-state='hover'] {\n background: var(--color-bg-accent-subtle);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableRow.module.css';\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n /** Marks the row as chosen, with the selection tint. Pair it with a checked TableCellCheckbox, which states the selection to assistive technology. */\n selected?: boolean;\n}\n\n/** One row of data. Place it inside `tbody`, with TableCell children. It highlights on hover. */\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow({ selected = false, className, ...props }, ref) {\n return (\n <tr ref={ref} className={cx(styles.row, selected && styles.selected, className)} data-selected={selected || undefined} {...props} />\n );\n});\n",".cell {\n padding: var(--space-0) var(--space-12);\n color: var(--color-text-primary);\n font: var(--font-body-s);\n vertical-align: middle;\n}\n\n.default {\n height: 52px;\n}\n\n.dense {\n height: 40px;\n}\n\n.left {\n text-align: left;\n}\n\n.right {\n text-align: right;\n}\n\n.center {\n text-align: center;\n}\n","import { forwardRef, useContext, type TdHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { TableDensityContext } from './TableContext';\nimport styles from './TableCell.module.css';\n\nexport type TableCellAlign = 'left' | 'right' | 'center';\n\nexport interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {\n /** Horizontal alignment. Use `right` for numbers and row actions. */\n align?: TableCellAlign;\n /** Column width, in pixels or any CSS length. */\n width?: number | string;\n}\n\n/** One cell in a TableRow. Holds a cell-content part such as TableCellText, or any content. Its height follows the density of the Table. */\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = 'left', width, className, style, ...props },\n ref,\n) {\n const density = useContext(TableDensityContext);\n return (\n <td\n ref={ref}\n className={cx(styles.cell, styles[density], styles[align], className)}\n style={width === undefined ? style : { width, ...style }}\n {...props}\n />\n );\n});\n",".text {\n color: var(--color-text-primary);\n font: var(--font-body-s);\n}\n\n.mono {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableCellText.module.css';\n\nexport interface TableCellTextProps extends HTMLAttributes<HTMLSpanElement> {\n /** Uses the monospaced font in a quieter colour, for times, IDs and paths. */\n mono?: boolean;\n}\n\n/** One line of text in a table cell. */\nexport const TableCellText = forwardRef<HTMLSpanElement, TableCellTextProps>(function TableCellText(\n { mono = false, className, ...props },\n ref,\n) {\n return <span ref={ref} className={cx(styles.text, mono && styles.mono, className)} {...props} />;\n});\n",".twoLine {\n display: flex;\n flex-direction: column;\n}\n\n.primary {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.secondary {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableCellTwoLine.module.css';\n\nexport interface TableCellTwoLineProps extends HTMLAttributes<HTMLSpanElement> {\n /** The first line. */\n primary: ReactNode;\n /** The quieter second line. */\n secondary?: ReactNode;\n}\n\n/** A name with a quieter line of detail below it. */\nexport const TableCellTwoLine = forwardRef<HTMLSpanElement, TableCellTwoLineProps>(function TableCellTwoLine(\n { primary, secondary, className, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.twoLine, className)} {...props}>\n <span className={styles.primary}>{primary}</span>\n {secondary && <span className={styles.secondary}>{secondary}</span>}\n </span>\n );\n});\n","import { forwardRef } from 'react';\nimport { Status, type StatusProps } from '../Status';\n\nexport type TableCellStatusProps = StatusProps;\n\n/** The state of a row, as a dot plus text. */\nexport const TableCellStatus = forwardRef<HTMLSpanElement, TableCellStatusProps>(function TableCellStatus(props, ref) {\n return <Status ref={ref} {...props} />;\n});\n",".user {\n display: inline-flex;\n align-items: center;\n gap: var(--space-8);\n color: var(--color-text-primary);\n font: var(--font-body-s);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Avatar } from '../Avatar';\nimport styles from './TableCellUser.module.css';\n\nexport interface TableCellUserProps extends HTMLAttributes<HTMLSpanElement> {\n /** The name of the person or team. */\n name: string;\n /** Short text for the avatar, such as `DR`. */\n initials?: string;\n /** Avatar image. */\n src?: string;\n}\n\n/** A person, as a small avatar and their name. */\nexport const TableCellUser = forwardRef<HTMLSpanElement, TableCellUserProps>(function TableCellUser(\n { name, initials, src, className, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.user, className)} {...props}>\n {/* Hidden because the name is right beside it. */}\n <Avatar size=\"sm\" initials={initials} src={src} aria-hidden=\"true\" />\n {name}\n </span>\n );\n});\n",".number {\n display: block;\n color: var(--color-text-primary);\n font: var(--font-mono-m);\n text-align: right;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableCellNumber.module.css';\n\nexport interface TableCellNumberProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {\n /** The number. Numbers are grouped for the locale. A string is shown as it is, such as `No data`. */\n value: number | string;\n /** Locale used to group digits. */\n locale?: string;\n /** Options for the number format, such as a currency or a percentage. */\n format?: Intl.NumberFormatOptions;\n}\n\n/** A number in a table cell, in monospaced digits and aligned to the right so that columns of numbers line up. */\nexport const TableCellNumber = forwardRef<HTMLSpanElement, TableCellNumberProps>(function TableCellNumber(\n { value, locale = 'en-US', format, className, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.number, className)} {...props}>\n {typeof value === 'number' ? new Intl.NumberFormat(locale, format).format(value) : value}\n </span>\n );\n});\n",".actions {\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--space-4);\n}\n","import { forwardRef, type HTMLAttributes, type MouseEventHandler, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport styles from './TableCellActions.module.css';\n\nexport interface TableCellActionsProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onClick'> {\n /** Accessible name of the default button. Name the row, such as `Actions for Docs`. */\n label?: string;\n /** Called when the default button is pressed. */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n /** Replaces the default button, for example with a DropdownMenu. */\n children?: ReactNode;\n}\n\n/** The actions at the end of a row: a More button by default, or your own controls. */\nexport const TableCellActions = forwardRef<HTMLSpanElement, TableCellActionsProps>(function TableCellActions(\n { label = 'Row actions', onClick, className, children, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.actions, className)} {...props}>\n {children ?? <IconButton icon=\"more\" label={label} variant=\"ghost\" size=\"sm\" onClick={onClick} />}\n </span>\n );\n});\n","import { forwardRef } from 'react';\nimport { Checkbox, type CheckboxProps } from '../Checkbox';\n\nexport interface TableCellCheckboxProps extends Omit<CheckboxProps, 'label' | 'description' | 'aria-label'> {\n /** Accessible name. Name the row, such as `Select Docs`. */\n label: string;\n}\n\n/** The checkbox that selects a row, or in a header the whole table. Has no visible label. */\nexport const TableCellCheckbox = forwardRef<HTMLInputElement, TableCellCheckboxProps>(function TableCellCheckbox({ label, ...props }, ref) {\n return <Checkbox ref={ref} aria-label={label} {...props} />;\n});\n",".toolbar {\n display: flex;\n flex-direction: column;\n gap: var(--space-12);\n padding: var(--space-12);\n}\n\n.main {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-12);\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.controls {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n margin-left: auto;\n}\n\n.search {\n width: 240px;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableToolbar.module.css';\n\nexport interface TableToolbarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** What the table lists. */\n title?: ReactNode;\n /** The search box, normally a Search. */\n search?: ReactNode;\n /** The action that opens the filters, normally a Button. */\n filterAction?: ReactNode;\n /** A second row below the title, such as a FilterBar. */\n children?: ReactNode;\n}\n\n/** The bar above a table, with its title, search and filter action. */\nexport const TableToolbar = forwardRef<HTMLDivElement, TableToolbarProps>(function TableToolbar(\n { title, search, filterAction, className, children, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.toolbar, className)} {...props}>\n <div className={styles.main}>\n {title && <div className={styles.title}>{title}</div>}\n {(search || filterAction) && (\n <div className={styles.controls}>\n {search && <div className={styles.search}>{search}</div>}\n {filterAction}\n </div>\n )}\n </div>\n {children}\n </div>\n );\n});\n",".footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-12);\n min-height: 44px;\n padding: var(--space-8) var(--space-12);\n}\n\n.count {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.pagination {\n margin-left: auto;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TableFooter.module.css';\n\nexport interface TableFooterProps extends HTMLAttributes<HTMLDivElement> {\n /** How many rows are showing, such as `Showing 1–5 of 8`. Announced politely when it changes. */\n count?: ReactNode;\n /** The page controls, normally a Pagination. */\n pagination?: ReactNode;\n}\n\n/** The bar below a table, with the row count and page controls. */\nexport const TableFooter = forwardRef<HTMLDivElement, TableFooterProps>(function TableFooter(\n { count, pagination, className, children, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.footer, className)} {...props}>\n <div className={styles.count} aria-live=\"polite\">\n {count}\n </div>\n {children}\n {pagination && <div className={styles.pagination}>{pagination}</div>}\n </div>\n );\n});\n","import { useCallback, useState } from 'react';\n\n/** State that a caller may own. When `controlled` is undefined the hook keeps the value itself. */\nexport function useControllable<T>(controlled: T | undefined, initial: T, onChange?: (value: T) => void): [T, (value: T) => void] {\n const [inner, setInner] = useState(initial);\n const set = useCallback(\n (value: T) => {\n setInner(value);\n onChange?.(value);\n },\n [onChange],\n );\n return [controlled === undefined ? inner : controlled, set];\n}\n",".dataTable {\n width: 100%;\n overflow: hidden;\n}\n\n.picker {\n display: contents;\n}\n\n.message {\n padding: var(--space-32) var(--space-16);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import {\n cloneElement,\n forwardRef,\n useCallback,\n useId,\n useMemo,\n useRef,\n useState,\n type ForwardedRef,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport { Button } from '../Button';\nimport { Card } from '../Card';\nimport { getFocusableElements } from '../Dialog';\nimport { DropdownMenu, DropdownMenuItem } from '../DropdownMenu';\nimport { EmptyState } from '../EmptyState';\nimport { FilterBar, FilterChip, FilterMenu, type FilterOption } from '../Filters';\nimport { usePopup } from '../Menu';\nimport { Pagination } from '../Pagination';\nimport { Search } from '../Search';\nimport { Skeleton } from '../Skeleton';\nimport {\n Table,\n TableCell,\n TableCellCheckbox,\n TableFooter,\n TableHeaderCell,\n TableHeaderRow,\n TableRow,\n TableToolbar,\n type TableCellAlign,\n type TableDensity,\n type TableHeaderCellSort,\n} from '../Table';\nimport { useControllable } from './useControllable';\nimport styles from './DataTable.module.css';\n\nexport type DataTableSortDirection = 'ascending' | 'descending';\n\nexport interface DataTableSort {\n /** The `id` of the sorted column. */\n columnId: string;\n /** The direction. */\n direction: DataTableSortDirection;\n}\n\n/** The chosen values of each filter, by filter `id`. */\nexport type DataTableFilterValues = Record<string, string[]>;\n\nexport interface DataTableColumn<T> {\n /** Unique within the table. */\n id: string;\n /** The column heading. */\n header: ReactNode;\n /** Renders the content of a cell. */\n cell: (row: T) => ReactNode;\n /** Lets the person sort by this column. Requires `sortAccessor`. */\n sortable?: boolean;\n /** The value to sort by. Numbers sort numerically, and strings by natural order. It also feeds the default search. */\n sortAccessor?: (row: T) => string | number;\n /** Column width, in pixels or any CSS length. */\n width?: number | string;\n /** Horizontal alignment of the heading and cells. */\n align?: TableCellAlign;\n /** Keeps the heading for assistive technology only, for a column such as row actions. */\n hideHeader?: boolean;\n}\n\nexport interface DataTableFilter<T> {\n /** Unique within the table. */\n id: string;\n /** The name of the filter, such as `Status`. */\n label: string;\n /** The value of a row for this filter. */\n accessor: (row: T) => string;\n /** The options to offer. Defaults to the values found in `rows`. Counts default to the matching rows. */\n options?: FilterOption[];\n}\n\nexport interface DataTableProps<T> extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children'> {\n /** The columns, in order. */\n columns: DataTableColumn<T>[];\n /** All of the rows. Sorting, filtering, search and pagination happen here, on the client. */\n rows: T[];\n /** A stable, unique ID for a row. */\n getRowId: (row: T) => string;\n /** Text naming the row, used for the accessible name of its checkbox. Defaults to its ID. */\n getRowLabel?: (row: T) => string;\n /** The heading in the toolbar, which also names the table. */\n title?: ReactNode;\n /** What the rows are, in the plural, such as `projects`. Used in default messages. */\n itemLabel?: string;\n /** Row height. */\n density?: TableDensity;\n /** The sort, when controlled. Use `null` for no sort. */\n sort?: DataTableSort | null;\n /** The first sort, when uncontrolled. */\n defaultSort?: DataTableSort | null;\n /** Called when the sort changes. */\n onSortChange?: (sort: DataTableSort | null) => void;\n /** The filters on offer. */\n filters?: DataTableFilter<T>[];\n /** The chosen filter values, when controlled. */\n filterValues?: DataTableFilterValues;\n /** The first chosen filter values, when uncontrolled. */\n defaultFilterValues?: DataTableFilterValues;\n /** Called when the chosen filter values change. */\n onFilterValuesChange?: (values: DataTableFilterValues) => void;\n /** Shows the search box. */\n searchable?: boolean;\n /** The search text, when controlled. */\n search?: string;\n /** The first search text, when uncontrolled. */\n defaultSearch?: string;\n /** Called when the search text changes. */\n onSearchChange?: (search: string) => void;\n /** The text a row is searched by. Defaults to the sort values of its columns. */\n getSearchText?: (row: T) => string;\n /** Placeholder and accessible name of the search box. Defaults to one built from `itemLabel`. */\n searchPlaceholder?: string;\n /** The one-based page, when controlled. */\n page?: number;\n /** The first one-based page, when uncontrolled. */\n defaultPage?: number;\n /** Called when the page changes. */\n onPageChange?: (page: number) => void;\n /** How many rows a page holds. */\n pageSize?: number;\n /** Adds a checkbox to each row. The header checkbox selects every row on the current page. */\n selectable?: boolean;\n /** The IDs of the selected rows, when controlled. */\n selectedRowIds?: string[];\n /** The IDs of the first selected rows, when uncontrolled. */\n defaultSelectedRowIds?: string[];\n /** Called when the selection changes. */\n onSelectedRowIdsChange?: (ids: string[]) => void;\n /** Shows placeholder rows while the data loads. */\n loading?: boolean;\n /** Title of the empty state, shown when `rows` is empty. */\n emptyTitle?: ReactNode;\n /** Description of the empty state. */\n emptyDescription?: ReactNode;\n /** The next step in the empty state, normally a Button. */\n emptyAction?: ReactNode;\n /** Title shown when filters and search match nothing. */\n noResultsTitle?: ReactNode;\n /** Description shown when filters and search match nothing. */\n noResultsDescription?: ReactNode;\n}\n\nfunction compareValues(a: string | number, b: string | number) {\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n return String(a).localeCompare(String(b), undefined, { numeric: true, sensitivity: 'base' });\n}\n\nfunction nextSort(current: DataTableSort | null, columnId: string): DataTableSort | null {\n if (current?.columnId !== columnId) return { columnId, direction: 'ascending' };\n return current.direction === 'ascending' ? { columnId, direction: 'descending' } : null;\n}\n\nfunction optionsFor<T>(filter: DataTableFilter<T>, rows: T[]): FilterOption[] {\n const counts = new Map<string, number>();\n rows.forEach((row) => {\n const value = filter.accessor(row);\n counts.set(value, (counts.get(value) ?? 0) + 1);\n });\n const options: FilterOption[] = filter.options ?? [...counts.keys()].map((value) => ({ value, label: value }));\n return options.map((option) => ({ ...option, count: option.count ?? counts.get(option.value) ?? 0 }));\n}\n\ninterface FilterPickerProps<T> {\n /** The filters the trigger can open. */\n filters: DataTableFilter<T>[];\n /** Called with the chosen filter and the button to anchor its menu to. */\n onPick: (filterId: string, anchor: HTMLElement) => void;\n /** Called when the trigger is pressed, before anything opens. */\n onPress: () => void;\n /** The button. */\n trigger: ReactElement<{ onClick?: (event: MouseEvent<HTMLElement>) => void }>;\n}\n\n/** A trigger that opens the only filter directly, or first asks which filter when there are several. */\nfunction FilterPicker<T>({ filters, onPick, onPress, trigger }: FilterPickerProps<T>) {\n const wrapper = useRef<HTMLSpanElement>(null);\n return (\n <span ref={wrapper} className={styles.picker}>\n {filters.length === 1 ? (\n cloneElement(trigger, {\n onClick: (event) => {\n onPress();\n onPick(filters[0].id, event.currentTarget);\n },\n })\n ) : (\n <DropdownMenu trigger={cloneElement(trigger, { onClick: onPress })}>\n {filters.map((filter) => (\n <DropdownMenuItem key={filter.id} onSelect={() => onPick(filter.id, wrapper.current?.querySelector('button') as HTMLElement)}>\n {filter.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenu>\n )}\n </span>\n );\n}\n\nfunction DataTableInner<T>(\n {\n columns,\n rows,\n getRowId,\n getRowLabel,\n title,\n itemLabel = 'rows',\n density,\n sort: sortProp,\n defaultSort = null,\n onSortChange,\n filters = [],\n filterValues: filterValuesProp,\n defaultFilterValues = {},\n onFilterValuesChange,\n searchable = true,\n search: searchProp,\n defaultSearch = '',\n onSearchChange,\n getSearchText,\n searchPlaceholder,\n page: pageProp,\n defaultPage = 1,\n onPageChange,\n pageSize = 5,\n selectable = false,\n selectedRowIds: selectedProp,\n defaultSelectedRowIds = [],\n onSelectedRowIdsChange,\n loading = false,\n emptyTitle,\n emptyDescription,\n emptyAction,\n noResultsTitle,\n noResultsDescription = 'Try removing a filter or changing your search.',\n className,\n ...props\n }: DataTableProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const [sort, setSort] = useControllable(sortProp, defaultSort, onSortChange);\n const [filterValues, setFilterValues] = useControllable(filterValuesProp, defaultFilterValues, onFilterValuesChange);\n const [search, setSearch] = useControllable(searchProp, defaultSearch, onSearchChange);\n const [page, setPage] = useControllable(pageProp, defaultPage, onPageChange);\n const [selected, setSelected] = useControllable(selectedProp, defaultSelectedRowIds, onSelectedRowIdsChange);\n\n const titleId = useId();\n const searchRef = useRef<HTMLInputElement>(null);\n const filterButtonWrapper = useRef<HTMLSpanElement>(null);\n const [openFilterId, setOpenFilterId] = useState<string | null>(null);\n\n const { triggerRef, popupRef, popupStyle } = usePopup<HTMLElement>({\n open: openFilterId !== null,\n onClose: (reason) => closePopup(reason === 'escape'),\n placement: 'bottom-end',\n });\n\n function closePopup(returnFocus: boolean) {\n setOpenFilterId(null);\n if (!returnFocus) return;\n // The Add filter chip can be gone by now, so fall back to the Filter button.\n const anchor = triggerRef.current?.isConnected ? triggerRef.current : filterButtonWrapper.current?.querySelector('button');\n anchor?.focus();\n }\n\n const openFilter = (filterId: string, anchor: HTMLElement) => {\n triggerRef.current = anchor;\n setOpenFilterId(filterId);\n };\n\n // Moves focus in once the popup exists. A ref callback runs after the menu that chose this filter has handed focus back.\n const focusPopup = useCallback(\n (node: HTMLDivElement | null) => {\n popupRef.current = node;\n if (node) requestAnimationFrame(() => getFocusableElements(node)[0]?.focus({ preventScroll: true }));\n },\n [popupRef],\n );\n\n const onPopupKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Tab') return;\n const focusable = getFocusableElements(event.currentTarget);\n const edge = event.shiftKey ? focusable[0] : focusable[focusable.length - 1];\n if (document.activeElement === edge) {\n event.preventDefault();\n closePopup(true);\n }\n };\n\n const hasFilters = Object.values(filterValues).some((values) => values.length > 0);\n const needle = search.trim().toLowerCase();\n const isFiltered = hasFilters || needle !== '';\n\n const visibleRows = useMemo(() => {\n const searchText =\n getSearchText ??\n ((row: T) =>\n columns\n .map((column) => column.sortAccessor?.(row))\n .filter((value) => value !== undefined)\n .join(' '));\n const matched = rows.filter(\n (row) =>\n filters.every((filter) => {\n const values = filterValues[filter.id] ?? [];\n return values.length === 0 || values.includes(filter.accessor(row));\n }) &&\n (needle === '' || searchText(row).toLowerCase().includes(needle)),\n );\n const column = sort && columns.find((candidate) => candidate.id === sort.columnId);\n const accessor = column?.sortAccessor;\n if (!sort || !accessor) return matched;\n const factor = sort.direction === 'ascending' ? 1 : -1;\n return [...matched].sort((a, b) => factor * compareValues(accessor(a), accessor(b)));\n }, [columns, filterValues, filters, getSearchText, needle, rows, sort]);\n\n const pageCount = Math.max(1, Math.ceil(visibleRows.length / pageSize));\n const currentPage = Math.min(Math.max(1, page), pageCount);\n const firstIndex = (currentPage - 1) * pageSize;\n const pageRows = visibleRows.slice(firstIndex, firstIndex + pageSize);\n const pageIds = pageRows.map(getRowId);\n const selectedOnPage = pageIds.filter((id) => selected.includes(id)).length;\n\n const changeFilterValues = (values: DataTableFilterValues) => {\n setFilterValues(values);\n setPage(1);\n };\n\n const applyFilter = (filterId: string, values: string[]) => {\n const next = { ...filterValues };\n if (values.length > 0) next[filterId] = values;\n else delete next[filterId];\n changeFilterValues(next);\n };\n\n const focusFilterButton = () => filterButtonWrapper.current?.querySelector('button')?.focus();\n\n const clearFilters = () => {\n changeFilterValues({});\n setSearch('');\n (searchRef.current ?? filterButtonWrapper.current?.querySelector('button'))?.focus();\n };\n\n const toggleRow = (id: string, checked: boolean) => setSelected(checked ? [...selected, id] : selected.filter((item) => item !== id));\n\n const toggleAll = (checked: boolean) =>\n setSelected(checked ? [...new Set([...selected, ...pageIds])] : selected.filter((id) => !pageIds.includes(id)));\n\n const headerSort = (column: DataTableColumn<T>): TableHeaderCellSort => {\n if (!column.sortable) return 'none';\n return sort?.columnId === column.id ? sort.direction : 'sortable';\n };\n\n const activeFilters = filters.filter((filter) => (filterValues[filter.id] ?? []).length > 0);\n const inactiveFilters = filters.filter((filter) => !activeFilters.includes(filter));\n const openedFilter = filters.find((filter) => filter.id === openFilterId);\n const columnCount = columns.length + (selectable ? 1 : 0);\n const isEmpty = !loading && rows.length === 0;\n const hasNoResults = !loading && rows.length > 0 && visibleRows.length === 0;\n\n const countText = () => {\n if (loading) return `Loading ${itemLabel}…`;\n if (visibleRows.length === 0) return `Showing 0 of ${rows.length}`;\n const range = `Showing ${firstIndex + 1}–${firstIndex + pageRows.length} of ${visibleRows.length}`;\n const filteredFrom = isFiltered ? `, filtered from ${rows.length}` : '';\n const selectedText = selected.length > 0 ? ` · ${selected.length} selected` : '';\n return `${range}${filteredFrom}${selectedText}`;\n };\n\n return (\n <Card ref={ref} padding=\"none\" className={cx(styles.dataTable, className)} {...props}>\n <TableToolbar\n title={title && <span id={titleId}>{title}</span>}\n search={\n searchable && (\n <Search\n ref={searchRef}\n value={search}\n placeholder={searchPlaceholder ?? `Search ${itemLabel}…`}\n aria-label={searchPlaceholder ?? `Search ${itemLabel}`}\n onChange={(event) => {\n setSearch(event.target.value);\n setPage(1);\n }}\n />\n )\n }\n filterAction={\n filters.length > 0 && (\n <span ref={filterButtonWrapper} className={styles.picker}>\n <FilterPicker\n filters={filters}\n onPick={(filterId, anchor) => {\n if (filters.length === 1 && openFilterId === filterId) closePopup(false);\n else openFilter(filterId, anchor);\n }}\n onPress={() => {\n if (filters.length > 1) closePopup(false);\n }}\n trigger={\n <Button variant={activeFilters.length > 0 ? 'inverse' : 'secondary'} leadingIcon=\"filter\">\n {activeFilters.length > 0 ? `Filter · ${activeFilters.length}` : 'Filter'}\n </Button>\n }\n />\n </span>\n )\n }\n >\n {activeFilters.length > 0 && (\n <FilterBar\n onClearAll={() => {\n changeFilterValues({});\n focusFilterButton();\n }}\n >\n {activeFilters.map((filter) => {\n const options = optionsFor(filter, rows);\n const labels = filterValues[filter.id].map((value) => options.find((option) => option.value === value)?.label ?? value);\n return (\n <FilterChip\n key={filter.id}\n field={filter.label}\n value={labels.join(', ')}\n removeLabel={`Remove ${filter.label} filter`}\n onRemove={() => {\n applyFilter(filter.id, []);\n focusFilterButton();\n }}\n />\n );\n })}\n {inactiveFilters.length > 0 && (\n <FilterPicker\n filters={inactiveFilters}\n onPick={openFilter}\n onPress={() => closePopup(false)}\n trigger={<FilterChip state=\"add\" />}\n />\n )}\n </FilterBar>\n )}\n </TableToolbar>\n\n <Table\n density={density}\n aria-labelledby={title ? titleId : undefined}\n aria-label={title ? undefined : itemLabel}\n aria-busy={loading || undefined}\n >\n <thead>\n <TableHeaderRow>\n {selectable && (\n <TableHeaderCell width={40}>\n {!loading && !isEmpty && !hasNoResults ? (\n <TableCellCheckbox\n label=\"Select all rows on this page\"\n checked={pageIds.length > 0 && selectedOnPage === pageIds.length}\n indeterminate={selectedOnPage > 0 && selectedOnPage < pageIds.length}\n onChange={(event) => toggleAll(event.target.checked)}\n />\n ) : (\n <span className={styles.visuallyHidden}>Select</span>\n )}\n </TableHeaderCell>\n )}\n {columns.map((column) => (\n <TableHeaderCell\n key={column.id}\n width={column.width}\n align={column.align}\n hideLabel={column.hideHeader}\n sort={headerSort(column)}\n onSort={() => {\n setSort(nextSort(sort, column.id));\n setPage(1);\n }}\n >\n {column.header}\n </TableHeaderCell>\n ))}\n </TableHeaderRow>\n </thead>\n <tbody>\n {loading &&\n Array.from({ length: pageSize }, (_, rowIndex) => (\n <TableRow key={rowIndex}>\n {selectable && (\n <TableCell>\n <Skeleton variant=\"rect\" width={16} height={16} />\n </TableCell>\n )}\n {columns.map((column) => (\n <TableCell key={column.id} align={column.align}>\n <Skeleton variant=\"text\" width=\"70%\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n {isEmpty && (\n <tr>\n <td colSpan={columnCount} className={styles.message}>\n <EmptyState icon=\"folder\" title={emptyTitle ?? `No ${itemLabel} yet`} description={emptyDescription} action={emptyAction} />\n </td>\n </tr>\n )}\n {hasNoResults && (\n <tr>\n <td colSpan={columnCount} className={styles.message}>\n <EmptyState\n icon=\"search\"\n title={noResultsTitle ?? `No ${itemLabel} match these filters`}\n description={noResultsDescription}\n action={\n <Button variant=\"secondary\" size=\"sm\" onClick={clearFilters}>\n Clear filters\n </Button>\n }\n />\n </td>\n </tr>\n )}\n {!loading &&\n pageRows.map((row) => {\n const id = getRowId(row);\n const isSelected = selected.includes(id);\n return (\n <TableRow key={id} selected={isSelected}>\n {selectable && (\n <TableCell>\n <TableCellCheckbox\n label={`Select ${getRowLabel?.(row) ?? id}`}\n checked={isSelected}\n onChange={(event) => toggleRow(id, event.target.checked)}\n />\n </TableCell>\n )}\n {columns.map((column) => (\n <TableCell key={column.id} align={column.align}>\n {column.cell(row)}\n </TableCell>\n ))}\n </TableRow>\n );\n })}\n </tbody>\n </Table>\n\n <TableFooter\n count={countText()}\n pagination={!loading && pageCount > 1 && <Pagination page={currentPage} pageCount={pageCount} onPageChange={setPage} />}\n />\n\n {openedFilter &&\n createPortal(\n <div key={openedFilter.id} ref={focusPopup} style={popupStyle} onKeyDown={onPopupKeyDown} role=\"presentation\">\n <FilterMenu\n role=\"dialog\"\n title={openedFilter.label}\n options={optionsFor(openedFilter, rows)}\n defaultValue={filterValues[openedFilter.id] ?? []}\n searchPlaceholder={`Find a ${openedFilter.label.toLowerCase()}…`}\n onClear={() => applyFilter(openedFilter.id, [])}\n onApply={(values) => {\n applyFilter(openedFilter.id, values);\n closePopup(true);\n }}\n />\n </div>,\n document.body,\n )}\n </Card>\n );\n}\n\n/**\n * A complete table: sort, search, column filters, row selection, pagination, and loading, empty and no-results states.\n * Everything runs on the client. Sort, filters, search and page each work controlled or uncontrolled.\n */\nexport const DataTable = forwardRef(DataTableInner) as <T>(props: DataTableProps<T> & RefAttributes<HTMLElement>) => ReactElement;\n","import { Icon } from '../../icons';\nimport control from './control.module.css';\n\n/** The \"Locked\" tag and lock icon shared by the locked state of the form controls. */\nexport function LockedTag() {\n return (\n <span className={control.lockedTag}>\n Locked\n <Icon name=\"lock\" />\n </span>\n );\n}\n","import { forwardRef, type InputHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from './control.module.css';\nimport { LockedTag } from './LockedTagInternal';\n\nexport interface InputProps extends InputHTMLAttributes<HTMLInputElement> {\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag, for values set by staff. */\n locked?: boolean;\n /** Icon before the value. */\n leadingIcon?: IconName;\n /** Icon after the value. */\n trailingIcon?: IconName;\n}\n\n/** Single-line text control without a label. Use Field for a labelled input in a form. */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { invalid, locked, disabled, required, leadingIcon, trailingIcon, id, readOnly, className, 'aria-describedby': describedBy, ...props },\n ref,\n) {\n const field = useFieldControl({ id, invalid, disabled, locked, required, 'aria-describedby': describedBy });\n return (\n <div\n className={cx(\n control.control,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n >\n {leadingIcon && <Icon name={leadingIcon} className={control.icon} />}\n <input\n ref={ref}\n id={field.id}\n className={control.field}\n disabled={field.disabled}\n required={field.required}\n readOnly={field.locked || readOnly}\n aria-invalid={field.invalid || undefined}\n aria-describedby={field.describedBy}\n {...props}\n />\n {trailingIcon && <Icon name={trailingIcon} className={control.icon} />}\n {field.locked && <LockedTag />}\n </div>\n );\n});\n","import { forwardRef } from 'react';\nimport { Input, type InputProps } from '../Input';\n\nexport type DateFieldProps = Omit<InputProps, 'type' | 'leadingIcon' | 'trailingIcon'>;\n\n/** A native date input styled like Input. Values use the native `YYYY-MM-DD` format, and `min` and `max` apply. */\nexport const DateField = forwardRef<HTMLInputElement, DateFieldProps>(function DateField(props, ref) {\n return <Input ref={ref} type=\"date\" {...props} />;\n});\n",".trigger {\n position: relative;\n}\n\n/* The same open state as a Select, whose aria-expanded sits on the box itself. */\n.trigger.open,\n.trigger.open:hover {\n border-color: var(--color-border-focus);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: calc(var(--stroke-hairline) * -1);\n}\n\n.button {\n text-align: left;\n cursor: pointer;\n}\n\n/* Makes the whole box the click target. */\n.button::after {\n position: absolute;\n inset: 0;\n content: '';\n}\n\n.button[aria-readonly='true'] {\n cursor: default;\n}\n\n.value {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.placeholder {\n color: var(--color-text-tertiary);\n}\n\n/* Above the stretched button. */\n.clear {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n padding: 0;\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--color-icon-secondary);\n cursor: pointer;\n}\n\n.clear:hover {\n color: var(--color-icon-primary);\n}\n\n.clear:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n","import { forwardRef, type ButtonHTMLAttributes, type Ref } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport { LockedTag } from '../Input/LockedTagInternal';\nimport styles from './DateTriggerInternal.module.css';\n\nexport interface DateTriggerInternalProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'children'> {\n /** The formatted value, or null when there is none. */\n text: string | null;\n /** Text shown when there is no value. */\n placeholder?: string;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** Whether the popup is showing. */\n open?: boolean;\n /** Shows a clear button while there is a value. */\n clearable?: boolean;\n /** Called when the clear button is used. */\n onClear?: () => void;\n /** Accessible name of the clear button. */\n clearLabel?: string;\n /** The id of the popup, while it shows. */\n popupId?: string;\n /** Receives the outer box, which the popup lines up with. */\n anchorRef?: Ref<HTMLDivElement>;\n}\n\n/**\n * The box of DatePicker and DateRangeTrigger. It looks like the Select control, and like Select it is a select-only\n * combobox. The clear button can't sit inside a button, so the combobox button is stretched over the box instead.\n */\nexport const DateTriggerInternal = forwardRef<HTMLButtonElement, DateTriggerInternalProps>(function DateTriggerInternal(\n {\n text,\n placeholder,\n invalid,\n disabled,\n locked,\n required,\n open = false,\n clearable,\n onClear,\n clearLabel = 'Clear date',\n popupId,\n anchorRef,\n id,\n className,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({\n id,\n invalid,\n disabled,\n locked,\n required,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n });\n const showClear = clearable && text !== null && !field.disabled && !field.locked;\n return (\n <div\n ref={anchorRef}\n className={cx(\n control.control,\n styles.trigger,\n open && styles.open,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n >\n <button\n ref={ref}\n id={field.id}\n type=\"button\"\n role=\"combobox\"\n disabled={field.disabled}\n aria-labelledby={field.labelledBy}\n aria-describedby={field.describedBy}\n aria-invalid={field.invalid || undefined}\n aria-required={field.required || undefined}\n aria-readonly={field.locked || undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? popupId : undefined}\n className={cx(control.field, styles.button)}\n {...props}\n >\n <span className={cx(styles.value, text === null && !field.disabled && !field.locked && styles.placeholder)}>\n {text ?? placeholder}\n </span>\n </button>\n {showClear && (\n <button type=\"button\" className={styles.clear} aria-label={clearLabel} onClick={onClear}>\n <Icon name=\"x\" />\n </button>\n )}\n {field.locked ? <LockedTag /> : <Icon name=\"calendar\" className={control.icon} />}\n </div>\n );\n});\n","import { useCallback, useImperativeHandle, useRef, type ForwardedRef, type KeyboardEvent } from 'react';\nimport { getFocusableElements } from '../Dialog';\nimport { usePopup } from '../Menu';\n\nexport interface UseDatePopupOptions {\n /** Whether the popup is rendered. */\n open: boolean;\n /** Sets `open` to false and drops any unfinished selection. It doesn't move focus. */\n onDismiss: () => void;\n /** The ref given to the picker, which receives the combobox button. */\n forwardedRef: ForwardedRef<HTMLButtonElement>;\n}\n\n/**\n * The popup behaviour shared by DatePicker and DateRangePicker. It positions against the trigger box and dismisses on\n * Escape or an outside press. Like the WAI-ARIA date picker dialog it keeps Tab inside, and focus returns to the trigger\n * on the way out. A press on something else focusable still moves focus there, because the browser acts after this does.\n */\nexport function useDatePopup({ open, onDismiss, forwardedRef }: UseDatePopupOptions) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n useImperativeHandle(forwardedRef, () => buttonRef.current as HTMLButtonElement);\n\n const focusTrigger = useCallback(() => buttonRef.current?.focus(), []);\n const onClose = useCallback(() => {\n onDismiss();\n focusTrigger();\n }, [focusTrigger, onDismiss]);\n const { triggerRef, popupRef, popupStyle } = usePopup<HTMLDivElement>({ open, onClose });\n\n const onPopupKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Tab' || !popupRef.current) return;\n const focusable = getFocusableElements(popupRef.current);\n if (focusable.length === 0) return;\n const edge = event.shiftKey ? focusable[0] : focusable[focusable.length - 1];\n if (document.activeElement === edge) {\n event.preventDefault();\n (event.shiftKey ? focusable[focusable.length - 1] : focusable[0]).focus();\n }\n };\n\n return { buttonRef, triggerRef, popupRef, popupStyle, focusTrigger, onPopupKeyDown };\n}\n","/* Doubled to win over the fixed width of Menu, whichever stylesheet loads last. */\n.popup.popup {\n width: max-content;\n max-width: calc(100vw - var(--space-16));\n padding: var(--space-12);\n}\n","import { forwardRef, useCallback, useId, useState, type ButtonHTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Calendar } from '../Calendar';\nimport { formatShortDate, startOfDay, toISODay, type WeekStart } from '../Calendar/dateUtils';\nimport { DateTriggerInternal } from '../Calendar/DateTriggerInternal';\nimport { useDatePopup } from '../Calendar/useDatePopup';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport { Menu } from '../Menu';\nimport styles from './DatePicker.module.css';\n\nexport interface DatePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children'> {\n /** The chosen day, when controlled. Use a Date at local midnight, or null for none. */\n value?: Date | null;\n /** The first chosen day, when uncontrolled. */\n defaultValue?: Date | null;\n /** Called with the day, at local midnight, when one is chosen. Called with null when it is cleared. */\n onChange?: (date: Date | null) => void;\n /** Text shown when no day is chosen. */\n placeholder?: string;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag. It can be focused but not opened. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** The earliest day that can be chosen. */\n min?: Date;\n /** The latest day that can be chosen. */\n max?: Date;\n /** Returns true for a day that can't be chosen. */\n isDateDisabled?: (date: Date) => boolean;\n /** BCP 47 locale for names and numbers. Leave out to use the browser's locale. */\n locale?: string;\n /** The first column of the grid: 0 is Sunday and 1 is Monday. */\n weekStartsOn?: WeekStart;\n /** The day marked as today. Defaults to now. Pass it for repeatable tests. */\n today?: Date;\n /** Shows a clear button while a day is chosen. */\n clearable?: boolean;\n /** Accessible name of the clear button. */\n clearLabel?: string;\n /** Accessible name of the popup. */\n popupLabel?: string;\n /** Accessible name of the previous month button. */\n previousMonthLabel?: string;\n /** Accessible name of the next month button. */\n nextMonthLabel?: string;\n}\n\n/** A single date: a trigger shaped like Select, and a popup calendar that closes once a day is picked. */\nexport const DatePicker = forwardRef<HTMLButtonElement, DatePickerProps>(function DatePicker(\n {\n value,\n defaultValue,\n onChange,\n placeholder = 'Select a date',\n min,\n max,\n isDateDisabled,\n locale,\n weekStartsOn,\n today,\n clearable,\n clearLabel = 'Clear date',\n popupLabel = 'Choose a date',\n previousMonthLabel,\n nextMonthLabel,\n name,\n invalid,\n disabled,\n locked,\n required,\n className,\n onClick,\n onKeyDown,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({ disabled, locked });\n const [open, setOpen] = useState(false);\n const [innerValue, setInnerValue] = useState<Date | null>(defaultValue ?? null);\n const current = value !== undefined ? value : innerValue;\n const popupId = `${useId()}-popup`;\n\n const dismiss = useCallback(() => setOpen(false), []);\n const { buttonRef, triggerRef, popupRef, popupStyle, focusTrigger, onPopupKeyDown } = useDatePopup({\n open,\n onDismiss: dismiss,\n forwardedRef: ref,\n });\n\n const commit = (next: Date | null) => {\n if (value === undefined) setInnerValue(next);\n onChange?.(next);\n setOpen(false);\n focusTrigger();\n };\n\n const onTriggerClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || field.locked) return;\n setOpen(!open);\n };\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || field.locked || open) return;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n return (\n <>\n <DateTriggerInternal\n ref={buttonRef}\n anchorRef={triggerRef}\n text={current ? formatShortDate(current, locale) : null}\n placeholder={placeholder}\n invalid={invalid}\n disabled={disabled}\n locked={locked}\n required={required}\n open={open}\n popupId={popupId}\n clearable={clearable}\n clearLabel={clearLabel}\n onClear={() => commit(null)}\n className={className}\n onClick={onTriggerClick}\n onKeyDown={onTriggerKeyDown}\n {...props}\n />\n {name && <input type=\"hidden\" name={name} value={current ? toISODay(current) : ''} disabled={field.disabled} />}\n {open &&\n createPortal(\n <Menu\n ref={popupRef}\n id={popupId}\n role=\"dialog\"\n aria-label={popupLabel}\n data-focus-scope=\"\"\n style={popupStyle}\n className={styles.popup}\n onKeyDown={onPopupKeyDown}\n >\n <Calendar\n autoFocusDay\n value={current ? startOfDay(current) : null}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n locale={locale}\n weekStartsOn={weekStartsOn}\n today={today}\n previousMonthLabel={previousMonthLabel}\n nextMonthLabel={nextMonthLabel}\n onChange={commit}\n />\n </Menu>,\n document.body,\n )}\n </>\n );\n});\n","/* Rows match MenuItem, so the list reads as the same kind of popup content. */\n.presets {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n}\n\n.preset {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n width: 100%;\n padding: var(--space-6) var(--space-8);\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n font: var(--font-body-s);\n color: var(--color-text-primary);\n text-align: left;\n cursor: pointer;\n}\n\n.preset:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.preset:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.preset:disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.check {\n flex-shrink: 0;\n color: var(--color-icon-accent);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { isSameDay, sortRange, type DateRange } from '../Calendar/dateUtils';\nimport styles from './DateRangePresets.module.css';\n\nexport interface DateRangePreset {\n /** The text shown for the preset. */\n label: string;\n /** Works out the range, relative to the day given as today. */\n getRange: (today: Date) => DateRange;\n}\n\nexport interface DateRangePresetsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /** The presets, in order. */\n presets: DateRangePreset[];\n /** The day the presets are worked out from. */\n today: Date;\n /** The current range. The preset that matches it is marked. */\n value?: DateRange;\n /** Called with the preset and its range when one is chosen. */\n onSelect?: (range: DateRange, preset: DateRangePreset) => void;\n /** Returns true for a range that can't be used. Its preset is disabled. */\n isRangeDisabled?: (range: DateRange) => boolean;\n /** Accessible name of the list. */\n 'aria-label'?: string;\n}\n\nconst isSameRange = (a: DateRange, b: DateRange | undefined) => {\n if (!a.start || !a.end || !b?.start || !b.end) return false;\n const first = sortRange(a.start, a.end);\n const second = sortRange(b.start, b.end);\n return isSameDay(first.start, second.start) && isSameDay(first.end, second.end);\n};\n\n/** The side list of a DateRangePicker: ranges such as \"Last 7 days\", worked out from `today`. */\nexport const DateRangePresets = forwardRef<HTMLDivElement, DateRangePresetsProps>(function DateRangePresets(\n { presets, today, value, onSelect, isRangeDisabled, className, 'aria-label': ariaLabel = 'Preset ranges', ...props },\n ref,\n) {\n return (\n <div ref={ref} role=\"group\" aria-label={ariaLabel} className={cx(styles.presets, className)} {...props}>\n {presets.map((preset) => {\n const range = preset.getRange(today);\n const active = isSameRange(range, value);\n return (\n <button\n key={preset.label}\n type=\"button\"\n className={styles.preset}\n aria-pressed={active}\n disabled={isRangeDisabled?.(range)}\n onClick={() => onSelect?.(range, preset)}\n >\n <span className={styles.label}>{preset.label}</span>\n {active && <Icon name=\"check\" className={styles.check} />}\n </button>\n );\n })}\n </div>\n );\n});\n","import { forwardRef } from 'react';\nimport { formatRangeText, type DateRange } from '../Calendar/dateUtils';\nimport { DateTriggerInternal, type DateTriggerInternalProps } from '../Calendar/DateTriggerInternal';\n\nexport interface DateRangeTriggerProps extends Omit<DateTriggerInternalProps, 'text'> {\n /** The range to show, as `12 Mar 2026 – 18 Mar 2026`. */\n value?: DateRange | null;\n /** BCP 47 locale for the dates. Leave out to use the browser's locale. */\n locale?: string;\n}\n\n/** The control that opens a DateRangePicker. It looks like Select and reads a surrounding Field. */\nexport const DateRangeTrigger = forwardRef<HTMLButtonElement, DateRangeTriggerProps>(function DateRangeTrigger(\n { value, locale, placeholder = 'Select dates', clearLabel = 'Clear dates', ...props },\n ref,\n) {\n return (\n <DateTriggerInternal ref={ref} text={formatRangeText(value, locale)} placeholder={placeholder} clearLabel={clearLabel} {...props} />\n );\n});\n","/* Doubled to win over the fixed width of Menu, whichever stylesheet loads last. */\n.popup.popup {\n gap: var(--space-12);\n width: max-content;\n max-width: calc(100vw - var(--space-16));\n padding: var(--space-12) var(--space-12) 0;\n}\n\n/* The presets and months sit side by side, and wrap when there isn't room. */\n.body {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-16);\n justify-content: center;\n}\n\n.presets {\n flex: 1 0 132px;\n max-width: 100%;\n}\n\n/* Keeps its natural width, so the list wraps away before the months have to stack. */\n.calendar {\n flex: 0 1 auto;\n min-width: 0;\n}\n\n/* Stays in view when stacked months make the popup scroll, so the helper text and Apply can always be seen. */\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 2;\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-8) var(--space-16);\n align-items: center;\n justify-content: space-between;\n padding: var(--space-12) 0;\n background: var(--color-bg-surface);\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.helper {\n flex: 1 1 200px;\n min-width: 0;\n}\n\n.helperLine {\n margin: 0;\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n\n.actions {\n display: flex;\n flex: none;\n gap: var(--space-8);\n margin-left: auto;\n}\n\n/* Heard by screen readers but not shown: the helper text in the popup says the same. */\n.status {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import { forwardRef, useCallback, useId, useMemo, useState, type ButtonHTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Button } from '../Button';\nimport { Calendar } from '../Calendar';\nimport {\n clampDay,\n createEndDateTest,\n formatLongDate,\n isDayDisabled,\n isRangeAllowed,\n sortRange,\n startOfDay,\n startOfMonth,\n toISODay,\n type DateRange,\n type WeekStart,\n} from '../Calendar/dateUtils';\nimport { useDatePopup } from '../Calendar/useDatePopup';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport { Menu } from '../Menu';\nimport { DateRangePresets, type DateRangePreset } from './DateRangePresets';\nimport { DateRangeTrigger } from './DateRangeTrigger';\nimport styles from './DateRangePicker.module.css';\n\n/** The words of a DateRangePicker, for translating it. */\nexport interface DateRangePickerLabels {\n /** Helper text while waiting for the first date. */\n selectStart: string;\n /** Helper text while waiting for the second date. */\n selectEnd: string;\n /** Helper text when a full range waits for Apply. */\n confirm: string;\n /** Explains `minDays` and `maxDays`. */\n limit: (minDays: number | undefined, maxDays: number | undefined) => string;\n /** Explains why a range can't reach past a disabled date. */\n noDisabledInRange: string;\n /** Announced when the first date is chosen. */\n announceStart: (date: string) => string;\n /** Announced when the range is complete. */\n announceRange: (start: string, end: string) => string;\n /** Announced when a selection is dropped. */\n announceCancel: string;\n /** Announced when the range is cleared. */\n announceClear: string;\n /** The Apply button. */\n apply: string;\n /** The Cancel button. */\n cancel: string;\n /** Accessible name of the clear button. */\n clear: string;\n /** Accessible name of the popup. */\n popup: string;\n /** Accessible name of the preset list. */\n presets: string;\n /** Accessible name of the previous month button. */\n previousMonth: string;\n /** Accessible name of the next month button. */\n nextMonth: string;\n}\n\nconst defaultLabels: DateRangePickerLabels = {\n selectStart: 'Select the start date',\n selectEnd: 'Select the end date',\n confirm: 'Apply to confirm these dates',\n limit: (minDays, maxDays) => {\n if (minDays !== undefined && maxDays !== undefined) return `Choose between ${minDays} and ${maxDays} days.`;\n return minDays !== undefined ? `Choose at least ${minDays} days.` : `Choose at most ${maxDays} days.`;\n },\n noDisabledInRange: \"A range can't include unavailable dates.\",\n announceStart: (date) => `Start date ${date} selected. Select the end date.`,\n announceRange: (start, end) => `Selected ${start} to ${end}.`,\n announceCancel: 'Selection cancelled.',\n announceClear: 'Dates cleared.',\n apply: 'Apply',\n cancel: 'Cancel',\n clear: 'Clear dates',\n popup: 'Choose a date range',\n presets: 'Preset ranges',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport interface DateRangePickerProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'value' | 'defaultValue' | 'onChange' | 'children'\n> {\n /** The chosen range, when controlled. Use Dates at local midnight. */\n value?: DateRange;\n /** The first chosen range, when uncontrolled. */\n defaultValue?: DateRange;\n /** Called with the range, in order and at local midnight, when it is complete. Both ends are null when it is cleared. */\n onChange?: (range: DateRange) => void;\n /** Text shown when no range is chosen. */\n placeholder?: string;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag. It can be focused but not opened. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** The earliest day that can be chosen. */\n min?: Date;\n /** The latest day that can be chosen. */\n max?: Date;\n /** Returns true for a day that can't be chosen. */\n isDateDisabled?: (date: Date) => boolean;\n /** The fewest days a range can include, counting both ends. Shorter choices are disabled once a start date is chosen. */\n minDays?: number;\n /** The most days a range can include, counting both ends. Longer choices are disabled once a start date is chosen. */\n maxDays?: number;\n /** Lets a range run across a disabled day. Neither end can be on one. */\n allowDisabledInRange?: boolean;\n /** Keeps the popup open after the second date, until Apply or Cancel. */\n requireApply?: boolean;\n /** Ranges to offer in a side list. */\n presets?: DateRangePreset[];\n /** How many months to show. Two sit side by side, and stack when there isn't room. */\n months?: 1 | 2;\n /** BCP 47 locale for names and numbers. Leave out to use the browser's locale. */\n locale?: string;\n /** The first column of the grid: 0 is Sunday and 1 is Monday. */\n weekStartsOn?: WeekStart;\n /** The day marked as today and used by `presets`. Defaults to now. Pass it for repeatable tests. */\n today?: Date;\n /** Shows a clear button while a range is chosen. */\n clearable?: boolean;\n /** Replaces any of the words, for translating. */\n labels?: Partial<DateRangePickerLabels>;\n}\n\n/** The range being chosen in the popup. Nothing reaches `onChange` until it is finished. */\ninterface Draft {\n range: DateRange;\n /** Which click comes next. `complete` means the range is full, so the next click starts a new one. */\n phase: 'start' | 'end' | 'complete';\n preview: Date | null;\n}\n\nconst EMPTY_RANGE: DateRange = { start: null, end: null };\n\nconst draftFrom = (range: DateRange): Draft => ({\n range,\n phase: range.start && range.end ? 'complete' : range.start ? 'end' : 'start',\n preview: null,\n});\n\n/**\n * Picks two dates: the first click sets the start, the second sets the end. Moving the pointer or keyboard focus previews\n * the range, reversed dates are swapped, and Escape or an outside press drops the selection and keeps the previous value.\n */\nexport const DateRangePicker = forwardRef<HTMLButtonElement, DateRangePickerProps>(function DateRangePicker(\n {\n value,\n defaultValue,\n onChange,\n placeholder,\n min,\n max,\n isDateDisabled,\n minDays,\n maxDays,\n allowDisabledInRange,\n requireApply,\n presets,\n months = 2,\n locale,\n weekStartsOn,\n today: todayProp,\n clearable,\n labels: labelsProp,\n name,\n invalid,\n disabled,\n locked,\n required,\n className,\n onClick,\n onKeyDown,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({ disabled, locked });\n const labels = { ...defaultLabels, ...labelsProp };\n const [now] = useState(() => startOfDay(new Date()));\n const today = todayProp ?? now;\n\n const [innerValue, setInnerValue] = useState<DateRange>(defaultValue ?? EMPTY_RANGE);\n const committed = value ?? innerValue;\n const [open, setOpen] = useState(false);\n const [draft, setDraft] = useState<Draft>(() => draftFrom(committed));\n const [viewMonth, setViewMonth] = useState(() => startOfMonth(committed.start ?? today));\n const [announcement, setAnnouncement] = useState('');\n const popupId = `${useId()}-popup`;\n\n const inProgress = open && (draft.phase === 'end' || Boolean(requireApply));\n const cancelMessage = labels.announceCancel;\n const dismiss = useCallback(() => {\n setOpen(false);\n if (inProgress) setAnnouncement(cancelMessage);\n }, [cancelMessage, inProgress]);\n const { buttonRef, triggerRef, popupRef, popupStyle, focusTrigger, onPopupKeyDown } = useDatePopup({\n open,\n onDismiss: dismiss,\n forwardedRef: ref,\n });\n\n const limits = useMemo(\n () => ({ min, max, isDateDisabled, minDays, maxDays, allowDisabledInRange }),\n [allowDisabledInRange, isDateDisabled, max, maxDays, min, minDays],\n );\n const choosingEnd = draft.phase === 'end' && draft.range.start;\n const canEndAt = useMemo(() => (choosingEnd ? createEndDateTest(choosingEnd, limits) : null), [choosingEnd, limits]);\n const isDayBlocked = (date: Date) => (canEndAt ? !canEndAt(date) : isDayDisabled(date, limits));\n\n const openPopup = () => {\n setDraft(draftFrom(committed));\n setViewMonth(startOfMonth(clampDay(committed.start ?? today, min, max)));\n setAnnouncement('');\n setOpen(true);\n };\n\n const finish = (range: DateRange) => {\n if (value === undefined) setInnerValue(range);\n onChange?.(range);\n setOpen(false);\n focusTrigger();\n if (range.start && range.end) {\n setAnnouncement(labels.announceRange(formatLongDate(range.start, locale), formatLongDate(range.end, locale)));\n }\n };\n\n /** A finished range either commits now, or waits for Apply. */\n const settle = (range: DateRange) => {\n if (requireApply) {\n setDraft({ range, phase: 'complete', preview: null });\n if (range.start && range.end) {\n setAnnouncement(labels.announceRange(formatLongDate(range.start, locale), formatLongDate(range.end, locale)));\n }\n } else {\n finish(range);\n }\n };\n\n const onDayChosen = (date: Date) => {\n if (draft.phase === 'end' && draft.range.start) {\n settle(sortRange(draft.range.start, date));\n } else {\n setDraft({ range: { start: date, end: null }, phase: 'end', preview: date });\n setAnnouncement(labels.announceStart(formatLongDate(date, locale)));\n }\n };\n\n const onPresetSelected = (range: DateRange) => {\n if (!range.start || !range.end) return;\n const sorted = sortRange(range.start, range.end);\n setViewMonth(startOfMonth(sorted.start));\n settle(sorted);\n };\n\n const cancel = () => {\n dismiss();\n focusTrigger();\n };\n\n const clear = () => {\n if (value === undefined) setInnerValue(EMPTY_RANGE);\n onChange?.(EMPTY_RANGE);\n setOpen(false);\n setAnnouncement(labels.announceClear);\n focusTrigger();\n };\n\n const onTriggerClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || field.locked) return;\n if (open) cancel();\n else openPopup();\n };\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || field.locked || open) return;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n openPopup();\n }\n };\n\n const helper =\n draft.phase === 'start'\n ? labels.selectStart\n : draft.phase === 'end'\n ? labels.selectEnd\n : requireApply\n ? labels.confirm\n : labels.selectStart;\n const hasLengthLimit = minDays !== undefined || maxDays !== undefined;\n const explainsDisabled = Boolean(isDateDisabled) && !allowDisabledInRange;\n\n return (\n <>\n <DateRangeTrigger\n ref={buttonRef}\n anchorRef={triggerRef}\n value={committed}\n locale={locale}\n placeholder={placeholder}\n invalid={invalid}\n disabled={disabled}\n locked={locked}\n required={required}\n open={open}\n popupId={popupId}\n clearable={clearable}\n clearLabel={labels.clear}\n onClear={clear}\n className={className}\n onClick={onTriggerClick}\n onKeyDown={onTriggerKeyDown}\n {...props}\n />\n {/* Stays mounted beside the trigger, so the last message is still read after the popup closes. */}\n <span role=\"status\" className={styles.status}>\n {announcement}\n </span>\n {name && (\n <>\n <input type=\"hidden\" name={`${name}Start`} value={committed.start ? toISODay(committed.start) : ''} disabled={field.disabled} />\n <input type=\"hidden\" name={`${name}End`} value={committed.end ? toISODay(committed.end) : ''} disabled={field.disabled} />\n </>\n )}\n {open &&\n createPortal(\n <Menu\n ref={popupRef}\n id={popupId}\n role=\"dialog\"\n aria-label={labels.popup}\n data-focus-scope=\"\"\n style={popupStyle}\n className={styles.popup}\n onKeyDown={onPopupKeyDown}\n >\n <div className={styles.body}>\n {presets && presets.length > 0 && (\n <DateRangePresets\n className={styles.presets}\n presets={presets}\n today={today}\n value={draft.range}\n aria-label={labels.presets}\n isRangeDisabled={(range) => !isRangeAllowed(range, limits)}\n onSelect={onPresetSelected}\n />\n )}\n <Calendar\n autoFocusDay\n className={styles.calendar}\n range={draft.range}\n rangePreview={draft.phase === 'end' ? draft.preview : null}\n month={viewMonth}\n onMonthChange={setViewMonth}\n months={months}\n min={min}\n max={max}\n isDateDisabled={isDayBlocked}\n locale={locale}\n weekStartsOn={weekStartsOn}\n today={today}\n previousMonthLabel={labels.previousMonth}\n nextMonthLabel={labels.nextMonth}\n onChange={onDayChosen}\n onDayPreview={(date) => setDraft((last) => (last.phase === 'end' ? { ...last, preview: date } : last))}\n />\n </div>\n <div className={styles.footer}>\n <div className={styles.helper}>\n <p className={styles.helperLine}>{helper}</p>\n {hasLengthLimit && <p className={styles.helperLine}>{labels.limit(minDays, maxDays)}</p>}\n {explainsDisabled && <p className={styles.helperLine}>{labels.noDisabledInRange}</p>}\n </div>\n {requireApply && (\n <div className={styles.actions}>\n <Button variant=\"secondary\" size=\"sm\" onClick={cancel}>\n {labels.cancel}\n </Button>\n <Button variant=\"inverse\" size=\"sm\" disabled={draft.phase !== 'complete'} onClick={() => finish(draft.range)}>\n {labels.apply}\n </Button>\n </div>\n )}\n </div>\n </Menu>,\n document.body,\n )}\n </>\n );\n});\n",".divider {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n}\n\n.horizontal {\n width: 100%;\n}\n\n.vertical {\n flex-direction: column;\n align-self: stretch;\n height: 100%;\n}\n\n.line {\n flex: 1;\n background: var(--color-border-subtle);\n}\n\n.horizontal .line {\n height: var(--stroke-hairline);\n}\n\n.vertical .line {\n width: var(--stroke-hairline);\n}\n\n.label {\n color: var(--color-text-tertiary);\n font: var(--font-caption);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Divider.module.css';\n\nexport type DividerOrientation = 'horizontal' | 'vertical';\n\nexport interface DividerProps extends HTMLAttributes<HTMLDivElement> {\n /** Direction of the line. A `vertical` divider stretches to the height of its container. */\n orientation?: DividerOrientation;\n /** Text in the middle of the line, also used as its accessible name. */\n label?: string;\n}\n\n/** Separates groups of content. */\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(function Divider(\n { orientation = 'horizontal', label, className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(styles.divider, styles[orientation], className)}\n role=\"separator\"\n aria-orientation={orientation === 'vertical' ? 'vertical' : undefined}\n aria-label={label}\n {...props}\n >\n <span className={styles.line} />\n {label && (\n <>\n <span className={styles.label}>{label}</span>\n <span className={styles.line} />\n </>\n )}\n </div>\n );\n});\n",".donut {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-16);\n}\n\n.ring {\n flex: none;\n}\n\n.faded {\n opacity: 0.3;\n}\n\n.total {\n fill: var(--color-text-primary);\n font: var(--font-numeric-m);\n letter-spacing: var(--tracking-numeric-m);\n}\n\n.centerLabel {\n fill: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.legend {\n display: flex;\n flex: 1 1 140px;\n flex-direction: column;\n gap: var(--space-4);\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.legendRow {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-16);\n}\n\n.share {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n font-variant-numeric: tabular-nums;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport {\n ChartDataTable,\n ChartFrame,\n ChartHoverLayer,\n arcPath,\n chartMarks,\n foldSegments,\n formatValue as defaultFormatValue,\n polar,\n seriesColorClass,\n useChartHover,\n type ChartSegment,\n} from '../ChartCore';\nimport { ChartLegendItem } from '../ChartLegend';\nimport { ChartTooltip } from '../ChartTooltip';\nimport styles from './DonutChart.module.css';\n\nexport interface DonutChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The parts of the whole. Up to five; any more fold into Other. */\n segments: ChartSegment[];\n /** Word under the total in the centre. */\n centerLabel?: string;\n /** Word beside the percentage in the tooltip. */\n shareLabel?: string;\n /** Diameter of the ring in pixels. */\n height?: number;\n /** Accessible name of the chart. Say what it shows. */\n 'aria-label'?: string;\n /** Shown in place of the chart when there is no data. */\n emptyMessage?: ReactNode;\n /** Formats the total and the values in the data table. */\n formatValue?: (value: number) => string;\n}\n\nconst GAP = 2;\nconst TAU = Math.PI * 2;\n\n/** Parts of one whole, for five segments or fewer. The total sits in the centre, and the legend gives each share so identity is never colour alone. */\nexport const DonutChart = forwardRef<HTMLDivElement, DonutChartProps>(function DonutChart(\n {\n segments,\n centerLabel = 'Total',\n shareLabel = 'Share',\n height = 160,\n 'aria-label': ariaLabel = 'Donut chart',\n emptyMessage,\n formatValue = defaultFormatValue,\n className,\n ...props\n },\n ref,\n) {\n const positive = foldSegments(segments).filter((segment) => segment.value > 0);\n const total = positive.reduce((sum, segment) => sum + segment.value, 0);\n const share = (value: number) => `${Math.round((value / total) * 100)}%`;\n\n const centre = height / 2;\n const outer = centre - 1;\n const inner = outer - Math.round(height * 0.125);\n\n let cursor = 0;\n const arcs = positive.map((segment, colorIndex) => {\n const start = cursor;\n cursor += (segment.value / (total || 1)) * TAU;\n return { segment, colorIndex, start, end: cursor };\n });\n\n const hover = useChartHover({\n count: arcs.length,\n locate: (x, y) => {\n const distance = Math.hypot(x - centre, y - centre);\n if (distance < inner - 2 || distance > outer + 2) return null;\n const angle = (Math.atan2(x - centre, centre - y) + TAU) % TAU;\n const found = arcs.findIndex((arc) => angle >= arc.start && angle < arc.end);\n return found < 0 ? null : found;\n },\n });\n\n const activeArc = hover.activeIndex === null ? null : arcs[hover.activeIndex];\n // The tooltip follows the segment sideways but stays along the top, so that it never covers the total.\n const anchor = activeArc ? { x: polar(centre, centre, (outer + inner) / 2, (activeArc.start + activeArc.end) / 2).x, y: 0 } : null;\n\n return (\n <ChartFrame ref={ref} height={height} empty={total <= 0} emptyMessage={emptyMessage} className={cx(styles.donut, className)} {...props}>\n <ChartHoverLayer\n className={styles.ring}\n style={{ width: height }}\n hover={hover}\n label={ariaLabel}\n height={height}\n anchor={anchor}\n tooltip={\n activeArc && (\n <ChartTooltip\n title={activeArc.segment.label}\n rows={[\n { id: activeArc.segment.id, name: shareLabel, value: share(activeArc.segment.value), colorIndex: activeArc.colorIndex },\n ]}\n />\n )\n }\n announcement={activeArc ? `${activeArc.segment.label}, ${shareLabel} ${share(activeArc.segment.value)}` : ''}\n >\n <svg className={chartMarks.svg} width={height} height={height} aria-hidden=\"true\">\n {arcs.map((arc, i) => (\n <path\n key={arc.segment.id}\n className={cx(\n chartMarks.bar,\n seriesColorClass(arc.colorIndex),\n hover.activeIndex !== null && hover.activeIndex !== i && styles.faded,\n )}\n d={arcPath(centre, centre, outer, inner, arc.start, arc.end, arcs.length > 1 ? GAP : 0)}\n />\n ))}\n <text className={styles.total} x={centre} y={centre - 8} textAnchor=\"middle\" dominantBaseline=\"central\">\n {formatValue(total)}\n </text>\n <text className={styles.centerLabel} x={centre} y={centre + 14} textAnchor=\"middle\" dominantBaseline=\"central\">\n {centerLabel}\n </text>\n </svg>\n </ChartHoverLayer>\n <ul className={styles.legend}>\n {arcs.map((arc) => (\n <li key={arc.segment.id} className={styles.legendRow}>\n <ChartLegendItem label={arc.segment.label} colorIndex={arc.colorIndex} />\n <span className={styles.share}>{share(arc.segment.value)}</span>\n </li>\n ))}\n </ul>\n <ChartDataTable\n caption={ariaLabel}\n columns={['Segment', 'Value', shareLabel]}\n rows={arcs.map((arc) => ({\n id: arc.segment.id,\n header: arc.segment.label,\n cells: [formatValue(arc.segment.value), share(arc.segment.value)],\n }))}\n />\n </ChartFrame>\n );\n});\n",".backdrop {\n --drawer-backdrop: color-mix(in srgb, var(--mono-950) 40%, transparent);\n\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n background: var(--drawer-backdrop);\n}\n\n.right {\n justify-content: flex-end;\n}\n\n.left {\n justify-content: flex-start;\n}\n\n.panel {\n display: flex;\n flex-direction: column;\n width: 420px;\n max-width: 100%;\n height: 100%;\n background: var(--color-bg-surface);\n border: 0 solid var(--color-border-subtle);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n.panel:focus-visible {\n outline: none;\n}\n\n.right .panel {\n border-left-width: var(--stroke-hairline);\n}\n\n.left .panel {\n border-right-width: var(--stroke-hairline);\n}\n","import { forwardRef, useImperativeHandle, useRef, type HTMLAttributes, type RefObject } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport { useModalBehaviour, useOverlayOpen } from '../Dialog';\nimport { DialogContext, useDialogLabels } from '../Dialog/dialogContext';\nimport styles from './Drawer.module.css';\n\nexport type DrawerSide = 'right' | 'left';\n\nexport interface DrawerProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the drawer is showing. Leave undefined to use `defaultOpen` and let the drawer manage itself. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the user closes the drawer. */\n onClose?: () => void;\n /** Whether Escape, a backdrop press and the header's close button can close the drawer. */\n dismissible?: boolean;\n /** The edge of the viewport the panel attaches to. */\n side?: DrawerSide;\n /** Element to focus on open. Defaults to the first focusable element. */\n initialFocusRef?: RefObject<HTMLElement | null>;\n}\n\n/**\n * A modal side panel for details and secondary tasks. Compose it from DialogHeader, DialogBody and DialogFooter.\n * It behaves like Dialog: focus trap, focus restore, scroll lock, Escape and backdrop close.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n { open, defaultOpen = false, onClose, dismissible = true, side = 'right', initialFocusRef, className, children, ...props },\n ref,\n) {\n const [isOpen, close] = useOverlayOpen(open, defaultOpen, onClose);\n const panelRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const { context, labelProps } = useDialogLabels(dismissible, close);\n\n useImperativeHandle(ref, () => panelRef.current as HTMLDivElement);\n useModalBehaviour({ open: isOpen, containerRef: panelRef, backdropRef, initialFocusRef, dismissible, onDismiss: close });\n\n if (!isOpen) return null;\n\n return createPortal(\n <div ref={backdropRef} className={cx(styles.backdrop, styles[side])}>\n <div ref={panelRef} role=\"dialog\" aria-modal=\"true\" tabIndex={-1} className={cx(styles.panel, className)} {...labelProps} {...props}>\n <DialogContext.Provider value={context}>{children}</DialogContext.Provider>\n </div>\n </div>,\n document.body,\n );\n});\n",".production {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n color: var(--color-text-primary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n white-space: nowrap;\n}\n\n.rule {\n flex: none;\n width: 2px;\n height: 18px;\n background: var(--color-border-strong);\n}\n\n.standard {\n display: inline-flex;\n align-items: center;\n padding: var(--space-2) var(--space-6);\n border-radius: var(--radius-sm);\n background: var(--color-bg-subtle);\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './EnvironmentLabel.module.css';\n\nexport type EnvironmentLabelKind = 'production' | 'standard';\n\nexport interface EnvironmentLabelProps extends HTMLAttributes<HTMLSpanElement> {\n /** `production` is always visually distinct and has fixed text. `standard` shows `name`. */\n kind: EnvironmentLabelKind;\n /** Environment name, such as `staging`. Only used by the `standard` kind. */\n name?: string;\n}\n\n/** Identifies the environment. Production gets a rule, a lock and uppercase text so it cannot be mistaken for anything else. */\nexport const EnvironmentLabel = forwardRef<HTMLSpanElement, EnvironmentLabelProps>(function EnvironmentLabel(\n { kind, name, className, ...props },\n ref,\n) {\n if (kind === 'production') {\n return (\n <span ref={ref} className={cx(styles.production, className)} {...props}>\n <span className={styles.rule} aria-hidden=\"true\" />\n <Icon name=\"lock\" size={16} />\n PRODUCTION\n </span>\n );\n }\n return (\n <span ref={ref} className={cx(styles.standard, className)} {...props}>\n {name}\n </span>\n );\n});\n",".field {\n display: flex;\n flex-direction: column;\n gap: var(--space-6);\n min-width: 0;\n}\n\n.header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--space-8);\n}\n\n.label {\n font: var(--font-label-m);\n color: var(--color-text-primary);\n}\n\n.labelDisabled {\n color: var(--color-text-disabled);\n}\n\n.meta {\n font: var(--font-mono-s);\n color: var(--color-text-secondary);\n}\n\n.message {\n margin: 0;\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n\n.error {\n color: var(--color-text-danger);\n}\n","import { useId, useMemo, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Field.module.css';\nimport { FieldContext } from './FieldContext';\n\nexport interface FieldProps extends HTMLAttributes<HTMLDivElement> {\n /** The visible label. */\n label: ReactNode;\n /** Short text at the end of the label row, such as a locale. */\n meta?: ReactNode;\n /** Help text below the control. */\n help?: ReactNode;\n /** Error text. It replaces the help text and puts the control in its error state. */\n error?: ReactNode;\n /** Disables the control and dims the label. */\n disabled?: boolean;\n /** Puts the control in its locked state, for values set by staff. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** The id for the control. Generated when left out. */\n controlId?: string;\n /** One control that reads the Field through `useFieldControl`, such as Input, Textarea, Select or MultiSelect. */\n children: ReactNode;\n}\n\n/**\n * A labelled form control. It connects the label, help text and error text to its control. Use a library control\n * as the child, or build one with `useFieldControl`; a plain native input is not connected.\n */\nexport function Field({\n label,\n meta,\n help,\n error,\n disabled = false,\n locked = false,\n required = false,\n controlId,\n className,\n children,\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const id = controlId ?? `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const messageId = `${generatedId}-message`;\n const hasError = Boolean(error);\n const hasMessage = Boolean(error || help);\n\n const context = useMemo(\n () => ({ controlId: id, labelId, describedById: hasMessage ? messageId : undefined, invalid: hasError, disabled, locked, required }),\n [disabled, hasError, hasMessage, id, labelId, locked, messageId, required],\n );\n\n return (\n <div className={cx(styles.field, className)} {...props}>\n <div className={styles.header}>\n <label id={labelId} htmlFor={id} className={cx(styles.label, disabled && styles.labelDisabled)}>\n {label}\n </label>\n {meta && <span className={styles.meta}>{meta}</span>}\n </div>\n <FieldContext.Provider value={context}>{children}</FieldContext.Provider>\n {hasMessage && (\n <p id={messageId} className={cx(styles.message, hasError && styles.error)}>\n {error || help}\n </p>\n )}\n </div>\n );\n}\n",".kpi {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.card {\n min-width: 240px;\n padding: var(--space-16);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-lg);\n}\n\n.label {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.figure {\n display: flex;\n align-items: baseline;\n gap: var(--space-8);\n margin-top: var(--space-4);\n}\n\n.value {\n color: var(--color-text-primary);\n font: var(--font-numeric-l);\n letter-spacing: var(--tracking-numeric-l);\n}\n\n.unit {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.meta {\n display: flex;\n align-items: center;\n gap: var(--space-4);\n margin-top: var(--space-4);\n font: var(--font-caption);\n}\n\n.arrow {\n flex: none;\n}\n\n.good {\n color: var(--color-text-success);\n}\n\n.bad {\n color: var(--color-text-danger);\n}\n\n.neutral {\n color: var(--color-text-secondary);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './KPI.module.css';\n\nexport type KPIVariant = 'plain' | 'card';\nexport type KPITrend = 'up' | 'down' | 'none';\nexport type KPITrendIntent = 'good' | 'bad' | 'neutral';\n\nexport interface KPIProps extends HTMLAttributes<HTMLDivElement> {\n /** What is being measured. */\n label: ReactNode;\n /** The number. Never show zero for data that was not recorded. */\n value: ReactNode;\n /** Text after the value, such as a unit or `of 44`. */\n unit?: ReactNode;\n /** Direction of change. `up` and `down` draw an arrow before the meta text. */\n trend?: KPITrend;\n /** Whether the change is welcome, which sets the colour. Defaults to `good` for `up` and `bad` for `down`. Set it when lower is better, such as an error rate. */\n trendIntent?: KPITrendIntent;\n /** Accessible name of the arrow. Defaults to `Up` or `Down`. */\n trendLabel?: string;\n /** Supporting detail below the value. */\n meta?: ReactNode;\n /** `plain` has no frame. `card` adds a border and padding. */\n variant?: KPIVariant;\n}\n\nconst DEFAULT_INTENT: Record<KPITrend, KPITrendIntent> = { up: 'good', down: 'bad', none: 'neutral' };\nconst DEFAULT_TREND_LABEL = { up: 'Up', down: 'Down' };\n\n/** One key number with its context. Colour is never the only signal: a trend always has an arrow and supporting text. */\nexport const KPI = forwardRef<HTMLDivElement, KPIProps>(function KPI(\n { label, value, unit, trend = 'none', trendIntent, trendLabel, meta, variant = 'plain', className, ...props },\n ref,\n) {\n const intent = trendIntent ?? DEFAULT_INTENT[trend];\n return (\n <div ref={ref} className={cx(styles.kpi, styles[variant], className)} {...props}>\n <div className={styles.label}>{label}</div>\n <div className={styles.figure}>\n <span className={styles.value}>{value}</span>\n {unit && <span className={styles.unit}>{unit}</span>}\n </div>\n {(meta || trend !== 'none') && (\n <div className={cx(styles.meta, styles[intent])}>\n {trend !== 'none' && (\n <Icon\n name={trend === 'up' ? 'arrow-up' : 'arrow-down'}\n size={14}\n label={trendLabel ?? DEFAULT_TREND_LABEL[trend]}\n className={styles.arrow}\n />\n )}\n {meta}\n </div>\n )}\n </div>\n );\n});\n",".sparkline {\n width: 100%;\n}\n\n.accent {\n --chart-series-color: var(--color-chart-1);\n}\n\n.neutral {\n --chart-series-color: var(--color-status-neutral);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport {\n ChartDataTable,\n ChartFrame,\n chartMarks,\n formatValue as defaultFormatValue,\n lastRecordedIndex,\n linePath,\n linearScale,\n useChartSize,\n} from '../ChartCore';\nimport styles from './Sparkline.module.css';\n\nexport type SparklineTone = 'accent' | 'neutral';\n\nexport interface SparklineProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** Values in order. Use `null` where nothing was recorded. */\n data: (number | null)[];\n /** Accessible name. Say what the trend is, because the shape alone has no words. */\n label: string;\n /** `accent` for the one trend that matters, `neutral` for the rest. */\n tone?: SparklineTone;\n /** Height in pixels. Width fills the container. */\n height?: number;\n /** Shown in place of the line when there is no data. */\n emptyMessage?: ReactNode;\n /** Formats values in the data table. */\n formatValue?: (value: number) => string;\n}\n\nconst INSET = 6;\nconst DOT_RADIUS = 5;\n\n/** A tiny trend for tables and KPIs, with no axes. Pair it with a number, because it shows shape rather than exact values. */\nexport const Sparkline = forwardRef<HTMLDivElement, SparklineProps>(function Sparkline(\n { data, label, tone = 'accent', height = 32, emptyMessage = 'No data', formatValue = defaultFormatValue, className, ...props },\n ref,\n) {\n const { ref: sizeRef, width } = useChartSize(ref);\n const recorded = data.filter((value): value is number => value !== null);\n const xAt = linearScale([0, Math.max(1, data.length - 1)], [INSET, Math.max(INSET, width - INSET)]);\n const yAt = linearScale([Math.min(...recorded), Math.max(...recorded)], [height - INSET, INSET]);\n const lastIndex = lastRecordedIndex(data);\n const toneClass = styles[tone];\n\n return (\n <ChartFrame\n ref={sizeRef}\n height={height}\n empty={recorded.length === 0}\n emptyMessage={emptyMessage}\n className={cx(styles.sparkline, className)}\n {...props}\n >\n <div role=\"img\" aria-label={label} style={{ height }}>\n {width > 0 && (\n <svg className={chartMarks.svg} width={width} height={height} aria-hidden=\"true\">\n <path\n className={cx(chartMarks.line, toneClass)}\n d={linePath(data.map((value, i) => (value === null ? null : { x: xAt(i), y: yAt(value) })))}\n />\n {lastIndex >= 0 && (\n <circle className={cx(chartMarks.marker, toneClass)} cx={xAt(lastIndex)} cy={yAt(data[lastIndex] as number)} r={DOT_RADIUS} />\n )}\n </svg>\n )}\n </div>\n <ChartDataTable\n caption={label}\n columns={['Point', 'Value']}\n rows={data.map((value, i) => ({ id: `${i}`, header: `${i + 1}`, cells: [value === null ? 'No data' : formatValue(value)] }))}\n />\n </ChartFrame>\n );\n});\n",".kpiGraph {\n display: flex;\n align-items: flex-end;\n justify-content: space-between;\n gap: var(--space-16);\n}\n\n.card {\n min-width: 340px;\n padding: var(--space-16);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-lg);\n}\n\n.graph {\n flex: none;\n width: 120px;\n}\n\n.svg {\n display: block;\n}\n\n.areaFill {\n fill: var(--color-chart-1);\n fill-opacity: 0.12;\n}\n\n.areaLine {\n fill: none;\n stroke: var(--color-chart-1);\n stroke-width: var(--stroke-strong);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.areaDot {\n fill: var(--color-chart-1);\n}\n\n.bar {\n fill: var(--color-bg-sunken);\n}\n\n.barCurrent {\n fill: var(--color-chart-1);\n}\n","import { forwardRef } from 'react';\nimport { cx } from '../../lib/cx';\nimport { KPI, type KPIProps } from '../KPI';\nimport { Sparkline } from '../Sparkline';\nimport styles from './KPIGraph.module.css';\n\nexport type KPIGraphType = 'line' | 'area' | 'bars';\n\nexport interface KPIGraphProps extends KPIProps {\n /** Values for the mini graph, oldest first. */\n data: number[];\n /** `line` and `area` suit continuous trends. `bars` suits counts per period, with the current period in the accent colour. */\n graph?: KPIGraphType;\n /** Accessible name of the graph. Say what the trend is, because the shape alone has no words. */\n graphLabel: string;\n}\n\nconst WIDTH = 120;\nconst HEIGHT = 48;\nconst INSET = 4;\nconst BAR_GAP = 2;\nconst DOT_RADIUS = 3;\n/** The lowest bar stays visible, so a small value is not read as nothing. */\nconst MIN_BAR_HEIGHT = 4;\n\nfunction Area({ data }: { data: number[] }) {\n const min = Math.min(...data);\n const range = Math.max(...data) - min || 1;\n const yAt = (value: number) => HEIGHT - INSET - ((value - min) / range) * (HEIGHT - INSET * 2);\n const xAt = (index: number) => INSET + (index / Math.max(1, data.length - 1)) * (WIDTH - INSET * 2);\n const line = data.map((value, i) => `${i === 0 ? 'M' : 'L'}${xAt(i)} ${yAt(value)}`).join(' ');\n const lastX = xAt(data.length - 1);\n return (\n <>\n <path className={styles.areaFill} d={`${line} L${lastX} ${HEIGHT} L${xAt(0)} ${HEIGHT} Z`} />\n <path className={styles.areaLine} d={line} />\n <circle className={styles.areaDot} cx={lastX} cy={yAt(data[data.length - 1])} r={DOT_RADIUS} />\n </>\n );\n}\n\nfunction Bars({ data }: { data: number[] }) {\n const max = Math.max(...data, 1);\n const barWidth = (WIDTH - BAR_GAP * (data.length - 1)) / data.length;\n return (\n <>\n {data.map((value, i) => {\n const height = Math.max(MIN_BAR_HEIGHT, (value / max) * HEIGHT);\n return (\n <rect\n key={i}\n className={i === data.length - 1 ? styles.barCurrent : styles.bar}\n x={i * (barWidth + BAR_GAP)}\n y={HEIGHT - height}\n width={barWidth}\n height={height}\n />\n );\n })}\n </>\n );\n}\n\n/** A KPI with a mini graph of its recent history at the right. */\nexport const KPIGraph = forwardRef<HTMLDivElement, KPIGraphProps>(function KPIGraph(\n { data, graph = 'line', graphLabel, variant = 'card', label, value, unit, trend, trendIntent, trendLabel, meta, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.kpiGraph, variant === 'card' && styles.card, className)} {...props}>\n <KPI label={label} value={value} unit={unit} trend={trend} trendIntent={trendIntent} trendLabel={trendLabel} meta={meta} />\n {data.length > 0 && (\n <div className={styles.graph}>\n {graph === 'line' ? (\n <Sparkline data={data} label={graphLabel} height={HEIGHT} />\n ) : (\n <svg className={styles.svg} width={WIDTH} height={HEIGHT} viewBox={`0 0 ${WIDTH} ${HEIGHT}`} role=\"img\" aria-label={graphLabel}>\n {graph === 'area' ? <Area data={data} /> : <Bars data={data} />}\n </svg>\n )}\n </div>\n )}\n </div>\n );\n});\n",".kbd {\n display: inline-flex;\n align-items: center;\n padding: var(--space-2) var(--space-6);\n border-radius: var(--radius-sm);\n background: var(--color-bg-subtle);\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Kbd.module.css';\n\nexport type KbdProps = HTMLAttributes<HTMLElement>;\n\n/** Chip for a key or keyboard shortcut, as in the Search box. */\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd({ className, ...props }, ref) {\n return <kbd ref={ref} className={cx(styles.kbd, className)} {...props} />;\n});\n",".label {\n display: inline-flex;\n align-items: center;\n gap: var(--space-4);\n padding: 0 var(--space-8);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-sm);\n white-space: nowrap;\n}\n\n.md {\n height: 24px;\n font: var(--font-label-m);\n}\n\n.sm {\n height: 20px;\n font: var(--font-label-s);\n}\n\n.neutral {\n background: var(--color-bg-subtle);\n color: var(--color-text-secondary);\n}\n\n.accent {\n background: var(--color-bg-accent-subtle);\n color: var(--color-text-link);\n}\n\n.success {\n background: var(--color-bg-subtle);\n color: var(--color-text-success);\n}\n\n.warning {\n background: var(--color-bg-subtle);\n color: var(--color-text-warning);\n}\n\n.danger {\n background: var(--color-bg-danger-subtle);\n color: var(--color-text-danger);\n}\n\n.outline {\n background: var(--color-bg-canvas);\n border-color: var(--color-border-default);\n color: var(--color-text-secondary);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './Label.module.css';\n\nexport type LabelTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'outline';\nexport type LabelSize = 'md' | 'sm';\n\nexport interface LabelProps extends HTMLAttributes<HTMLSpanElement> {\n /** Colour treatment of the tag. */\n tone?: LabelTone;\n /** Height: `md` is 24 px and `sm` is 20 px. */\n size?: LabelSize;\n /** Icon before the text. */\n icon?: IconName;\n}\n\nconst ICON_SIZE: Record<LabelSize, number> = { md: 16, sm: 14 };\n\n/** Short categorical tag, such as a type, count or plan. Use Status instead when showing the state of an object. */\nexport const Label = forwardRef<HTMLSpanElement, LabelProps>(function Label(\n { tone = 'neutral', size = 'md', icon, className, children, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.label, styles[tone], styles[size], className)} {...props}>\n {icon && <Icon name={icon} size={ICON_SIZE[size]} />}\n {children}\n </span>\n );\n});\n","import { forwardRef } from 'react';\nimport { SeriesChartInternal, type SeriesChartProps } from './SeriesChartInternal';\n\nexport type LineChartProps = SeriesChartProps;\n\n/** Change over time for up to five series, on one y axis. Two or more series get a legend that can hide or isolate them. */\nexport const LineChart = forwardRef<HTMLDivElement, LineChartProps>(function LineChart(\n { 'aria-label': ariaLabel = 'Line chart', ...props },\n ref,\n) {\n return <SeriesChartInternal ref={ref} aria-label={ariaLabel} wash={false} {...props} />;\n});\n",".tile {\n display: flex;\n flex-direction: column;\n width: 168px;\n padding: var(--space-0);\n background: transparent;\n border: none;\n border-radius: var(--radius-lg);\n font-family: inherit;\n text-align: left;\n cursor: pointer;\n}\n\n.tile:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.preview {\n display: block;\n overflow: hidden;\n height: 126px;\n margin-bottom: var(--space-8);\n background: var(--color-bg-subtle);\n border: var(--stroke-strong) solid transparent;\n border-radius: var(--radius-lg);\n}\n\n.tile:hover .preview {\n border-color: var(--color-border-default);\n}\n\n.selected .preview,\n.selected:hover .preview {\n border-color: var(--color-border-focus);\n}\n\n.image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.name {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.meta {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './MediaTile.module.css';\n\nexport interface MediaTileProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Image to show. Without it, the tile shows an empty placeholder. */\n src?: string;\n /** The name of the file. */\n name: string;\n /** A quieter line, such as its size. */\n meta?: ReactNode;\n /** Marks the tile as chosen. */\n selected?: boolean;\n}\n\n/** A selectable thumbnail of a media file. A toggle button that states its selection with `aria-pressed`. */\nexport const MediaTile = forwardRef<HTMLButtonElement, MediaTileProps>(function MediaTile(\n { src, name, meta, selected = false, className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.tile, selected && styles.selected, className)} aria-pressed={selected} {...props}>\n <span className={styles.preview}>{src && <img className={styles.image} src={src} alt=\"\" />}</span>\n <span className={styles.name}>{name}</span>\n {meta && <span className={styles.meta}>{meta}</span>}\n </button>\n );\n});\n",".unavailableState {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n padding: var(--space-20);\n background: var(--color-bg-subtle);\n border-radius: var(--radius-lg);\n color: var(--color-text-primary);\n}\n\n.icon {\n margin-bottom: var(--space-12);\n color: var(--color-icon-secondary);\n}\n\n.title {\n margin-bottom: var(--space-6);\n font: var(--font-heading-m);\n letter-spacing: var(--tracking-heading-m);\n}\n\n.description {\n margin: 0;\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n\n.link {\n margin-top: var(--space-10);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Link } from '../Link';\nimport styles from './UnavailableState.module.css';\n\nexport interface UnavailableStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Icon for the feature that is off. */\n icon?: IconName;\n /** What is off. */\n title: ReactNode;\n /** Why it is off, and what still works. */\n description?: ReactNode;\n /** Text of the link that explains how to turn it on. */\n linkLabel?: string;\n /** Where that link goes. */\n linkHref?: string;\n /** Whether the link leaves the app. Opens in a new tab with an external-link icon. */\n linkExternal?: boolean;\n}\n\n/** Explains that a feature is off because of how the system is set up, and how to turn it on. */\nexport const UnavailableState = forwardRef<HTMLDivElement, UnavailableStateProps>(function UnavailableState(\n { icon = 'bar-chart', title, description, linkLabel, linkHref, linkExternal = false, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.unavailableState, className)} {...props}>\n <Icon name={icon} size={20} className={styles.icon} />\n <div className={styles.title}>{title}</div>\n {description && <p className={styles.description}>{description}</p>}\n {linkLabel && linkHref && (\n <div className={styles.link}>\n <Link href={linkHref} external={linkExternal}>\n {linkLabel}\n </Link>\n </div>\n )}\n </div>\n );\n});\n",".card {\n display: flex;\n align-items: center;\n gap: var(--space-16);\n}\n\n.figure {\n flex: none;\n min-width: 120px;\n}\n\n.label {\n color: var(--color-text-secondary);\n font: var(--font-label-s);\n}\n\n.value {\n margin-top: var(--space-2);\n color: var(--color-text-primary);\n font: var(--font-numeric-m);\n letter-spacing: var(--tracking-numeric-m);\n}\n\n.meta {\n margin-top: var(--space-2);\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.chart {\n flex: 1;\n min-width: 0;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Card } from '../Card';\nimport { UnavailableState } from '../UnavailableState';\nimport styles from './MetricCard.module.css';\n\nexport type MetricCardState = 'default' | 'unavailable';\n\nexport interface MetricCardProps extends HTMLAttributes<HTMLElement> {\n /** `default` shows the figure and chart. `unavailable` explains what is off and how to turn it on, and never draws zeros. */\n state?: MetricCardState;\n /** What is measured. */\n label?: ReactNode;\n /** The figure. */\n value?: ReactNode;\n /** Context for the figure, such as the change against a named period. */\n meta?: ReactNode;\n /** When unavailable: what is off. */\n unavailableTitle?: ReactNode;\n /** When unavailable: why it is off, and what still works. */\n unavailableDescription?: ReactNode;\n /** When unavailable: text of the link that explains how to turn it on. */\n linkLabel?: string;\n /** When unavailable: where that link goes. */\n linkHref?: string;\n /** When unavailable: whether that link leaves the app. */\n linkExternal?: boolean;\n /** The chart beside the figure. */\n children?: ReactNode;\n}\n\n/** A label and value beside a chart. When the source is off, it explains what is off and how to turn it on. */\nexport const MetricCard = forwardRef<HTMLElement, MetricCardProps>(function MetricCard(\n {\n state = 'default',\n label,\n value,\n meta,\n unavailableTitle,\n unavailableDescription,\n linkLabel,\n linkHref,\n linkExternal = true,\n className,\n children,\n ...props\n },\n ref,\n) {\n if (state === 'unavailable') {\n return (\n <div ref={ref as React.Ref<HTMLDivElement>} className={className} {...(props as HTMLAttributes<HTMLDivElement>)}>\n <UnavailableState\n icon=\"activity\"\n title={unavailableTitle}\n description={unavailableDescription}\n linkLabel={linkLabel}\n linkHref={linkHref}\n linkExternal={linkExternal}\n />\n </div>\n );\n }\n return (\n <Card ref={ref} className={cx(styles.card, className)} {...props}>\n <div className={styles.figure}>\n <div className={styles.label}>{label}</div>\n <div className={styles.value}>{value}</div>\n {meta && <div className={styles.meta}>{meta}</div>}\n </div>\n {children && <div className={styles.chart}>{children}</div>}\n </Card>\n );\n});\n",".trigger {\n justify-content: space-between;\n text-align: left;\n cursor: pointer;\n}\n\n.trigger[aria-readonly='true'] {\n cursor: default;\n}\n\n.value {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.placeholder {\n color: var(--color-text-tertiary);\n}\n\n.popup {\n max-height: 320px;\n overflow: hidden;\n}\n\n.list {\n display: flex;\n flex: 1;\n flex-direction: column;\n gap: var(--space-2);\n min-height: 0;\n overflow-y: auto;\n}\n\n.filter {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--space-8);\n padding: var(--space-6) var(--space-8);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n font: var(--font-body-s);\n}\n\n.empty {\n padding: var(--space-6) var(--space-8);\n font: var(--font-body-s);\n color: var(--color-text-secondary);\n}\n","import { useMemo, useRef, useState } from 'react';\n\nexport interface ListboxItem {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nconst TYPE_AHEAD_RESET_MS = 500;\nconst PAGE_SIZE = 10;\n\n/** The active row, filter text and type-ahead buffer shared by Select and MultiSelect. */\nexport function useListbox<T extends ListboxItem>(options: T[]) {\n const [query, setQuery] = useState('');\n const [activeIndex, setActiveIndex] = useState(-1);\n const typed = useRef({ text: '', time: 0 });\n\n const filtered = useMemo(() => {\n const needle = query.trim().toLowerCase();\n return needle ? options.filter((option) => option.label.toLowerCase().includes(needle)) : options;\n }, [options, query]);\n\n return { query, setQuery, activeIndex, setActiveIndex, filtered, typed };\n}\n\n/** The first enabled index at or after `start`, walking in `step` direction. Returns -1 if there is none. */\nexport function findEnabled(items: ListboxItem[], start: number, step: 1 | -1) {\n for (let index = start; index >= 0 && index < items.length; index += step) {\n if (!items[index].disabled) return index;\n }\n return -1;\n}\n\n/** The index a navigation key moves to, or null if the key does not navigate. It does not wrap, as the APG select-only pattern advises. */\nexport function nextIndexForKey(key: string, items: ListboxItem[], current: number): number | null {\n const stay = (index: number) => (index === -1 ? current : index);\n switch (key) {\n case 'ArrowDown':\n return stay(findEnabled(items, current + 1, 1));\n case 'ArrowUp':\n return stay(findEnabled(items, current === -1 ? items.length - 1 : current - 1, -1));\n case 'Home':\n return findEnabled(items, 0, 1);\n case 'End':\n return findEnabled(items, items.length - 1, -1);\n case 'PageDown':\n return stay(findEnabled(items, Math.min(current + PAGE_SIZE, items.length - 1), -1));\n case 'PageUp':\n return stay(findEnabled(items, Math.max(current - PAGE_SIZE, 0), 1));\n default:\n return null;\n }\n}\n\n/** True for a single printable character, without modifiers. */\nexport function isPrintableKey(event: { key: string; altKey: boolean; ctrlKey: boolean; metaKey: boolean }) {\n return event.key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey;\n}\n\n/**\n * Finds the next match for typed characters. Characters typed quickly build up a prefix, and repeating one\n * character cycles through the options that start with it. Returns -1 if nothing matches.\n */\nexport function typeAheadIndex(items: ListboxItem[], current: number, char: string, buffer: { text: string; time: number }, now: number) {\n const text = (now - buffer.time > TYPE_AHEAD_RESET_MS ? char : buffer.text + char).toLowerCase();\n buffer.text = text;\n buffer.time = now;\n const repeated = [...text].every((letter) => letter === text[0]);\n const search = repeated ? text[0] : text;\n const start = repeated ? current + 1 : Math.max(current, 0);\n for (let offset = 0; offset < items.length; offset += 1) {\n const index = (start + offset) % items.length;\n if (!items[index].disabled && items[index].label.toLowerCase().startsWith(search)) return index;\n }\n return -1;\n}\n\n/** The id of an option row, or undefined when no row is active. */\nexport function optionId(listId: string, index: number) {\n return index >= 0 ? `${listId}-option-${index}` : undefined;\n}\n","/* The combobox button fills the box, so a click anywhere opens the popup. Chips and the clear button sit above it. */\n.trigger {\n position: relative;\n min-height: 38px;\n padding-top: var(--space-6);\n padding-bottom: var(--space-6);\n}\n\n.trigger:has(> .combobox:focus-visible),\n.open {\n border-color: var(--color-border-focus);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: calc(var(--stroke-hairline) * -1);\n}\n\n.combobox {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n padding: 0 var(--space-12);\n background: transparent;\n border: 0;\n border-radius: inherit;\n outline: 0;\n font: inherit;\n color: inherit;\n text-align: left;\n cursor: pointer;\n}\n\n.combobox:disabled {\n cursor: not-allowed;\n}\n\n.combobox[aria-readonly='true'] {\n cursor: default;\n}\n\n.srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.chips {\n position: relative;\n display: flex;\n flex: 1;\n flex-wrap: wrap;\n gap: var(--space-4);\n min-width: 0;\n pointer-events: none;\n}\n\n.chip {\n display: inline-flex;\n align-items: center;\n gap: var(--space-4);\n max-width: 100%;\n padding: var(--space-2) var(--space-6);\n background: var(--color-bg-subtle);\n border-radius: var(--radius-sm);\n font: var(--font-label-s);\n color: var(--color-text-primary);\n pointer-events: auto;\n}\n\n.chips[aria-disabled='true'] .chip {\n color: var(--color-text-disabled);\n}\n\n.chipRemove,\n.clear {\n display: inline-flex;\n flex-shrink: 0;\n padding: 0;\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--color-icon-secondary);\n cursor: pointer;\n}\n\n.chipRemove:hover,\n.clear:hover {\n color: var(--color-icon-primary);\n}\n\n.chipRemove:focus-visible,\n.clear:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.end {\n position: relative;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--space-8);\n pointer-events: none;\n}\n\n.end .clear {\n pointer-events: auto;\n}\n\n.check {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n}\n\n.checkOn {\n background: var(--color-control-on);\n border-color: var(--color-control-on);\n color: var(--color-icon-on-accent);\n}\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport { LockedTag } from '../Input/LockedTagInternal';\nimport { Menu, MenuItem, usePopup } from '../Menu';\nimport type { SelectOption } from '../Select';\nimport selectStyles from '../Select/Select.module.css';\nimport { findEnabled, isPrintableKey, nextIndexForKey, optionId, typeAheadIndex, useListbox } from '../Select/useListbox';\nimport styles from './MultiSelect.module.css';\n\nconst SELECT_ALL = '\\u0000select-all';\n\ntype CheckState = 'on' | 'off' | 'mixed';\nconst checkIcons: Record<CheckState, IconName | null> = { on: 'check', mixed: 'minus', off: null };\n\nfunction RowCheck({ state }: { state: CheckState }) {\n const icon = checkIcons[state];\n return (\n <span className={cx(styles.check, state !== 'off' && styles.checkOn)} data-check={state}>\n {icon && <Icon name={icon} size={12} />}\n </span>\n );\n}\n\nexport interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {\n /** The options to choose from. */\n options: SelectOption[];\n /** The chosen values, when controlled. */\n value?: string[];\n /** The first chosen values, when uncontrolled. */\n defaultValue?: string[];\n /** Called with all chosen values whenever they change. */\n onChange?: (value: string[]) => void;\n /** Called when the clear button is used. Passing this shows the clear button while there are values. */\n onClear?: () => void;\n /** Text shown when nothing is chosen. */\n placeholder?: string;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Stops all interaction. */\n disabled?: boolean;\n /** Read-only look with a \"Locked\" tag. It can be focused but not opened. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** How many chips to show before the \"+N\" overflow. */\n maxVisible?: number;\n /** Adds a filter box at the top of the popup. */\n searchable?: boolean;\n /** Label of the select-all row. The row appears when this is set, and shows a mixed state for a partial selection. */\n selectAllLabel?: string;\n /** Accessible name and placeholder of the filter box. */\n filterLabel?: string;\n /** Text shown when the filter matches nothing. */\n emptyLabel?: string;\n /** Accessible name of the clear button. */\n clearLabel?: string;\n /** Builds the accessible name of a chip's remove button. */\n removeLabel?: (label: string) => string;\n /** Form field name. Each chosen value is submitted under it. */\n name?: string;\n}\n\n/** Multi select dropdown. Chosen values appear as removable chips, and the popup stays open while selecting. */\nexport const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(function MultiSelect(\n {\n options,\n value,\n defaultValue = [],\n onChange,\n onClear,\n placeholder = 'Select options',\n invalid,\n disabled,\n locked,\n required,\n maxVisible = 3,\n searchable = false,\n selectAllLabel,\n filterLabel = 'Filter options',\n emptyLabel = 'No matches',\n clearLabel = 'Clear selection',\n removeLabel = (label) => `Remove ${label}`,\n name,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({\n id,\n invalid,\n disabled,\n locked,\n required,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n });\n const [open, setOpen] = useState(false);\n const [innerValue, setInnerValue] = useState(defaultValue);\n const current = value ?? innerValue;\n\n const { query, setQuery, activeIndex, setActiveIndex, filtered, typed } = useListbox(options);\n const enabledValues = filtered.filter((option) => !option.disabled).map((option) => option.value);\n const chosenCount = enabledValues.filter((item) => current.includes(item)).length;\n const selectAllState: CheckState = chosenCount === 0 ? 'off' : chosenCount === enabledValues.length ? 'on' : 'mixed';\n const showSelectAll = Boolean(selectAllLabel) && enabledValues.length > 0;\n const rows: SelectOption[] = showSelectAll ? [{ value: SELECT_ALL, label: selectAllLabel as string }, ...filtered] : filtered;\n\n const listId = `${useId()}-listbox`;\n const close = useCallback(() => setOpen(false), []);\n const { triggerRef, popupRef, popupStyle } = usePopup<HTMLDivElement>({ open, onClose: close, matchTriggerWidth: true });\n const comboboxRef = useRef<HTMLButtonElement>(null);\n useImperativeHandle(ref, () => comboboxRef.current as HTMLButtonElement, []);\n const filterRef = useRef<HTMLInputElement>(null);\n\n // The filter box takes focus while the popup is open, and focus comes back when it closes.\n useEffect(() => {\n if (!open || !searchable) return;\n const combobox = comboboxRef.current;\n filterRef.current?.focus();\n return () => combobox?.focus();\n }, [open, searchable]);\n\n useEffect(() => {\n if (open && activeIndex >= 0) document.getElementById(optionId(listId, activeIndex) ?? '')?.scrollIntoView({ block: 'nearest' });\n }, [activeIndex, listId, open]);\n\n const update = (next: string[]) => {\n if (value === undefined) setInnerValue(next);\n onChange?.(next);\n };\n\n const remove = (item: string) => update(current.filter((entry) => entry !== item));\n\n const toggleRow = (row: SelectOption | undefined) => {\n if (!row || row.disabled) return;\n if (row.value === SELECT_ALL) {\n const rest = current.filter((entry) => !enabledValues.includes(entry));\n update(selectAllState === 'on' ? rest : [...rest, ...enabledValues]);\n } else if (current.includes(row.value)) {\n remove(row.value);\n } else {\n update([...current, row.value]);\n }\n };\n\n const openPopup = (index?: number) => {\n setQuery('');\n setActiveIndex(index ?? findEnabled(selectAllLabel ? [{ value: SELECT_ALL, label: selectAllLabel }, ...options] : options, 0, 1));\n setOpen(true);\n };\n\n const onListKeyDown = (event: KeyboardEvent<HTMLElement>, isFilter: boolean) => {\n const next = nextIndexForKey(event.key, rows, activeIndex);\n // In the filter box, Home and End move the text cursor.\n if (next !== null && !(isFilter && (event.key === 'Home' || event.key === 'End'))) {\n event.preventDefault();\n if (next >= 0) setActiveIndex(next);\n } else if (event.key === 'Enter' || (event.key === ' ' && !isFilter)) {\n event.preventDefault();\n toggleRow(rows[activeIndex]);\n } else if (event.key === 'Backspace' && !query && current.length > 0) {\n event.preventDefault();\n remove(current[current.length - 1]);\n } else if (event.key === 'Tab') {\n close();\n } else if (!isFilter && isPrintableKey(event)) {\n const match = typeAheadIndex(rows, activeIndex, event.key, typed.current, event.timeStamp);\n if (match >= 0) setActiveIndex(match);\n }\n };\n\n const onComboboxKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (field.locked) return;\n if (open) {\n onListKeyDown(event, false);\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n openPopup();\n } else if (event.key === 'Backspace' && current.length > 0) {\n event.preventDefault();\n remove(current[current.length - 1]);\n }\n };\n\n const labelFor = (item: string) => options.find((option) => option.value === item)?.label ?? item;\n const visible = current.slice(0, maxVisible);\n const overflow = current.length - visible.length;\n const editable = !field.disabled && !field.locked;\n const showClear = Boolean(onClear) && editable && current.length > 0;\n\n return (\n <>\n <div\n ref={triggerRef}\n className={cx(\n control.control,\n styles.trigger,\n open && styles.open,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n {...props}\n >\n <button\n ref={comboboxRef}\n id={field.id}\n type=\"button\"\n role=\"combobox\"\n className={styles.combobox}\n disabled={field.disabled}\n aria-label={ariaLabel}\n aria-labelledby={field.labelledBy}\n aria-describedby={field.describedBy}\n aria-invalid={field.invalid || undefined}\n aria-required={field.required || undefined}\n aria-readonly={field.locked || undefined}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-activedescendant={open && !searchable ? optionId(listId, activeIndex) : undefined}\n onClick={() => {\n if (field.locked) return;\n if (open) close();\n else openPopup();\n }}\n onKeyDown={onComboboxKeyDown}\n >\n {current.length === 0 ? (\n <span className={cx(!field.disabled && selectStyles.placeholder)}>{placeholder}</span>\n ) : (\n <span className={styles.srOnly}>{current.map(labelFor).join(', ')}</span>\n )}\n </button>\n <div className={styles.chips} aria-disabled={field.disabled || undefined}>\n {visible.map((item) => (\n <span key={item} className={styles.chip}>\n {labelFor(item)}\n {editable && (\n <button\n type=\"button\"\n className={styles.chipRemove}\n aria-label={removeLabel(labelFor(item))}\n onClick={() => {\n remove(item);\n comboboxRef.current?.focus();\n }}\n >\n <Icon name=\"x\" size={12} />\n </button>\n )}\n </span>\n ))}\n {overflow > 0 && <span className={styles.chip}>+{overflow}</span>}\n </div>\n <div className={styles.end}>\n {showClear && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={clearLabel}\n onClick={() => {\n update([]);\n onClear?.();\n comboboxRef.current?.focus();\n }}\n >\n <Icon name=\"x\" />\n </button>\n )}\n {field.locked ? <LockedTag /> : <Icon name=\"chevron-down\" className={control.icon} />}\n </div>\n </div>\n {name && current.map((item) => <input key={item} type=\"hidden\" name={name} value={item} disabled={field.disabled} />)}\n {open &&\n createPortal(\n <Menu\n ref={popupRef}\n style={popupStyle}\n className={selectStyles.popup}\n onMouseDown={(event) => {\n // Keeps focus where it is when a row is pressed. The filter box still needs its own text selection.\n if (!(event.target instanceof HTMLInputElement)) event.preventDefault();\n }}\n >\n {searchable && (\n <div className={selectStyles.filter}>\n <Icon name=\"search\" className={control.icon} />\n <input\n ref={filterRef}\n type=\"text\"\n role=\"combobox\"\n className={control.field}\n value={query}\n placeholder={filterLabel}\n aria-label={filterLabel}\n aria-autocomplete=\"list\"\n aria-expanded\n aria-controls={listId}\n aria-activedescendant={optionId(listId, activeIndex)}\n onChange={(event) => {\n setQuery(event.target.value);\n setActiveIndex(-1);\n }}\n onKeyDown={(event) => onListKeyDown(event, true)}\n />\n </div>\n )}\n <div\n id={listId}\n role=\"listbox\"\n aria-multiselectable\n className={selectStyles.list}\n aria-label={ariaLabel}\n aria-labelledby={field.labelledBy}\n >\n {rows.map((row, index) => {\n const isSelectAll = row.value === SELECT_ALL;\n const state: CheckState = isSelectAll ? selectAllState : current.includes(row.value) ? 'on' : 'off';\n return (\n <MenuItem\n key={row.value}\n id={optionId(listId, index)}\n role=\"option\"\n aria-selected={state === 'on'}\n aria-checked={state === 'mixed' ? 'mixed' : state === 'on'}\n leading={<RowCheck state={state} />}\n active={index === activeIndex}\n disabled={row.disabled}\n onClick={() => toggleRow(row)}\n onMouseMove={() => {\n if (!row.disabled && index !== activeIndex) setActiveIndex(index);\n }}\n >\n {row.label}\n </MenuItem>\n );\n })}\n </div>\n {filtered.length === 0 && (\n <div role=\"status\" className={selectStyles.empty}>\n {emptyLabel}\n </div>\n )}\n </Menu>,\n document.body,\n )}\n </>\n );\n});\n",".group {\n display: flex;\n flex-direction: column;\n gap: var(--space-4);\n}\n\n.heading {\n padding: var(--space-4) var(--space-10);\n color: var(--color-text-tertiary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.toggle {\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n width: 100%;\n border: none;\n border-radius: var(--radius-sm);\n background: transparent;\n cursor: pointer;\n}\n\n.toggle:hover {\n color: var(--color-text-primary);\n}\n\n.toggle:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.items {\n display: flex;\n flex-direction: column;\n}\n\n.items[hidden] {\n display: none;\n}\n","import { forwardRef, useId, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './NavGroup.module.css';\n\nexport interface NavGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Overline heading, which also names the group. Without it the items simply sit together. */\n label?: string;\n /** Makes the heading a button that shows and hides the items. Needs a `label`. */\n collapsible?: boolean;\n /** Whether the items are showing, when controlled. */\n expanded?: boolean;\n /** Whether the items first show, when uncontrolled. */\n defaultExpanded?: boolean;\n /** Called with the new state when the heading is pressed. */\n onExpandedChange?: (expanded: boolean) => void;\n /** The NavItems of this group. */\n children: ReactNode;\n}\n\n/** A labelled group of nav items, optionally collapsible. */\nexport const NavGroup = forwardRef<HTMLDivElement, NavGroupProps>(function NavGroup(\n { label, collapsible = false, expanded, defaultExpanded = true, onExpandedChange, className, children, ...props },\n ref,\n) {\n const id = useId();\n const [innerExpanded, setInnerExpanded] = useState(defaultExpanded);\n const isCollapsible = collapsible && label !== undefined;\n const open = !isCollapsible || (expanded ?? innerExpanded);\n const headingId = `${id}-heading`;\n const itemsId = `${id}-items`;\n\n return (\n <div\n ref={ref}\n className={cx(styles.group, className)}\n role={label ? 'group' : undefined}\n aria-labelledby={label ? headingId : undefined}\n {...props}\n >\n {isCollapsible ? (\n <button\n id={headingId}\n type=\"button\"\n className={cx(styles.heading, styles.toggle)}\n aria-expanded={open}\n aria-controls={itemsId}\n onClick={() => {\n setInnerExpanded(!open);\n onExpandedChange?.(!open);\n }}\n >\n {label}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} size={14} />\n </button>\n ) : (\n label && (\n <div id={headingId} className={styles.heading}>\n {label}\n </div>\n )\n )}\n <div id={itemsId} className={styles.items} hidden={!open}>\n {children}\n </div>\n </div>\n );\n});\n",".item {\n position: relative;\n display: flex;\n align-items: center;\n gap: var(--space-10);\n box-sizing: border-box;\n width: 100%;\n min-height: 34px;\n padding: var(--space-0) var(--space-10);\n border: var(--stroke-hairline) solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--color-text-secondary);\n font: var(--font-label-m);\n text-align: left;\n text-decoration: none;\n cursor: pointer;\n}\n\n.item:hover,\n.item[data-state='hover'] {\n background: var(--color-bg-hover);\n color: var(--color-text-primary);\n}\n\n.item:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.icon {\n flex: none;\n}\n\n.iconSlot {\n flex: none;\n width: 16px;\n}\n\n.label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.trailing {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--space-8);\n}\n\n.count {\n color: var(--color-text-tertiary);\n font: var(--font-mono-s);\n}\n\n.active,\n.active:hover {\n border-color: var(--color-border-subtle);\n background: var(--color-bg-surface);\n box-shadow: var(--elevation-card);\n color: var(--color-text-primary);\n}\n\n.active::before {\n position: absolute;\n top: 50%;\n left: 0;\n width: 2px;\n height: 16px;\n background: var(--color-bg-accent);\n content: '';\n transform: translateY(-50%);\n}\n\n.child.active,\n.child.active:hover {\n border-color: transparent;\n background: var(--color-bg-subtle);\n box-shadow: none;\n}\n\n.disabled,\n.disabled:hover {\n background: transparent;\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n/* Tertiary text is under 4.5:1 on the hover and subtle backgrounds. */\n.item:hover .count,\n.item[data-state='hover'] .count,\n.child.active .count {\n color: var(--color-text-secondary);\n}\n\n.disabled .count,\n.disabled:hover .count {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode, type Ref } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './NavItem.module.css';\n\nexport interface NavItemProps extends HTMLAttributes<HTMLElement> {\n /** The label of the row. */\n children: ReactNode;\n /** Icon before the label. */\n icon?: IconName;\n /** Number shown at the end of the row. */\n count?: number;\n /** Marks the current location with the orange bar and `aria-current=\"page\"`. Use on one item per navigation column. */\n active?: boolean;\n /** Blocks the item and shows a lock, for a place the user is not allowed to open. */\n disabled?: boolean;\n /** Indents the row under its parent item. */\n child?: boolean;\n /** Shows a chevron, because this item opens a list of child items. */\n hasChildren?: boolean;\n /** Whether the child items are showing. Only used with `hasChildren`. */\n expanded?: boolean;\n /** Renders an anchor to this address. Without it the item is a button. */\n href?: string;\n /** Where an anchor opens. */\n target?: string;\n /** Relationship of an anchor to its target. */\n rel?: string;\n}\n\n/** A row in the sidebar. The orange bar marks the current location. */\nexport const NavItem = forwardRef<HTMLAnchorElement | HTMLButtonElement, NavItemProps>(function NavItem(\n {\n children,\n icon,\n count,\n active = false,\n disabled = false,\n child = false,\n hasChildren = false,\n expanded = false,\n href,\n target,\n rel,\n onClick,\n className,\n ...props\n },\n ref,\n) {\n const shared = {\n className: cx(styles.item, active && styles.active, disabled && styles.disabled, child && styles.child, className),\n 'aria-current': active ? ('page' as const) : undefined,\n 'aria-expanded': hasChildren ? expanded : undefined,\n };\n const content = (\n <>\n {icon ? <Icon name={icon} className={styles.icon} /> : child && <span className={styles.iconSlot} />}\n <span className={styles.label}>{children}</span>\n {(count !== undefined || hasChildren || disabled) && (\n <span className={styles.trailing}>\n {count !== undefined && <span className={styles.count}>{count}</span>}\n {hasChildren && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} className={styles.icon} />}\n {disabled && <Icon name=\"lock\" className={styles.icon} />}\n </span>\n )}\n </>\n );\n\n if (href !== undefined) {\n // An anchor without href has no implicit role and cannot take focus, so a disabled item keeps its role explicitly.\n const behaviour = disabled ? ({ role: 'link', 'aria-disabled': true } as const) : { href, target, rel, onClick };\n return (\n <a ref={ref as Ref<HTMLAnchorElement>} {...shared} {...props} {...behaviour}>\n {content}\n </a>\n );\n }\n return (\n <button ref={ref as Ref<HTMLButtonElement>} type=\"button\" disabled={disabled} onClick={onClick} {...shared} {...props}>\n {content}\n </button>\n );\n});\n",".node {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n box-sizing: border-box;\n width: 146px;\n height: 32px;\n padding: var(--space-0) var(--space-12) var(--space-0) var(--space-10);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-md);\n background: var(--color-bg-surface);\n color: var(--color-text-primary);\n}\n\n.icon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n\n.name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n font: var(--font-label-s);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dot {\n flex: none;\n width: 8px;\n height: 8px;\n border-radius: var(--radius-full);\n}\n\n.healthy {\n background: var(--color-status-success);\n}\n\n.degraded {\n background: var(--color-status-warning);\n}\n\n.offline {\n background: var(--color-status-danger);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './GraphNode.module.css';\n\nexport type GraphNodeHealth = 'healthy' | 'degraded' | 'offline';\n\nexport interface GraphNodeProps extends HTMLAttributes<HTMLDivElement> {\n /** Name of the system. */\n name: string;\n /** How the system is doing. Sets the dot colour and is part of the accessible name. */\n health?: GraphNodeHealth;\n /** Word for the health, in place of the default. */\n healthLabel?: string;\n /** Icon for the kind of system. */\n icon?: IconName;\n}\n\nconst HEALTH_LABELS: Record<GraphNodeHealth, string> = { healthy: 'Healthy', degraded: 'Degraded', offline: 'Offline' };\n\n/** One system in a node graph: its name and a health dot. The health is in the accessible name and in the hover title. */\nexport const GraphNode = forwardRef<HTMLDivElement, GraphNodeProps>(function GraphNode(\n { name, health = 'healthy', healthLabel, icon = 'database', className, ...props },\n ref,\n) {\n const healthText = healthLabel ?? HEALTH_LABELS[health];\n return (\n <div ref={ref} role=\"img\" aria-label={`${name}, ${healthText}`} title={healthText} className={cx(styles.node, className)} {...props}>\n <Icon name={icon} size={16} className={styles.icon} />\n <span className={styles.name}>{name}</span>\n <span className={cx(styles.dot, styles[health])} aria-hidden=\"true\" />\n </div>\n );\n});\n",".viewport {\n border-radius: var(--radius-sm);\n}\n\n.scrolls {\n overflow-x: auto;\n}\n\n.viewport:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.canvas {\n position: relative;\n}\n\n.edge {\n fill: none;\n stroke: var(--color-border-default);\n stroke-width: var(--stroke-hairline);\n}\n\n.edgeOffline {\n stroke: var(--color-border-danger);\n}\n\n.nodes {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.position {\n position: absolute;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { ChartDataTable, ChartFrame, chartMarks, clamp, useChartSize } from '../ChartCore';\nimport { GraphNode, type GraphNodeHealth } from './GraphNode';\nimport styles from './NodeGraph.module.css';\n\n/** A system in the graph. */\nexport interface NodeGraphNode {\n /** Stable identifier, used by edges. */\n id: string;\n /** Name of the system. */\n label: string;\n /** How the system is doing. */\n health: GraphNodeHealth;\n /** Left position in pixels at full size. */\n x: number;\n /** Top position in pixels. */\n y: number;\n}\n\n/** A connection between two systems. */\nexport interface NodeGraphEdge {\n /** Id of the node the connection starts from. */\n from: string;\n /** Id of the node the connection goes to. An offline target draws the edge in the danger colour. */\n to: string;\n}\n\nexport interface NodeGraphProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The systems, with their positions. */\n nodes: readonly NodeGraphNode[];\n /** The connections between them. */\n edges: readonly NodeGraphEdge[];\n /** Accessible name of the graph. Say what it shows. */\n 'aria-label'?: string;\n /** Shown in place of the graph when there are no nodes. */\n emptyMessage?: ReactNode;\n}\n\nconst NODE_WIDTH = 146;\nconst NODE_HEIGHT = 32;\n/** The columns can tighten this far before the graph scrolls instead. */\nconst MIN_SCALE = 0.72;\n\n/** The graph is a group of nodes. It takes focus only when it has to scroll, so that keyboard users can reach the scroll. */\nconst VIEWPORT_ROLE = 'group';\n\n/** Shows how systems connect, such as a topology. Edges to an offline node are drawn in the danger colour. */\nexport const NodeGraph = forwardRef<HTMLDivElement, NodeGraphProps>(function NodeGraph(\n { nodes, edges, 'aria-label': ariaLabel = 'Node graph', emptyMessage, className, ...props },\n ref,\n) {\n const { ref: sizeRef, width } = useChartSize(ref);\n const rightmost = Math.max(0, ...nodes.map((node) => node.x));\n const height = Math.max(0, ...nodes.map((node) => node.y)) + NODE_HEIGHT + 24;\n const naturalWidth = rightmost + NODE_WIDTH;\n const scale = width > 0 && rightmost > 0 ? clamp((width - NODE_WIDTH) / rightmost, MIN_SCALE, 1) : 1;\n const contentWidth = rightmost * scale + NODE_WIDTH;\n const scrolls = width > 0 && contentWidth > width;\n const left = (node: NodeGraphNode) => node.x * scale;\n const byId = new Map(nodes.map((node) => [node.id, node]));\n\n return (\n <ChartFrame ref={sizeRef} height={height} empty={nodes.length === 0} emptyMessage={emptyMessage} className={className} {...props}>\n <div\n role={VIEWPORT_ROLE}\n aria-label={ariaLabel}\n className={cx(styles.viewport, scrolls && styles.scrolls)}\n tabIndex={scrolls ? 0 : undefined}\n >\n <div className={styles.canvas} style={{ width: Math.max(contentWidth, Math.min(width, naturalWidth)), height }}>\n <svg className={chartMarks.svg} width={contentWidth} height={height} aria-hidden=\"true\">\n {edges.map((edge) => {\n const from = byId.get(edge.from);\n const to = byId.get(edge.to);\n if (!from || !to) return null;\n const x1 = left(from) + NODE_WIDTH;\n // The half pixel keeps a straight 1 px edge on one row of pixels rather than blurred across two.\n const y1 = from.y + NODE_HEIGHT / 2 + 0.5;\n const x2 = left(to);\n const y2 = to.y + NODE_HEIGHT / 2 + 0.5;\n const mid = (x1 + x2) / 2;\n return (\n <path\n key={`${edge.from}-${edge.to}`}\n className={cx(styles.edge, to.health === 'offline' && styles.edgeOffline)}\n d={`M${x1} ${y1}C${mid} ${y1} ${mid} ${y2} ${x2} ${y2}`}\n />\n );\n })}\n </svg>\n <ul className={styles.nodes}>\n {nodes.map((node) => (\n <li key={node.id} className={styles.position} style={{ left: left(node), top: node.y }}>\n <GraphNode name={node.label} health={node.health} />\n </li>\n ))}\n </ul>\n </div>\n </div>\n <ChartDataTable\n caption={`${ariaLabel}: connections`}\n columns={['From', 'To', 'Health of target']}\n rows={edges.map((edge) => ({\n id: `${edge.from}-${edge.to}`,\n header: byId.get(edge.from)?.label ?? edge.from,\n cells: [byId.get(edge.to)?.label ?? edge.to, byId.get(edge.to)?.health ?? ''],\n }))}\n />\n </ChartFrame>\n );\n});\n",".reference {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n}\n\n.dot {\n flex: none;\n width: 8px;\n height: 8px;\n border-radius: var(--radius-full);\n}\n\n.name {\n color: var(--color-text-primary);\n font: var(--font-mono-m);\n}\n\n.health {\n font: var(--font-caption);\n}\n\n.healthy .dot {\n background: var(--color-status-success);\n}\n\n.degraded .dot {\n background: var(--color-status-warning);\n}\n\n.degraded .health {\n color: var(--color-text-warning);\n}\n\n.offline .dot {\n background: var(--color-status-danger);\n}\n\n.offline .health {\n color: var(--color-text-danger);\n}\n\n.maintenance .dot {\n background: var(--color-status-neutral);\n}\n\n.maintenance .health {\n color: var(--color-text-secondary);\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './NodeReference.module.css';\n\nexport type NodeReferenceHealth = 'healthy' | 'degraded' | 'offline' | 'maintenance';\n\nexport interface NodeReferenceProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {\n /** The name of the node. */\n name: ReactNode;\n /** The state of the node. */\n health?: NodeReferenceHealth;\n /** The state in words. Defaults to the health. It is only announced for `healthy`, which the design shows as a dot alone. */\n healthLabel?: ReactNode;\n}\n\n/** A compact mention of a node, with its health as a dot and text. */\nexport const NodeReference = forwardRef<HTMLSpanElement, NodeReferenceProps>(function NodeReference(\n { name, health = 'healthy', healthLabel, className, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.reference, styles[health], className)} {...props}>\n <span className={styles.dot} aria-hidden=\"true\" />\n <span className={styles.name}>{name}</span>\n <span className={health === 'healthy' ? styles.visuallyHidden : styles.health}>{healthLabel ?? health}</span>\n </span>\n );\n});\n",".root {\n padding-right: var(--space-4);\n padding-top: var(--space-4);\n padding-bottom: var(--space-4);\n}\n\n.input {\n appearance: textfield;\n padding: var(--space-4) 0;\n}\n\n.input::-webkit-outer-spin-button,\n.input::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n}\n\n.steppers {\n display: inline-flex;\n flex-shrink: 0;\n gap: var(--space-2);\n}\n\n.stepper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--color-icon-primary);\n cursor: pointer;\n}\n\n.stepper:hover:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.stepper:disabled {\n color: var(--color-icon-muted);\n cursor: not-allowed;\n}\n","import { forwardRef, useState, type InputHTMLAttributes, type KeyboardEvent } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport { LockedTag } from '../Input/LockedTagInternal';\nimport styles from './NumberField.module.css';\n\nconst PAGE_MULTIPLIER = 10;\n\nconst decimalsOf = (value: number) => {\n const text = String(value);\n const point = text.indexOf('.');\n return point === -1 ? 0 : text.length - point - 1;\n};\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'\n> {\n /** The number, when controlled. `null` means empty. */\n value?: number | null;\n /** The first number, when uncontrolled. */\n defaultValue?: number | null;\n /** Called with the new number, or `null` when the box is empty. */\n onChange?: (value: number | null) => void;\n /** The lowest allowed number. */\n min?: number;\n /** The highest allowed number. */\n max?: number;\n /** How far the steppers and arrow keys move. */\n step?: number;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag, for values set by staff. */\n locked?: boolean;\n /** Accessible name of the decrease button. */\n decreaseLabel?: string;\n /** Accessible name of the increase button. */\n increaseLabel?: string;\n}\n\n/**\n * A number input styled like Input, with stepper buttons. Arrow keys move by `step`, Page Up and Page Down move\n * by ten steps, and Home and End go to `min` and `max`. Steppers stay out of the tab order because the arrow keys do the same job.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n step = 1,\n invalid,\n locked,\n disabled,\n required,\n id,\n readOnly,\n decreaseLabel = 'Decrease',\n increaseLabel = 'Increase',\n className,\n onKeyDown,\n onBlur,\n 'aria-describedby': describedBy,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({ id, invalid, disabled, locked, required, 'aria-describedby': describedBy });\n const [innerValue, setInnerValue] = useState<number | null>(defaultValue);\n const current = value !== undefined ? value : innerValue;\n const inert = field.disabled || field.locked || Boolean(readOnly);\n\n const clamp = (next: number) => Math.min(Math.max(next, min ?? -Infinity), max ?? Infinity);\n\n const commit = (next: number | null) => {\n if (next === current) return;\n if (value === undefined) setInnerValue(next);\n onChange?.(next);\n };\n\n const stepBy = (steps: number) => {\n if (current === null) {\n commit(clamp(min ?? 0));\n return;\n }\n const decimals = Math.max(decimalsOf(step), decimalsOf(current));\n commit(clamp(Number((current + steps * step).toFixed(decimals))));\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || inert) return;\n const steps: Record<string, number> = { ArrowUp: 1, ArrowDown: -1, PageUp: PAGE_MULTIPLIER, PageDown: -PAGE_MULTIPLIER };\n if (event.key in steps) {\n event.preventDefault();\n stepBy(steps[event.key]);\n } else if (event.key === 'Home' && min !== undefined) {\n event.preventDefault();\n commit(min);\n } else if (event.key === 'End' && max !== undefined) {\n event.preventDefault();\n commit(max);\n }\n };\n\n return (\n <div\n className={cx(\n control.control,\n styles.root,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n >\n <input\n ref={ref}\n id={field.id}\n type=\"number\"\n className={cx(control.field, styles.input)}\n value={current ?? ''}\n min={min}\n max={max}\n step={step}\n disabled={field.disabled}\n required={field.required}\n readOnly={field.locked || readOnly}\n aria-invalid={field.invalid || undefined}\n aria-describedby={field.describedBy}\n onChange={(event) => {\n const next = event.target.valueAsNumber;\n commit(Number.isNaN(next) ? null : next);\n }}\n onKeyDown={handleKeyDown}\n onBlur={(event) => {\n onBlur?.(event);\n if (current !== null && !inert) commit(clamp(current));\n }}\n {...props}\n />\n {field.locked && <LockedTag />}\n {!field.locked && (\n <span className={styles.steppers}>\n <button\n type=\"button\"\n tabIndex={-1}\n className={styles.stepper}\n aria-label={decreaseLabel}\n disabled={inert || (current !== null && min !== undefined && current <= min)}\n onClick={() => stepBy(-1)}\n >\n <Icon name=\"minus\" />\n </button>\n <button\n type=\"button\"\n tabIndex={-1}\n className={styles.stepper}\n aria-label={increaseLabel}\n disabled={inert || (current !== null && max !== undefined && current >= max)}\n onClick={() => stepBy(1)}\n >\n <Icon name=\"plus\" />\n </button>\n </span>\n )}\n </div>\n );\n});\n",".pageHeader {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--space-24);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: var(--space-4);\n min-width: 0;\n}\n\n.overline {\n color: var(--color-text-tertiary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.titleRow {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-12);\n}\n\n.title {\n margin: var(--space-0);\n color: var(--color-text-primary);\n font: var(--font-heading-l);\n letter-spacing: var(--tracking-heading-l);\n}\n\n.docs {\n padding: var(--space-2) var(--space-8);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-full);\n}\n\n.description {\n margin: var(--space-0);\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n\n.actions {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--space-8);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Link } from '../Link';\nimport styles from './PageHeader.module.css';\n\nexport type PageHeaderHeadingLevel = 1 | 2 | 3;\n\nexport interface PageHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The page title. */\n title: ReactNode;\n /** Small uppercase line above the title, such as the parent project. */\n overline?: ReactNode;\n /** One or two lines below the title. */\n description?: ReactNode;\n /** Address of the documentation. Shows the Docs link beside the title. */\n docsHref?: string;\n /** Text of the Docs link. */\n docsLabel?: string;\n /** Buttons at the right of the header. */\n actions?: ReactNode;\n /** Level of the title heading. */\n headingLevel?: PageHeaderHeadingLevel;\n}\n\n/** The title block at the top of a page. */\nexport const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(function PageHeader(\n { title, overline, description, docsHref, docsLabel = 'Docs', actions, headingLevel = 1, className, ...props },\n ref,\n) {\n const Heading = `h${headingLevel}` as const;\n return (\n <div ref={ref} className={cx(styles.pageHeader, className)} {...props}>\n <div className={styles.text}>\n {overline && <div className={styles.overline}>{overline}</div>}\n <div className={styles.titleRow}>\n <Heading className={styles.title}>{title}</Heading>\n {docsHref && (\n <Link external tone=\"muted\" size=\"sm\" href={docsHref} className={styles.docs}>\n {docsLabel}\n </Link>\n )}\n </div>\n {description && <p className={styles.description}>{description}</p>}\n </div>\n {actions && <div className={styles.actions}>{actions}</div>}\n </div>\n );\n});\n",".item {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n width: 100%;\n padding: var(--space-8) var(--space-12);\n background: transparent;\n border: none;\n border-radius: var(--radius-md);\n font-family: inherit;\n text-align: left;\n cursor: pointer;\n}\n\n/* data-state='hover' lets a story show the hover state without a pointer. */\n.item:hover:not(:disabled),\n.item[data-state='hover']:not(:disabled) {\n background: var(--color-bg-hover);\n}\n\n.item:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.item:disabled {\n cursor: not-allowed;\n}\n\n.tile {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-md);\n color: var(--color-text-secondary);\n font: var(--font-label-s);\n}\n\n.item[data-state='hover'] .tile,\n.item:hover:not(:disabled) .tile {\n background: var(--color-bg-pressed);\n}\n\n.item:disabled .tile {\n color: var(--color-text-disabled);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.description {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.item:disabled .title,\n.item:disabled .description {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './PickerItem.module.css';\n\nexport interface PickerItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Icon in the tile. */\n icon?: IconName;\n /** A letter in the tile, when there is no icon. */\n glyph?: ReactNode;\n /** The name of the choice. */\n title: ReactNode;\n /** What the choice gives you. */\n description?: ReactNode;\n}\n\n/** One choice in a picker, such as a type of block to add. */\nexport const PickerItem = forwardRef<HTMLButtonElement, PickerItemProps>(function PickerItem(\n { icon, glyph, title, description, className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.item, className)} {...props}>\n {(icon || glyph) && <span className={styles.tile}>{icon ? <Icon name={icon} /> : glyph}</span>}\n <span className={styles.text}>\n <span className={styles.title}>{title}</span>\n {description && <span className={styles.description}>{description}</span>}\n </span>\n </button>\n );\n});\n","import { cloneElement, useLayoutEffect, type HTMLAttributes, type ReactElement, type RefObject } from 'react';\n\nexport type AnchoredPlacement = 'top' | 'bottom' | 'left' | 'right';\n\nconst OPPOSITE: Record<AnchoredPlacement, AnchoredPlacement> = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' };\n/** Keeps floating panels this far from the viewport edge. */\nconst VIEWPORT_MARGIN = 8;\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(value, Math.max(min, max)));\n\n/** Renders the one trigger element with extra props merged in. */\nexport function TriggerSlot({ element, ...props }: HTMLAttributes<HTMLElement> & { element: ReactElement<HTMLAttributes<HTMLElement>> }) {\n return cloneElement(element, props);\n}\n\n/**\n * Keeps a `position: fixed` element next to its anchor while open, following scroll and resize.\n * Flips to the opposite side when the requested one doesn't fit. Writes `top` and `left`, the resolved\n * side as `data-placement`, and the anchor's centre along the shared edge as `--arrow-offset`.\n * `getAnchor` must be stable.\n */\nexport function useAnchoredPosition(\n open: boolean,\n getAnchor: () => HTMLElement | null,\n floatingRef: RefObject<HTMLElement | null>,\n placement: AnchoredPlacement,\n gap: number,\n) {\n useLayoutEffect(() => {\n if (!open) return;\n\n const update = () => {\n const anchor = getAnchor();\n const floating = floatingRef.current;\n if (!anchor || !floating) return;\n\n const rect = anchor.getBoundingClientRect();\n const width = floating.offsetWidth;\n const height = floating.offsetHeight;\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = window.innerHeight;\n\n const fits: Record<AnchoredPlacement, boolean> = {\n top: rect.top - gap - height >= VIEWPORT_MARGIN,\n bottom: rect.bottom + gap + height <= viewportHeight - VIEWPORT_MARGIN,\n left: rect.left - gap - width >= VIEWPORT_MARGIN,\n right: rect.right + gap + width <= viewportWidth - VIEWPORT_MARGIN,\n };\n const side = fits[placement] || !fits[OPPOSITE[placement]] ? placement : OPPOSITE[placement];\n\n const positions: Record<AnchoredPlacement, { top: number; left: number }> = {\n top: { top: rect.top - gap - height, left: rect.left + rect.width / 2 - width / 2 },\n bottom: { top: rect.bottom + gap, left: rect.left + rect.width / 2 - width / 2 },\n left: { top: rect.top + rect.height / 2 - height / 2, left: rect.left - gap - width },\n right: { top: rect.top + rect.height / 2 - height / 2, left: rect.right + gap },\n };\n const top = clamp(positions[side].top, VIEWPORT_MARGIN, viewportHeight - height - VIEWPORT_MARGIN);\n const left = clamp(positions[side].left, VIEWPORT_MARGIN, viewportWidth - width - VIEWPORT_MARGIN);\n const arrowOffset = side === 'top' || side === 'bottom' ? rect.left + rect.width / 2 - left : rect.top + rect.height / 2 - top;\n\n floating.style.top = `${top}px`;\n floating.style.left = `${left}px`;\n floating.style.setProperty('--arrow-offset', `${arrowOffset}px`);\n floating.dataset.placement = side;\n };\n\n update();\n window.addEventListener('resize', update);\n window.addEventListener('scroll', update, true);\n return () => {\n window.removeEventListener('resize', update);\n window.removeEventListener('scroll', update, true);\n };\n }, [open, getAnchor, floatingRef, placement, gap]);\n}\n",".popover {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1100;\n width: max-content;\n max-width: 320px;\n padding: var(--space-16);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n.popover:focus-visible {\n outline: none;\n}\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport { getFocusableElements } from '../Dialog';\nimport { TriggerSlot, useAnchoredPosition, type AnchoredPlacement } from '../Tooltip/useAnchoredPosition';\nimport styles from './Popover.module.css';\n\nexport type PopoverPlacement = AnchoredPlacement;\n\n/** Distance from the trigger. */\nconst GAP = 8;\n\nexport interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {\n /** The one element that opens the popover. It must accept click and ARIA props. */\n trigger: ReactElement<HTMLAttributes<HTMLElement>>;\n /** What the panel shows. */\n content: ReactNode;\n /** Which side of the trigger the panel sits on. It flips if there isn't room. */\n placement?: PopoverPlacement;\n /** Whether the panel is showing. Leave undefined to use `defaultOpen` and let the popover manage itself. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Called when the popover asks to open or close. */\n onOpenChange?: (open: boolean) => void;\n /** Accessible name of the panel. */\n 'aria-label'?: string;\n}\n\n/**\n * An anchored, non-modal panel. Focus moves in on open and returns to the trigger on close.\n * Closes on an outside press, on Escape, and when Tab leaves the panel.\n */\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(function Popover(\n { trigger, content, placement = 'bottom', open, defaultOpen = false, onOpenChange, className, id, ...props },\n ref,\n) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = open ?? internalOpen;\n const generatedTriggerId = useId();\n const generatedPanelId = useId();\n const triggerId = trigger.props.id ?? generatedTriggerId;\n const panelId = id ?? generatedPanelId;\n const panelRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => panelRef.current as HTMLDivElement);\n\n const getAnchor = useCallback(() => document.getElementById(triggerId), [triggerId]);\n useAnchoredPosition(isOpen, getAnchor, panelRef, placement, GAP);\n\n const latestOnOpenChange = useRef(onOpenChange);\n useEffect(() => {\n latestOnOpenChange.current = onOpenChange;\n });\n\n const setOpen = useCallback((next: boolean) => {\n setInternalOpen(next);\n latestOnOpenChange.current?.(next);\n }, []);\n\n useEffect(() => {\n if (!isOpen) return;\n const panel = panelRef.current;\n if (!panel) return;\n\n (getFocusableElements(panel)[0] ?? panel).focus({ preventScroll: true });\n\n const closeAndReturnFocus = () => {\n setOpen(false);\n getAnchor()?.focus();\n };\n\n // Capture, so that a surrounding Dialog sees these keys as handled.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n closeAndReturnFocus();\n } else if (event.key === 'Tab' && panel.contains(document.activeElement)) {\n const focusable = getFocusableElements(panel);\n const edge = event.shiftKey ? focusable[0] : focusable[focusable.length - 1];\n if (!edge || document.activeElement === edge) {\n event.preventDefault();\n closeAndReturnFocus();\n }\n }\n };\n\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (!panel.contains(target) && !getAnchor()?.contains(target)) closeAndReturnFocus();\n };\n\n document.addEventListener('keydown', onKeyDown, true);\n document.addEventListener('pointerdown', onPointerDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown, true);\n document.removeEventListener('pointerdown', onPointerDown);\n };\n }, [isOpen, getAnchor, setOpen]);\n\n const triggerProps = {\n id: triggerId,\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? panelId : undefined,\n onClick: (event: MouseEvent<HTMLElement>) => {\n trigger.props.onClick?.(event);\n setOpen(!isOpen);\n },\n };\n\n return (\n <>\n <TriggerSlot element={trigger} {...triggerProps} />\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={panelId}\n role=\"dialog\"\n tabIndex={-1}\n data-focus-scope=\"\"\n aria-labelledby={props['aria-label'] ? undefined : triggerId}\n className={cx(styles.popover, className)}\n {...props}\n >\n {content}\n </div>,\n document.body,\n )}\n </>\n );\n});\n",".progressBar {\n display: flex;\n flex-direction: column;\n gap: var(--space-6);\n width: 100%;\n}\n\n.header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--space-8);\n}\n\n.label {\n color: var(--color-text-primary);\n font: var(--font-label-s);\n}\n\n.value {\n margin-inline-start: auto;\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.track {\n height: 6px;\n overflow: hidden;\n border-radius: var(--radius-full);\n background: var(--color-chart-track);\n}\n\n.fill {\n height: 100%;\n border-radius: var(--radius-full);\n}\n\n.default {\n background: var(--color-bg-inverse);\n}\n\n.accent {\n background: var(--color-bg-accent);\n}\n\n.warning {\n background: var(--color-status-warning);\n}\n\n.danger {\n background: var(--color-status-danger);\n}\n\n.meta {\n color: var(--color-text-tertiary);\n font: var(--font-caption);\n}\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './ProgressBar.module.css';\n\nexport type ProgressBarTone = 'default' | 'accent' | 'warning' | 'danger';\n\nexport interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {\n /** Progress from 0 to 100. Values outside that range are clamped. */\n value: number;\n /** Fill colour. Use `warning` and `danger` for capacity near its limit, and `accent` only for the main task on the page. */\n tone?: ProgressBarTone;\n /** Visible name. Without it, pass `aria-label`. */\n label?: ReactNode;\n /** Shows the percentage. Defaults to true when there is a `label`. */\n showValue?: boolean;\n /** Helper text below the bar, also exposed as its description. */\n meta?: ReactNode;\n}\n\n/** Shows how much of something is complete or used. */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(function ProgressBar(\n {\n value,\n tone = 'default',\n label,\n showValue = label !== undefined,\n meta,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const id = useId();\n const labelId = `${id}-label`;\n const metaId = `${id}-meta`;\n const clamped = Math.round(Math.min(Math.max(Number.isNaN(value) ? 0 : value, 0), 100));\n\n return (\n <div ref={ref} className={cx(styles.progressBar, className)} {...props}>\n {(label !== undefined || showValue) && (\n <div className={styles.header}>\n {label !== undefined && (\n <span id={labelId} className={styles.label}>\n {label}\n </span>\n )}\n {showValue && <span className={styles.value}>{clamped}%</span>}\n </div>\n )}\n <div\n className={styles.track}\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={clamped}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ?? (label !== undefined ? labelId : undefined)}\n aria-describedby={cx(ariaDescribedBy, meta !== undefined && metaId) || undefined}\n >\n <div className={cx(styles.fill, styles[tone])} style={{ width: `${clamped}%` }} />\n </div>\n {meta !== undefined && (\n <span id={metaId} className={styles.meta}>\n {meta}\n </span>\n )}\n </div>\n );\n});\n",".proposedNote {\n display: flex;\n flex-direction: column;\n gap: var(--space-4);\n padding: var(--space-10) var(--space-14);\n border: var(--stroke-hairline) dashed var(--color-border-default);\n border-radius: var(--radius-sm);\n}\n\n.overline {\n color: var(--color-text-tertiary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.body {\n color: var(--color-text-secondary);\n font: var(--font-body-m);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './ProposedNote.module.css';\n\nexport interface ProposedNoteProps extends HTMLAttributes<HTMLDivElement> {\n /** Short status line above the note, such as what the proposal is waiting for. */\n overline: ReactNode;\n /** The note itself. */\n children?: ReactNode;\n}\n\n/** Marks something as proposed rather than built, and says what it still needs. */\nexport const ProposedNote = forwardRef<HTMLDivElement, ProposedNoteProps>(function ProposedNote(\n { overline, children, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.proposedNote, className)} {...props}>\n <div className={styles.overline}>{overline}</div>\n {children && <div className={styles.body}>{children}</div>}\n </div>\n );\n});\n",".root {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--space-8);\n cursor: pointer;\n}\n\n.control {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n margin-top: var(--space-2);\n}\n\n/* The native input stays on top of the circle, invisible, so it keeps its behaviour and hit area. */\n.input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n}\n\n.circle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-full);\n}\n\n.circle::after {\n content: '';\n display: none;\n width: 8px;\n height: 8px;\n background: var(--color-control-on);\n border-radius: var(--radius-full);\n}\n\n.input:hover + .circle,\n.input[data-state='hover'] + .circle {\n border-color: var(--color-border-strong);\n}\n\n.input:checked + .circle {\n border: var(--stroke-strong) solid var(--color-control-on);\n}\n\n.input:checked + .circle::after {\n display: block;\n}\n\n.input:focus-visible + .circle {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.input:disabled + .circle {\n background: var(--color-control-disabled);\n border-color: var(--color-control-disabled);\n}\n\n.input:disabled + .circle::after {\n background: var(--color-icon-muted);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n}\n\n.label {\n font: var(--font-body-s);\n color: var(--color-text-primary);\n}\n\n.description {\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n\n.disabled {\n cursor: not-allowed;\n}\n\n.disabled .label,\n.disabled .description {\n color: var(--color-text-disabled);\n}\n","import { createContext } from 'react';\n\nexport interface RadioGroupContextValue {\n /** The native group name shared by the radios. */\n name: string;\n /** The chosen value. */\n value?: string;\n /** Disables every radio in the group. */\n disabled: boolean;\n /** Called when a radio is chosen. */\n onChange: (value: string) => void;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n","import { forwardRef, useContext, useId, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Radio.module.css';\nimport { RadioGroupContext } from './RadioGroupContext';\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {\n /** The value this radio stands for. */\n value: string;\n /** The visible label. Leave it out for a bare circle, and give the radio an `aria-label`. */\n label?: ReactNode;\n /** Longer text below the label. */\n description?: ReactNode;\n}\n\n/** One option of a RadioGroup. Built on a native radio, so the browser handles arrow keys within the group. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n {\n value,\n label,\n description,\n disabled,\n checked,\n name,\n onChange,\n className,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const group = useContext(RadioGroupContext);\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const descriptionId = `${baseId}-description`;\n const isDisabled = Boolean(disabled || group?.disabled);\n\n return (\n <label className={cx(styles.root, isDisabled && styles.disabled, className)}>\n <span className={styles.control}>\n <input\n ref={ref}\n type=\"radio\"\n className={styles.input}\n value={value}\n name={group?.name ?? name}\n checked={group ? group.value === value : checked}\n disabled={isDisabled}\n aria-labelledby={ariaLabelledBy ?? (label ? labelId : undefined)}\n aria-describedby={[ariaDescribedBy, description ? descriptionId : undefined].filter(Boolean).join(' ') || undefined}\n onChange={(event) => {\n onChange?.(event);\n group?.onChange(value);\n }}\n {...props}\n />\n <span className={styles.circle} />\n </span>\n {(label || description) && (\n <span className={styles.text}>\n {label && (\n <span id={labelId} className={styles.label}>\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className={styles.description}>\n {description}\n </span>\n )}\n </span>\n )}\n </label>\n );\n});\n",".group {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n}\n\n.label {\n font: var(--font-label-m);\n color: var(--color-text-primary);\n}\n\n.labelDisabled {\n color: var(--color-text-disabled);\n}\n\n.options {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n}\n\n.horizontal {\n flex-flow: row wrap;\n gap: var(--space-16);\n}\n","import { forwardRef, useId, useMemo, useState, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './RadioGroup.module.css';\nimport { RadioGroupContext } from './RadioGroupContext';\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The visible group label. Without it, give the group an `aria-label`. */\n label?: ReactNode;\n /** The chosen value, when controlled. */\n value?: string;\n /** The first chosen value, when uncontrolled. */\n defaultValue?: string;\n /** Called with the new value when a radio is chosen. */\n onChange?: (value: string) => void;\n /** The native group name. Generated when left out. */\n name?: string;\n /** Disables every radio in the group. */\n disabled?: boolean;\n /** How the radios are laid out. */\n orientation?: RadioGroupOrientation;\n /** The Radio options. */\n children: ReactNode;\n}\n\n/** Selects exactly one option from a short list. Use Select when there are more than about five options. */\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function RadioGroup(\n { label, value, defaultValue, onChange, name, disabled = false, orientation = 'vertical', className, children, ...props },\n ref,\n) {\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const groupName = name ?? `${baseId}-group`;\n const [innerValue, setInnerValue] = useState(defaultValue);\n const current = value ?? innerValue;\n\n const context = useMemo(\n () => ({\n name: groupName,\n value: current,\n disabled,\n onChange: (next: string) => {\n if (value === undefined) setInnerValue(next);\n onChange?.(next);\n },\n }),\n [current, disabled, groupName, onChange, value],\n );\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-labelledby={label ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-orientation={orientation}\n className={cx(styles.group, className)}\n {...props}\n >\n {label && (\n <span id={labelId} className={cx(styles.label, disabled && styles.labelDisabled)}>\n {label}\n </span>\n )}\n <div className={cx(styles.options, orientation === 'horizontal' && styles.horizontal)}>\n <RadioGroupContext.Provider value={context}>{children}</RadioGroupContext.Provider>\n </div>\n </div>\n );\n});\n",".card {\n display: flex;\n flex-direction: column;\n width: 340px;\n max-width: 100%;\n}\n\n.header {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-16);\n}\n\n.tile {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-md);\n color: var(--color-icon-primary);\n}\n\n.names {\n flex: 1;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.identifier {\n color: var(--color-text-secondary);\n font: var(--font-mono-s);\n}\n\n.details {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n margin: var(--space-0);\n padding: var(--space-12) var(--space-16);\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n\n.detail {\n display: grid;\n grid-template-columns: 84px 1fr;\n gap: var(--space-8);\n}\n\n.label {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.value {\n margin: var(--space-0);\n color: var(--color-text-primary);\n font: var(--font-body-s);\n}\n\n.footer {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n padding: var(--space-12) var(--space-16);\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Card } from '../Card';\nimport { Status, type StatusTone } from '../Status';\nimport styles from './ResourceCard.module.css';\n\nexport interface ResourceCardDetail {\n /** The name of the fact. */\n label: ReactNode;\n /** The fact. */\n value: ReactNode;\n}\n\nexport interface ResourceCardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {\n /** Icon in the tile at the top left. */\n icon?: IconName;\n /** The name of the resource. */\n title: ReactNode;\n /** Its machine-readable name. */\n identifier?: ReactNode;\n /** Tone of the status dot. */\n statusTone?: StatusTone;\n /** The status text. Without it, no status is shown. */\n statusLabel?: ReactNode;\n /** Facts about the resource, as label and value pairs. */\n details?: ResourceCardDetail[];\n /** Icon before the footer. */\n footerIcon?: IconName;\n /** A line at the bottom, such as what uses this resource. */\n footer?: ReactNode;\n}\n\n/** A provisioned resource, with its state and key facts. */\nexport const ResourceCard = forwardRef<HTMLElement, ResourceCardProps>(function ResourceCard(\n { icon, title, identifier, statusTone = 'neutral', statusLabel, details, footerIcon, footer, className, ...props },\n ref,\n) {\n return (\n <Card ref={ref} as=\"article\" padding=\"none\" className={cx(styles.card, className)} {...props}>\n <div className={styles.header}>\n {icon && (\n <span className={styles.tile}>\n <Icon name={icon} size={20} />\n </span>\n )}\n <div className={styles.names}>\n <div className={styles.title}>{title}</div>\n {identifier && <div className={styles.identifier}>{identifier}</div>}\n </div>\n {statusLabel && <Status tone={statusTone}>{statusLabel}</Status>}\n </div>\n {details && details.length > 0 && (\n <dl className={styles.details}>\n {details.map((detail, index) => (\n <div key={index} className={styles.detail}>\n <dt className={styles.label}>{detail.label}</dt>\n <dd className={styles.value}>{detail.value}</dd>\n </div>\n ))}\n </dl>\n )}\n {footer && (\n <div className={styles.footer}>\n {footerIcon && <Icon name={footerIcon} size={14} />}\n {footer}\n </div>\n )}\n </Card>\n );\n});\n","/**\n * Everything that touches the browser's editing commands, kept in one file so it can be swapped for an\n * editor library later. `document.execCommand` is deprecated but has no native replacement.\n */\n\nexport type RichTextFormat = 'h2' | 'h3' | 'bold' | 'italic' | 'link' | 'bulletList' | 'numberedList' | 'quote';\n\nconst blockTags: Partial<Record<RichTextFormat, string>> = { h2: 'h2', h3: 'h3', quote: 'blockquote' };\nconst stateCommands: Partial<Record<RichTextFormat, string>> = {\n bold: 'bold',\n italic: 'italic',\n bulletList: 'insertUnorderedList',\n numberedList: 'insertOrderedList',\n};\n\nconst ALLOWED_TAGS = new Set(['H2', 'H3', 'P', 'BR', 'DIV', 'B', 'STRONG', 'I', 'EM', 'A', 'UL', 'OL', 'LI', 'BLOCKQUOTE']);\nconst SAFE_URL = /^(https?:|mailto:)/i;\n\n/** True for the link addresses the editor accepts. */\nexport function isSafeUrl(url: string) {\n return SAFE_URL.test(url.trim());\n}\n\nconst selectedLink = () => {\n const node = document.getSelection()?.anchorNode;\n const element = node instanceof Element ? node : node?.parentElement;\n return element?.closest('a') ?? null;\n};\n\n/** The formats at the current selection. */\nexport function getActiveFormats(): RichTextFormat[] {\n const block = document.queryCommandValue('formatBlock').toLowerCase();\n const active = (Object.keys(blockTags) as RichTextFormat[]).filter((format) => blockTags[format] === block);\n for (const format of Object.keys(stateCommands) as RichTextFormat[]) {\n if (document.queryCommandState(stateCommands[format] as string)) active.push(format);\n }\n if (selectedLink()) active.push('link');\n return active;\n}\n\n/**\n * Toggles a format at the current selection. The editor must have focus. `url` is required to add a link;\n * unsafe addresses are ignored.\n */\nexport function applyFormat(format: RichTextFormat, url?: string) {\n document.execCommand('defaultParagraphSeparator', false, 'p');\n const block = blockTags[format];\n const command = stateCommands[format];\n if (block) {\n const isActive = document.queryCommandValue('formatBlock').toLowerCase() === block;\n document.execCommand('formatBlock', false, isActive ? 'p' : block);\n } else if (command) {\n document.execCommand(command);\n } else if (format === 'link') {\n const link = selectedLink();\n if (link) {\n document.getSelection()?.selectAllChildren(link);\n document.execCommand('unlink');\n } else if (url && isSafeUrl(url)) {\n if (document.getSelection()?.isCollapsed) {\n const anchor = document.createElement('a');\n anchor.href = url.trim();\n anchor.textContent = url.trim();\n document.execCommand('insertHTML', false, anchor.outerHTML);\n } else {\n document.execCommand('createLink', false, url.trim());\n }\n }\n }\n}\n\n/** Inserts plain text at the current selection, which is how pasted and dropped content arrives. */\nexport function insertPlainText(text: string) {\n document.execCommand('insertText', false, text);\n}\n\nconst cleanNode = (node: Element) => {\n for (const child of [...node.children]) {\n cleanNode(child);\n if (!ALLOWED_TAGS.has(child.tagName)) {\n // Scripts and styles lose their content too. Anything else keeps its text.\n if (child.tagName === 'SCRIPT' || child.tagName === 'STYLE') child.remove();\n else child.replaceWith(...child.childNodes);\n continue;\n }\n const href = child.getAttribute('href');\n for (const attribute of [...child.attributes]) child.removeAttribute(attribute.name);\n if (child.tagName === 'A' && href && isSafeUrl(href)) child.setAttribute('href', href);\n }\n};\n\n/** Keeps only the markup the editor can produce. Runs on every value passed in, so a stored value cannot add scripts. */\nexport function sanitizeHtml(html: string) {\n const { body } = new DOMParser().parseFromString(html, 'text/html');\n cleanNode(body);\n return body.innerHTML;\n}\n",".box {\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-md);\n}\n\n.box:hover {\n border-color: var(--color-border-strong);\n}\n\n.invalid,\n.invalid:hover {\n border-color: var(--color-border-danger);\n}\n\n.box:has(.editor:focus-visible) {\n border-color: var(--color-border-focus);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: calc(var(--stroke-hairline) * -1);\n}\n\n.disabled,\n.disabled:hover {\n background: var(--color-bg-disabled);\n border-color: transparent;\n}\n\n.editor {\n min-height: 96px;\n padding: var(--space-10) var(--space-12);\n outline: 0;\n font: var(--font-body-s);\n color: var(--color-text-primary);\n}\n\n.disabled .editor {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.editor > * {\n margin: 0 0 var(--space-8);\n}\n\n.editor > :last-child {\n margin-bottom: 0;\n}\n\n.editor h2 {\n font: var(--font-heading-m);\n letter-spacing: var(--tracking-heading-m);\n}\n\n.editor h3 {\n font: var(--font-heading-s);\n}\n\n.editor ul,\n.editor ol {\n padding-left: var(--space-20);\n}\n\n.editor blockquote {\n padding-left: var(--space-12);\n border-left: var(--stroke-strong) solid var(--color-border-default);\n color: var(--color-text-secondary);\n}\n\n.editor a {\n color: var(--color-text-link);\n text-decoration: underline;\n}\n\n.disabled .editor blockquote,\n.disabled .editor a {\n color: var(--color-text-disabled);\n}\n",".tool {\n flex-shrink: 0;\n padding: var(--space-2) var(--space-6);\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm);\n font: var(--font-mono-s);\n color: var(--color-text-primary);\n white-space: nowrap;\n cursor: pointer;\n}\n\n.tool:hover:not(:disabled),\n.tool[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.active,\n.active:hover:not(:disabled) {\n background: var(--color-bg-sunken);\n}\n\n.tool:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.tool:disabled {\n background: transparent;\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './RichTextTool.module.css';\n\nexport interface RichTextToolProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** The full name of the tool, for assistive technology, such as \"Bold\". */\n label: string;\n /** Marks the format as applied at the cursor. */\n active?: boolean;\n}\n\n/** One toolbar button of a RichTextField. Its children are the short visible text, such as \"B\". */\nexport const RichTextTool = forwardRef<HTMLButtonElement, RichTextToolProps>(function RichTextTool(\n { label, active = false, className, onMouseDown, ...props },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n aria-pressed={active}\n className={cx(styles.tool, active && styles.active, className)}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n // Keeps the editor's selection, which a click would otherwise clear.\n event.preventDefault();\n }}\n {...props}\n />\n );\n});\n",".toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--space-2);\n padding: var(--space-4) var(--space-6);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n","import { forwardRef, useState, type HTMLAttributes, type KeyboardEvent } from 'react';\nimport { cx } from '../../lib/cx';\nimport type { RichTextFormat } from './richTextCommands';\nimport { RichTextTool } from './RichTextTool';\nimport styles from './RichTextToolbar.module.css';\n\nconst tools: { format: RichTextFormat; text: string; label: string }[] = [\n { format: 'h2', text: 'H2', label: 'H2 heading' },\n { format: 'h3', text: 'H3', label: 'H3 heading' },\n { format: 'bold', text: 'B', label: 'Bold' },\n { format: 'italic', text: 'I', label: 'Italic' },\n { format: 'link', text: 'Link', label: 'Link' },\n { format: 'bulletList', text: '• List', label: 'Bullet list' },\n { format: 'numberedList', text: '1. List', label: '1. List numbered' },\n { format: 'quote', text: 'Quote', label: 'Quote' },\n];\n\nexport interface RichTextToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** The formats applied at the cursor. */\n activeFormats?: RichTextFormat[];\n /** Called when a tool is used. */\n onFormat?: (format: RichTextFormat) => void;\n /** Disables every tool. */\n disabled?: boolean;\n}\n\n/** The formatting toolbar of a RichTextField. Tab enters it once, and arrow keys move between tools. */\nexport const RichTextToolbar = forwardRef<HTMLDivElement, RichTextToolbarProps>(function RichTextToolbar(\n { activeFormats = [], onFormat, disabled = false, className, 'aria-label': ariaLabel = 'Formatting', ...props },\n ref,\n) {\n const [focusIndex, setFocusIndex] = useState(0);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const last = tools.length - 1;\n const targets: Record<string, number> = {\n ArrowRight: focusIndex === last ? 0 : focusIndex + 1,\n ArrowLeft: focusIndex === 0 ? last : focusIndex - 1,\n Home: 0,\n End: last,\n };\n if (!(event.key in targets)) return;\n event.preventDefault();\n const next = targets[event.key];\n setFocusIndex(next);\n event.currentTarget.querySelectorAll('button')[next]?.focus();\n };\n\n return (\n <div\n ref={ref}\n role=\"toolbar\"\n tabIndex={-1}\n aria-label={ariaLabel}\n aria-disabled={disabled || undefined}\n className={cx(styles.toolbar, className)}\n onKeyDown={onKeyDown}\n {...props}\n >\n {tools.map((tool, index) => (\n <RichTextTool\n key={tool.format}\n label={tool.label}\n active={activeFormats.includes(tool.format)}\n disabled={disabled}\n tabIndex={index === focusIndex ? 0 : -1}\n onFocus={() => setFocusIndex(index)}\n onClick={() => onFormat?.(tool.format)}\n >\n {tool.text}\n </RichTextTool>\n ))}\n </div>\n );\n});\n","import {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ClipboardEvent,\n type DragEvent,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../lib/cx';\nimport fieldStyles from '../Field/Field.module.css';\nimport { applyFormat, getActiveFormats, insertPlainText, sanitizeHtml, type RichTextFormat } from './richTextCommands';\nimport styles from './RichTextField.module.css';\nimport { RichTextToolbar } from './RichTextToolbar';\n\nexport interface RichTextFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The visible label, which also names the editor. */\n label: ReactNode;\n /** Short text at the end of the label row, such as a locale. */\n meta?: ReactNode;\n /** Help text below the editor. */\n help?: ReactNode;\n /** Error text. It replaces the help text and puts the editor in its error state. */\n error?: ReactNode;\n /** The content as an HTML string, when controlled. It is sanitised before display. */\n value?: string;\n /** The first content as an HTML string, when uncontrolled. It is sanitised before display. */\n defaultValue?: string;\n /** Called with the content as an HTML string after every change. */\n onChange?: (html: string) => void;\n /** Stops editing and disables the toolbar. */\n disabled?: boolean;\n /** Asks for a link address when the Link tool is used. Defaults to `window.prompt`. Return null to cancel. */\n requestLinkUrl?: () => string | null;\n}\n\nconst defaultRequestLinkUrl = () => window.prompt('Link address');\n\n/**\n * A labelled editor with a formatting toolbar, for long-form content. The toolbar marks the formatting at the cursor.\n * Pasted and dropped content arrives as plain text, and only safe markup is kept from the value passed in.\n */\nexport function RichTextField({\n label,\n meta,\n help,\n error,\n value,\n defaultValue = '',\n onChange,\n disabled = false,\n requestLinkUrl = defaultRequestLinkUrl,\n className,\n ...props\n}: RichTextFieldProps) {\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const messageId = `${baseId}-message`;\n const hasError = Boolean(error);\n const hasMessage = Boolean(error || help);\n\n const editorRef = useRef<HTMLDivElement>(null);\n const savedRange = useRef<Range | null>(null);\n const [initialValue] = useState(defaultValue);\n const [activeFormats, setActiveFormats] = useState<RichTextFormat[]>([]);\n\n // Editing changes the DOM directly, so the content is only written when the value really differs.\n useLayoutEffect(() => {\n const editor = editorRef.current;\n if (!editor) return;\n const next = sanitizeHtml(value ?? initialValue);\n if (editor.innerHTML !== next) editor.innerHTML = next;\n }, [initialValue, value]);\n\n const refreshActive = useCallback(() => {\n const next = getActiveFormats();\n setActiveFormats((previous) => (previous.join() === next.join() ? previous : next));\n }, []);\n\n useEffect(() => {\n const onSelectionChange = () => {\n const selection = document.getSelection();\n const editor = editorRef.current;\n if (!editor || !selection?.rangeCount || !editor.contains(selection.anchorNode)) return;\n savedRange.current = selection.getRangeAt(0).cloneRange();\n refreshActive();\n };\n document.addEventListener('selectionchange', onSelectionChange);\n return () => document.removeEventListener('selectionchange', onSelectionChange);\n }, [refreshActive]);\n\n const emit = () => {\n if (editorRef.current) onChange?.(editorRef.current.innerHTML);\n };\n\n const onFormat = (format: RichTextFormat) => {\n const editor = editorRef.current;\n if (!editor || disabled) return;\n const needsUrl = format === 'link' && !activeFormats.includes('link');\n const url = needsUrl ? requestLinkUrl() : undefined;\n if (needsUrl && !url) return;\n // A keyboard user is on the toolbar, so bring back the place they left in the editor.\n editor.focus();\n const selection = document.getSelection();\n if (savedRange.current && selection) {\n selection.removeAllRanges();\n selection.addRange(savedRange.current);\n }\n applyFormat(format, url ?? undefined);\n emit();\n refreshActive();\n };\n\n const onPaste = (event: ClipboardEvent<HTMLDivElement>) => {\n event.preventDefault();\n insertPlainText(event.clipboardData.getData('text/plain'));\n };\n\n const onDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n const text = event.dataTransfer.getData('text/plain');\n if (text) insertPlainText(text);\n };\n\n return (\n <div className={cx(fieldStyles.field, className)} {...props}>\n <div className={fieldStyles.header}>\n <span id={labelId} className={cx(fieldStyles.label, disabled && fieldStyles.labelDisabled)}>\n {label}\n </span>\n {meta && <span className={fieldStyles.meta}>{meta}</span>}\n </div>\n <div className={cx(styles.box, hasError && styles.invalid, disabled && styles.disabled)}>\n <RichTextToolbar activeFormats={activeFormats} onFormat={onFormat} disabled={disabled} />\n <div\n ref={editorRef}\n role=\"textbox\"\n tabIndex={disabled ? -1 : 0}\n aria-multiline\n aria-labelledby={labelId}\n aria-describedby={hasMessage ? messageId : undefined}\n aria-invalid={hasError || undefined}\n aria-disabled={disabled || undefined}\n contentEditable={!disabled}\n suppressContentEditableWarning\n className={styles.editor}\n onInput={emit}\n onPaste={onPaste}\n onDrop={onDrop}\n />\n </div>\n {hasMessage && (\n <p id={messageId} className={cx(fieldStyles.message, hasError && fieldStyles.error)}>\n {error || help}\n </p>\n )}\n </div>\n );\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport {\n ChartAxes,\n ChartDataTable,\n ChartFrame,\n ChartHoverLayer,\n chartMarks,\n formatTicks,\n formatValue as defaultFormatValue,\n linearScale,\n niceTicks,\n seriesColorClass,\n useChartHover,\n useChartSize,\n} from '../ChartCore';\nimport { ChartLegend, useLegendState } from '../ChartLegend';\nimport { ChartTooltip } from '../ChartTooltip';\n\n/** One point of a scatter plot. */\nexport interface ScatterPoint {\n /** Position along the x measure. */\n x: number;\n /** Position along the y measure. */\n y: number;\n}\n\n/** A named group of points. */\nexport interface ScatterSeries {\n /** Stable identifier. */\n id: string;\n /** Name shown in the legend and tooltip. */\n name: string;\n /** The points. */\n points: readonly ScatterPoint[];\n}\n\nexport interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** One or two series. Any more are left out, because points in more colours stop being readable. */\n series: ScatterSeries[];\n /** Name of the x measure, used in the data table. */\n xLabel?: string;\n /** Name of the y measure, used in the data table. */\n yLabel?: string;\n /** Height of the plot in pixels, including the axis labels. Width fills the container. */\n height?: number;\n /** Accessible name of the chart. Say what it shows. */\n 'aria-label'?: string;\n /** Shown in place of the chart when there is no data. */\n emptyMessage?: ReactNode;\n /** Formats values in the tooltip and the data table. */\n formatValue?: (value: number) => string;\n /** Hidden series ids, when controlled. */\n hiddenSeries?: string[];\n /** Hidden series ids at first, when uncontrolled. */\n defaultHiddenSeries?: string[];\n /** Called with the new hidden series ids. */\n onHiddenSeriesChange?: (hiddenSeries: string[]) => void;\n}\n\nconst MAX_SCATTER_SERIES = 2;\nconst POINT_RADIUS = 5;\nconst ACTIVE_RADIUS = 7;\n/** The pointer only has to be this close, because an 8 px dot is too small to land on. */\nconst HIT_DISTANCE = 24;\n\n/** The relationship between two measures. Points have a 2 px surface ring so they stay legible where they overlap. */\nexport const ScatterPlot = forwardRef<HTMLDivElement, ScatterPlotProps>(function ScatterPlot(\n {\n series,\n xLabel = 'x',\n yLabel = 'y',\n height = 240,\n 'aria-label': ariaLabel = 'Scatter plot',\n emptyMessage,\n formatValue = defaultFormatValue,\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n className,\n ...props\n },\n ref,\n) {\n const { ref: sizeRef, width } = useChartSize(ref);\n const [hidden, setHidden] = useLegendState({\n hiddenIds: hiddenSeries,\n defaultHiddenIds: defaultHiddenSeries,\n onHiddenChange: onHiddenSeriesChange,\n });\n\n const limited = series.slice(0, MAX_SCATTER_SERIES);\n const empty = limited.every((item) => item.points.length === 0);\n\n // Everything visible, ordered along x so the arrow keys walk across the plot.\n const points = limited\n .flatMap((item, colorIndex) => (hidden.includes(item.id) ? [] : item.points.map((point) => ({ ...point, item, colorIndex }))))\n .sort((a, b) => a.x - b.x);\n\n const xTickValues = niceTicks(Math.min(0, ...points.map((p) => p.x)), Math.max(1, ...points.map((p) => p.x)));\n const yTickValues = niceTicks(Math.min(0, ...points.map((p) => p.y)), Math.max(1, ...points.map((p) => p.y)));\n const xTickLabels = formatTicks(xTickValues);\n const yTickLabels = formatTicks(yTickValues);\n\n const plot = { left: 32, right: width - 16, top: 8, bottom: height - 24 };\n const xAt = linearScale([xTickValues[0], xTickValues[xTickValues.length - 1]], [plot.left, plot.right]);\n const yAt = linearScale([yTickValues[0], yTickValues[yTickValues.length - 1]], [plot.bottom, plot.top]);\n\n const hover = useChartHover({\n count: points.length,\n locate: (x, y) => {\n let nearest: number | null = null;\n let best = HIT_DISTANCE;\n points.forEach((point, i) => {\n const distance = Math.hypot(xAt(point.x) - x, yAt(point.y) - y);\n if (distance <= best) {\n best = distance;\n nearest = i;\n }\n });\n return nearest;\n },\n });\n\n const active = hover.activeIndex === null ? null : points[hover.activeIndex];\n const anchor = active ? { x: xAt(active.x), y: yAt(active.y), reach: ACTIVE_RADIUS } : null;\n const title = active ? `${xLabel} ${formatValue(active.x)}` : '';\n const value = active ? `${yLabel} ${formatValue(active.y)}` : '';\n\n return (\n <ChartFrame ref={sizeRef} height={height} empty={empty} emptyMessage={emptyMessage} className={className} {...props}>\n {limited.length > 1 && (\n <ChartLegend\n items={limited.map((item) => ({ id: item.id, label: item.name }))}\n hiddenIds={hidden}\n onHiddenChange={setHidden}\n style={{ marginBottom: 'var(--space-8)' }}\n />\n )}\n {width > 0 && (\n <ChartHoverLayer\n hover={hover}\n label={ariaLabel}\n height={height}\n anchor={anchor}\n tooltip={\n active && (\n <ChartTooltip title={title} rows={[{ id: active.item.id, name: active.item.name, value, colorIndex: active.colorIndex }]} />\n )\n }\n announcement={active ? `${active.item.name}, ${title}, ${value}` : ''}\n >\n <svg className={chartMarks.svg} width={width} height={height} aria-hidden=\"true\">\n <ChartAxes\n plot={plot}\n xTicks={xTickValues.map((tick, i) => ({ position: xAt(tick), label: xTickLabels[i] }))}\n yTicks={yTickValues.map((tick, i) => ({ position: yAt(tick), label: yTickLabels[i] }))}\n />\n {points.map((point, i) => (\n <circle\n key={`${point.item.id}-${i}`}\n className={cx(chartMarks.marker, seriesColorClass(point.colorIndex))}\n cx={xAt(point.x)}\n cy={yAt(point.y)}\n r={i === hover.activeIndex ? ACTIVE_RADIUS : POINT_RADIUS}\n />\n ))}\n </svg>\n </ChartHoverLayer>\n )}\n <ChartDataTable\n caption={ariaLabel}\n columns={['Series', xLabel, yLabel]}\n rows={limited.flatMap((item) =>\n item.points.map((point, i) => ({\n id: `${item.id}-${i}`,\n header: item.name,\n cells: [formatValue(point.x), formatValue(point.y)],\n })),\n )}\n />\n </ChartFrame>\n );\n});\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport { LockedTag } from '../Input/LockedTagInternal';\nimport { Menu, MenuItem, usePopup } from '../Menu';\nimport styles from './Select.module.css';\nimport { findEnabled, isPrintableKey, nextIndexForKey, optionId, typeAheadIndex, useListbox } from './useListbox';\n\nexport interface SelectOption {\n /** The value reported by `onChange`. */\n value: string;\n /** The text shown for the option. */\n label: string;\n /** Stops the option being chosen. */\n disabled?: boolean;\n /** Icon before the label. */\n icon?: IconName;\n}\n\nexport interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children'> {\n /** The options to choose from. */\n options: SelectOption[];\n /** The chosen value, when controlled. */\n value?: string;\n /** The first chosen value, when uncontrolled. */\n defaultValue?: string;\n /** Called with the new value when an option is chosen. */\n onChange?: (value: string) => void;\n /** Text shown when nothing is chosen. */\n placeholder?: string;\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag. It can be focused but not opened. */\n locked?: boolean;\n /** Marks the control as required. */\n required?: boolean;\n /** Adds a filter box at the top of the popup. */\n searchable?: boolean;\n /** Accessible name and placeholder of the filter box. */\n filterLabel?: string;\n /** Text shown when the filter matches nothing. */\n emptyLabel?: string;\n}\n\n/** Single select dropdown, following the WAI-ARIA select-only combobox pattern. */\nexport const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n options,\n value,\n defaultValue,\n onChange,\n placeholder = 'Select an option',\n invalid,\n disabled,\n locked,\n required,\n searchable = false,\n filterLabel = 'Filter options',\n emptyLabel = 'No matches',\n name,\n id,\n className,\n onClick,\n onKeyDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const field = useFieldControl({\n id,\n invalid,\n disabled,\n locked,\n required,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n });\n const [open, setOpen] = useState(false);\n const [innerValue, setInnerValue] = useState(defaultValue);\n const current = value ?? innerValue;\n const selected = options.find((option) => option.value === current);\n\n const { query, setQuery, activeIndex, setActiveIndex, filtered, typed } = useListbox(options);\n const listId = `${useId()}-listbox`;\n const close = useCallback(() => setOpen(false), []);\n const { triggerRef, popupRef, popupStyle } = usePopup<HTMLButtonElement>({ open, onClose: close, matchTriggerWidth: true });\n useImperativeHandle(ref, () => triggerRef.current as HTMLButtonElement, [triggerRef]);\n const filterRef = useRef<HTMLInputElement>(null);\n\n // The filter box takes focus while the popup is open, and focus comes back when it closes.\n useEffect(() => {\n if (!open || !searchable) return;\n const trigger = triggerRef.current;\n filterRef.current?.focus();\n return () => trigger?.focus();\n }, [open, searchable, triggerRef]);\n\n useEffect(() => {\n if (open && activeIndex >= 0) document.getElementById(optionId(listId, activeIndex) ?? '')?.scrollIntoView({ block: 'nearest' });\n }, [activeIndex, listId, open]);\n\n const openPopup = (index?: number) => {\n setQuery('');\n const selectedIndex = options.findIndex((option) => option.value === current);\n setActiveIndex(index ?? (selectedIndex >= 0 ? selectedIndex : findEnabled(options, 0, 1)));\n setOpen(true);\n };\n\n const choose = (option: SelectOption | undefined) => {\n if (!option || option.disabled) return;\n if (value === undefined) setInnerValue(option.value);\n if (option.value !== current) onChange?.(option.value);\n close();\n };\n\n const onListKeyDown = (event: KeyboardEvent<HTMLElement>, isFilter: boolean) => {\n const next = nextIndexForKey(event.key, filtered, activeIndex);\n // In the filter box, Home and End move the text cursor.\n if (next !== null && !(isFilter && (event.key === 'Home' || event.key === 'End'))) {\n event.preventDefault();\n if (event.key === 'ArrowUp' && event.altKey) choose(filtered[activeIndex]);\n else if (next >= 0) setActiveIndex(next);\n } else if (event.key === 'Enter' || (event.key === ' ' && !isFilter)) {\n event.preventDefault();\n choose(filtered[activeIndex]);\n } else if (event.key === 'Tab') {\n choose(filtered[activeIndex]);\n close();\n } else if (!isFilter && isPrintableKey(event)) {\n const match = typeAheadIndex(filtered, activeIndex, event.key, typed.current, event.timeStamp);\n if (match >= 0) setActiveIndex(match);\n }\n };\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || field.locked) return;\n if (open) {\n onListKeyDown(event, false);\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n openPopup();\n } else if (event.key === 'Home') {\n event.preventDefault();\n openPopup(findEnabled(options, 0, 1));\n } else if (event.key === 'End') {\n event.preventDefault();\n openPopup(findEnabled(options, options.length - 1, -1));\n } else if (isPrintableKey(event)) {\n event.preventDefault();\n const start = options.findIndex((option) => option.value === current);\n const match = typeAheadIndex(options, start, event.key, typed.current, event.timeStamp);\n openPopup(match >= 0 ? match : undefined);\n }\n };\n\n const onTriggerClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || field.locked) return;\n if (open) close();\n else openPopup();\n };\n\n return (\n <>\n <button\n ref={triggerRef}\n id={field.id}\n type=\"button\"\n role=\"combobox\"\n disabled={field.disabled}\n aria-label={ariaLabel}\n aria-labelledby={field.labelledBy}\n aria-describedby={field.describedBy}\n aria-invalid={field.invalid || undefined}\n aria-required={field.required || undefined}\n aria-readonly={field.locked || undefined}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-activedescendant={open && !searchable ? optionId(listId, activeIndex) : undefined}\n className={cx(\n control.control,\n styles.trigger,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n onClick={onTriggerClick}\n onKeyDown={onTriggerKeyDown}\n {...props}\n >\n {selected?.icon && <Icon name={selected.icon} className={control.icon} />}\n <span className={cx(styles.value, !selected && !field.disabled && styles.placeholder)}>{selected?.label ?? placeholder}</span>\n {field.locked ? <LockedTag /> : <Icon name=\"chevron-down\" className={control.icon} />}\n </button>\n {name && <input type=\"hidden\" name={name} value={current ?? ''} disabled={field.disabled} />}\n {open &&\n createPortal(\n <Menu\n ref={popupRef}\n style={popupStyle}\n className={styles.popup}\n onMouseDown={(event) => {\n // Keeps focus where it is when a row is pressed. The filter box still needs its own text selection.\n if (!(event.target instanceof HTMLInputElement)) event.preventDefault();\n }}\n >\n {searchable && (\n <div className={styles.filter}>\n <Icon name=\"search\" className={control.icon} />\n <input\n ref={filterRef}\n type=\"text\"\n role=\"combobox\"\n className={control.field}\n value={query}\n placeholder={filterLabel}\n aria-label={filterLabel}\n aria-autocomplete=\"list\"\n aria-expanded\n aria-controls={listId}\n aria-activedescendant={optionId(listId, activeIndex)}\n onChange={(event) => {\n setQuery(event.target.value);\n setActiveIndex(-1);\n }}\n onKeyDown={(event) => onListKeyDown(event, true)}\n />\n </div>\n )}\n <div id={listId} role=\"listbox\" className={styles.list} aria-label={ariaLabel} aria-labelledby={field.labelledBy}>\n {filtered.map((option, index) => (\n <MenuItem\n key={option.value}\n id={optionId(listId, index)}\n role=\"option\"\n aria-selected={option.value === current}\n icon={option.icon}\n selected={option.value === current}\n active={index === activeIndex}\n disabled={option.disabled}\n onClick={() => choose(option)}\n onMouseMove={() => {\n if (!option.disabled && index !== activeIndex) setActiveIndex(index);\n }}\n >\n {option.label}\n </MenuItem>\n ))}\n </div>\n {filtered.length === 0 && (\n <div role=\"status\" className={styles.empty}>\n {emptyLabel}\n </div>\n )}\n </Menu>,\n document.body,\n )}\n </>\n );\n});\n",".step {\n display: flex;\n align-items: center;\n gap: var(--space-14);\n padding: var(--space-14) var(--space-16);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n}\n\n.next {\n border-color: var(--color-border-default);\n box-shadow: var(--elevation-card);\n}\n\n.marker {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n border: var(--stroke-hairline) solid var(--color-border-default);\n border-radius: var(--radius-full);\n color: var(--color-text-secondary);\n font: var(--font-label-s);\n}\n\n.done .marker {\n background: var(--color-status-success);\n border-color: transparent;\n color: var(--color-icon-inverse);\n}\n\n.text {\n flex: 1;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.done .title {\n color: var(--color-text-secondary);\n}\n\n.description {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.doneLabel {\n color: var(--color-text-success);\n font: var(--font-label-s);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './SetupStep.module.css';\n\nexport type SetupStepState = 'done' | 'next' | 'todo';\n\nexport interface SetupStepProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** `done` is finished, `next` is the step to do now and `todo` is still to come. */\n state?: SetupStepState;\n /** The position of the step in the list. */\n step?: number;\n /** What the step achieves. */\n title: ReactNode;\n /** More about the step, or what was done. */\n description?: ReactNode;\n /** The control that starts the step, normally a Button. Use `primary` only for `next`. Not shown when `done`. */\n action?: ReactNode;\n /** Text shown at the right when `done`. */\n doneLabel?: ReactNode;\n}\n\n/** One step in a setup list. Marks the current step with `aria-current`. */\nexport const SetupStep = forwardRef<HTMLDivElement, SetupStepProps>(function SetupStep(\n { state = 'todo', step, title, description, action, doneLabel = 'Done', className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.step, styles[state], className)} aria-current={state === 'next' ? 'step' : undefined} {...props}>\n <span className={styles.marker}>{state === 'done' ? <Icon name=\"check\" size={14} /> : step}</span>\n <div className={styles.text}>\n <div className={styles.title}>{title}</div>\n {description && <div className={styles.description}>{description}</div>}\n </div>\n {state === 'done' ? <span className={styles.doneLabel}>{doneLabel}</span> : action}\n </div>\n );\n});\n",".sidebar {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: 248px;\n height: 100%;\n border-right: var(--stroke-hairline) solid var(--color-border-subtle);\n background: var(--color-bg-sidebar);\n}\n\n.header {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n padding: var(--space-16) var(--space-16) var(--space-0);\n}\n\n.search {\n padding: var(--space-12) var(--space-16) var(--space-0);\n}\n\n.nav {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n}\n\n/* The padding also leaves room for the focus ring, which this scroll area would otherwise clip. */\n.list {\n display: flex;\n flex: 1;\n flex-direction: column;\n gap: var(--space-16);\n min-height: 0;\n padding: var(--space-12) var(--space-16);\n overflow-y: auto;\n}\n\n.pinned {\n padding: var(--space-4) var(--space-16);\n}\n\n.footer {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n margin: var(--space-0) var(--space-16);\n padding: var(--space-12) var(--space-0);\n border-top: var(--stroke-hairline) solid var(--color-border-subtle);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Sidebar.module.css';\n\nexport interface SidebarProps extends HTMLAttributes<HTMLElement> {\n /** Top of the column: a SidebarBrand, or a back link with an environment label. */\n header?: ReactNode;\n /** The Quick search box. */\n search?: ReactNode;\n /** NavItems kept below the scrolling list, such as Settings. */\n pinned?: ReactNode;\n /** Bottom of the column: connection status and a SidebarUser. */\n footer?: ReactNode;\n /** Accessible name of the navigation landmark. */\n navLabel?: string;\n /** The scrolling navigation: NavGroups and NavItems. */\n children?: ReactNode;\n}\n\n/** The navigation column of the app. It fills the height of its container and its list scrolls. */\nexport const Sidebar = forwardRef<HTMLElement, SidebarProps>(function Sidebar(\n { header, search, pinned, footer, navLabel = 'Main', className, children, ...props },\n ref,\n) {\n return (\n <aside ref={ref} className={cx(styles.sidebar, className)} {...props}>\n {header && <div className={styles.header}>{header}</div>}\n {search && <div className={styles.search}>{search}</div>}\n <nav aria-label={navLabel} className={styles.nav}>\n <div className={styles.list}>{children}</div>\n {pinned && <div className={styles.pinned}>{pinned}</div>}\n </nav>\n {footer && <div className={styles.footer}>{footer}</div>}\n </aside>\n );\n});\n",".brand {\n display: flex;\n align-items: center;\n gap: var(--space-10);\n box-sizing: border-box;\n width: 100%;\n padding: var(--space-4) var(--space-8);\n border: none;\n border-radius: var(--radius-md);\n background: transparent;\n text-align: left;\n cursor: pointer;\n}\n\n.brand:hover,\n.brand[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.brand:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.tile {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: var(--radius-md);\n background: var(--color-bg-accent);\n color: var(--color-text-on-accent);\n font: var(--font-label-m);\n}\n\n.text {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n\n.name {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.description {\n color: var(--color-text-tertiary);\n font: var(--font-caption);\n}\n\n/* Tertiary text is under 4.5:1 on the hover background. */\n.brand:hover .description,\n.brand[data-state='hover'] .description {\n color: var(--color-text-secondary);\n}\n\n.icon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './SidebarBrand.module.css';\n\nexport interface SidebarBrandProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'name' | 'children'> {\n /** Name of the account. */\n name: string;\n /** Line under the name. */\n description?: string;\n /** Letter in the tile. */\n initial: string;\n}\n\n/** The account tile and name at the top of the sidebar. It opens the menu to change account. */\nexport const SidebarBrand = forwardRef<HTMLButtonElement, SidebarBrandProps>(function SidebarBrand(\n { name, description, initial, className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.brand, className)} {...props}>\n <span className={styles.tile} aria-hidden=\"true\">\n {initial}\n </span>\n <span className={styles.text}>\n <span className={styles.name}>{name}</span>\n {description && <span className={styles.description}>{description}</span>}\n </span>\n <Icon name=\"chevrons-up-down\" className={styles.icon} />\n </button>\n );\n});\n",".user {\n display: flex;\n align-items: center;\n gap: var(--space-10);\n box-sizing: border-box;\n width: 100%;\n padding: var(--space-4) var(--space-8);\n border: none;\n border-radius: var(--radius-md);\n background: transparent;\n text-align: left;\n cursor: pointer;\n}\n\n.user:hover,\n.user[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.user:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.text {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n\n.name {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.role {\n color: var(--color-text-tertiary);\n font: var(--font-caption);\n}\n\n/* Tertiary text is under 4.5:1 on the hover background. */\n.user:hover .role,\n.user[data-state='hover'] .role {\n color: var(--color-text-secondary);\n}\n\n.icon {\n flex: none;\n color: var(--color-icon-secondary);\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { Icon } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Avatar } from '../Avatar';\nimport styles from './SidebarUser.module.css';\n\nexport interface SidebarUserProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'name' | 'children'> {\n /** The person's name. */\n name: string;\n /** Their role, shown under the name. */\n role?: string;\n /** Short text for the avatar, such as `DR`. */\n initials?: string;\n /** Photo for the avatar. */\n src?: string;\n}\n\n/** The signed-in person at the foot of the sidebar. It opens the account menu. */\nexport const SidebarUser = forwardRef<HTMLButtonElement, SidebarUserProps>(function SidebarUser(\n { name, role, initials, src, className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.user, className)} {...props}>\n <Avatar initials={initials} src={src} aria-hidden=\"true\" />\n <span className={styles.text}>\n <span className={styles.name}>{name}</span>\n {role && <span className={styles.role}>{role}</span>}\n </span>\n <Icon name=\"chevrons-up-down\" className={styles.icon} />\n </button>\n );\n});\n",".row {\n display: flex;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-10) var(--space-8);\n background: var(--color-bg-canvas);\n border: var(--stroke-hairline) solid transparent;\n border-bottom-color: var(--color-border-subtle);\n}\n\n.dragging {\n border-color: var(--color-border-default);\n border-radius: var(--radius-lg);\n box-shadow: var(--elevation-overlay);\n}\n\n.moves {\n display: inline-flex;\n flex: none;\n}\n\n.kind {\n flex: none;\n width: 72px;\n color: var(--color-text-secondary);\n font: var(--font-mono-overline);\n letter-spacing: var(--tracking-mono-overline);\n text-transform: uppercase;\n}\n\n.text {\n flex: 1;\n min-width: 0;\n}\n\n.title {\n color: var(--color-text-primary);\n font: var(--font-label-m);\n}\n\n.subtitle {\n color: var(--color-text-secondary);\n font: var(--font-caption);\n}\n\n.grip {\n flex: none;\n color: var(--color-icon-muted);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport styles from './SortableRow.module.css';\n\nexport type SortableRowState = 'default' | 'dragging';\n\nexport interface SortableRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** `dragging` lifts the row, to show it being moved. */\n state?: SortableRowState;\n /** A short overline at the left, such as the kind of block. */\n kind?: ReactNode;\n /** What the row is. */\n title: ReactNode;\n /** A quieter line below the title. */\n subtitle?: ReactNode;\n /** The control at the right, normally a ghost Button. */\n action?: ReactNode;\n /** Called by the Move up button. Without it, the button is disabled. */\n onMoveUp?: () => void;\n /** Called by the Move down button. Without it, the button is disabled. */\n onMoveDown?: () => void;\n /** Accessible name of the Move up button. Name the row. */\n moveUpLabel?: string;\n /** Accessible name of the Move down button. Name the row. */\n moveDownLabel?: string;\n}\n\n/** One row in a list that can be reordered, using Move up and Move down buttons that work from the keyboard. */\nexport const SortableRow = forwardRef<HTMLDivElement, SortableRowProps>(function SortableRow(\n {\n state = 'default',\n kind,\n title,\n subtitle,\n action,\n onMoveUp,\n onMoveDown,\n moveUpLabel = 'Move up',\n moveDownLabel = 'Move down',\n className,\n ...props\n },\n ref,\n) {\n return (\n <div ref={ref} className={cx(styles.row, styles[state], className)} {...props}>\n <svg className={styles.grip} width=\"8\" height=\"14\" viewBox=\"0 0 8 14\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"1.5\" cy=\"2\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"2\" r=\"1\" />\n <circle cx=\"1.5\" cy=\"7\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"7\" r=\"1\" />\n <circle cx=\"1.5\" cy=\"12\" r=\"1\" />\n <circle cx=\"6.5\" cy=\"12\" r=\"1\" />\n </svg>\n <span className={styles.moves}>\n <IconButton icon=\"chevron-up\" label={moveUpLabel} variant=\"ghost\" size=\"sm\" disabled={!onMoveUp} onClick={onMoveUp} />\n <IconButton icon=\"chevron-down\" label={moveDownLabel} variant=\"ghost\" size=\"sm\" disabled={!onMoveDown} onClick={onMoveDown} />\n </span>\n {kind && <span className={styles.kind}>{kind}</span>}\n <div className={styles.text}>\n <div className={styles.title}>{title}</div>\n {subtitle && <div className={styles.subtitle}>{subtitle}</div>}\n </div>\n {action}\n </div>\n );\n});\n",".statusIcon {\n display: inline-flex;\n flex: none;\n}\n\n.success {\n color: var(--color-status-success);\n}\n\n.warning {\n color: var(--color-status-warning);\n}\n\n.danger {\n color: var(--color-status-danger);\n}\n\n.info {\n color: var(--color-status-info);\n}\n\n.neutral {\n color: var(--color-status-neutral);\n}\n\n.pending {\n color: var(--color-status-pending);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport type { StatusTone } from '../Status';\nimport styles from './StatusIcon.module.css';\n\nexport type StatusIconSize = 'sm' | 'md' | 'lg';\n\nexport interface StatusIconProps extends HTMLAttributes<HTMLSpanElement> {\n /** State to show. Picks both the icon and its colour. */\n tone?: StatusTone;\n /** Icon size: `sm` is 16 px, `md` is 20 px and `lg` is 24 px. */\n size?: StatusIconSize;\n /** Accessible name stating the status, because the icon has no visible text. */\n label: string;\n}\n\nconst ICONS: Record<StatusTone, IconName> = {\n success: 'check-circle',\n warning: 'alert-triangle',\n danger: 'x-circle',\n info: 'info',\n neutral: 'circle',\n pending: 'clock',\n};\n\nconst SIZES: Record<StatusIconSize, number> = { sm: 16, md: 20, lg: 24 };\n\n/** Icon-only status for dense spots such as table cells and checklists. */\nexport const StatusIcon = forwardRef<HTMLSpanElement, StatusIconProps>(function StatusIcon(\n { tone = 'neutral', size = 'sm', label, className, ...props },\n ref,\n) {\n return (\n <span ref={ref} className={cx(styles.statusIcon, styles[tone], className)} {...props} role=\"img\" aria-label={label}>\n <Icon name={ICONS[tone]} size={SIZES[size]} />\n </span>\n );\n});\n",".step {\n display: inline-flex;\n flex: none;\n flex-direction: column;\n align-items: center;\n gap: var(--space-8);\n max-width: 160px;\n text-align: center;\n}\n\n.indicator {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 28px;\n height: 28px;\n border-radius: var(--radius-full);\n font: var(--font-label-s);\n}\n\n.text {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.label {\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n}\n\n.meta {\n color: var(--color-text-tertiary);\n font: var(--font-caption);\n}\n\n.done .indicator {\n background: var(--color-bg-inverse);\n color: var(--color-text-inverse);\n}\n\n.current .indicator {\n background: var(--color-bg-accent);\n color: var(--color-text-on-accent);\n}\n\n.upcoming .indicator {\n border: var(--stroke-hairline) solid var(--color-border-default);\n color: var(--color-text-secondary);\n}\n\n.upcoming .label {\n color: var(--color-text-secondary);\n}\n\n.failed .indicator {\n background: var(--color-bg-danger);\n color: var(--color-text-on-danger);\n}\n\n.failed .meta {\n color: var(--color-text-danger);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './Step.module.css';\n\nexport type StepState = 'done' | 'current' | 'upcoming' | 'failed';\n\nexport interface StepProps extends HTMLAttributes<HTMLDivElement> {\n /** Name of the step. */\n label: ReactNode;\n /** Small text under the label, such as \"In progress\". */\n meta?: ReactNode;\n /** Where the step has got to. `done` draws a check and `failed` draws a cross. */\n state?: StepState;\n /** Number in the indicator, for current and upcoming steps. */\n number?: number;\n /** Icon in the indicator, in place of the number or the state icon. */\n icon?: IconName;\n /** Words that say the state to screen readers when the indicator shows an icon. */\n stateLabel?: string;\n}\n\nconst STATE_ICON: Partial<Record<StepState, IconName>> = { done: 'check', failed: 'x' };\nconst STATE_LABEL: Record<StepState, string> = { done: 'Done', current: 'Current', upcoming: 'Upcoming', failed: 'Failed' };\n\n/** One stage in a sequence: an indicator with the label and meta stacked and centred under it. */\nexport const Step = forwardRef<HTMLDivElement, StepProps>(function Step(\n { label, meta, state = 'upcoming', number, icon, stateLabel, className, ...props },\n ref,\n) {\n const indicatorIcon = icon ?? STATE_ICON[state];\n return (\n <div ref={ref} className={cx(styles.step, styles[state], className)} aria-current={state === 'current' ? 'step' : undefined} {...props}>\n <span className={styles.indicator}>\n {indicatorIcon ? <Icon name={indicatorIcon} label={stateLabel ?? STATE_LABEL[state]} /> : number}\n </span>\n <span className={styles.text}>\n <span className={styles.label}>{label}</span>\n {meta && <span className={styles.meta}>{meta}</span>}\n </span>\n </div>\n );\n});\n",".stepper {\n display: flex;\n margin: var(--space-0);\n padding: var(--space-0);\n list-style: none;\n}\n\n.item {\n display: flex;\n}\n\n.connector {\n display: flex;\n}\n\n.connector::before {\n border: 0 solid var(--color-border-subtle);\n content: '';\n}\n\n.connectorDone::before {\n border-color: var(--color-border-strong);\n}\n\n.horizontal {\n align-items: flex-start;\n width: 100%;\n}\n\n.horizontal .item {\n flex: 1 1 auto;\n align-items: flex-start;\n}\n\n.horizontal .item:last-child {\n flex: none;\n}\n\n/* The connector is as tall as the indicator and centres its line, so the two always line up. */\n.horizontal .connector {\n flex: 1;\n align-items: center;\n min-width: 24px;\n height: 28px;\n margin: var(--space-0) var(--space-12);\n}\n\n.horizontal .connector::before {\n flex: 1;\n border-top-width: var(--stroke-hairline);\n}\n\n.vertical {\n flex-direction: column;\n align-items: center;\n}\n\n.vertical .item {\n flex-direction: column;\n align-items: center;\n}\n\n.vertical .connector {\n justify-content: center;\n height: 16px;\n margin: var(--space-4) var(--space-0);\n}\n\n.vertical .connector::before {\n border-left-width: var(--stroke-hairline);\n}\n","import { forwardRef, type OlHTMLAttributes, type ReactNode } from 'react';\nimport type { IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { Step, type StepState } from './Step';\nimport styles from './Stepper.module.css';\n\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\nexport interface StepperStep {\n /** Stable key for this step. */\n id: string;\n /** Name of the step. */\n label: ReactNode;\n /** Small text under the label. Takes priority over `stateMeta`. */\n meta?: ReactNode;\n /** Icon in the indicator, in place of the number or the state icon. */\n icon?: IconName;\n /** Overrides the state worked out from `current`, usually to mark a step as `failed`. */\n state?: StepState;\n}\n\nexport interface StepperProps extends OlHTMLAttributes<HTMLOListElement> {\n /** The steps, in order. */\n steps: StepperStep[];\n /** Zero-based index of the current step. Earlier steps are done and later ones are upcoming. Use `steps.length` when every step is done. */\n current: number;\n /** Direction of the sequence. Each step stays stacked and centred in both. */\n orientation?: StepperOrientation;\n /** Text under each label, by state, for steps that have no `meta` of their own. */\n stateMeta?: Partial<Record<StepState, ReactNode>>;\n}\n\n/** Shows progress through a fixed sequence. */\nexport const Stepper = forwardRef<HTMLOListElement, StepperProps>(function Stepper(\n { steps, current, orientation = 'horizontal', stateMeta, className, ...props },\n ref,\n) {\n return (\n <ol ref={ref} className={cx(styles.stepper, styles[orientation], className)} {...props}>\n {steps.map((step, index) => {\n const state = step.state ?? (index < current ? 'done' : index === current ? 'current' : 'upcoming');\n return (\n <li key={step.id} className={styles.item}>\n <Step\n label={step.label}\n meta={step.meta ?? stateMeta?.[state]}\n icon={step.icon}\n number={index + 1}\n state={state}\n aria-current={index === current ? 'step' : undefined}\n />\n {index < steps.length - 1 && <span className={cx(styles.connector, state === 'done' && styles.connectorDone)} />}\n </li>\n );\n })}\n </ol>\n );\n});\n",".toggle {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n width: 36px;\n height: 20px;\n padding: 0;\n background: var(--color-control-off);\n border: 0;\n border-radius: var(--radius-full);\n cursor: pointer;\n transition: background-color 120ms ease;\n}\n\n.toggle:hover:not(:disabled),\n.toggle[data-state='hover'] {\n background: var(--color-control-off-hover);\n}\n\n.on {\n background: var(--color-control-on);\n}\n\n.on:hover:not(:disabled),\n.on[data-state='hover'] {\n background: var(--color-bg-accent-hover);\n}\n\n.toggle:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.toggle:disabled {\n background: var(--color-control-disabled);\n cursor: not-allowed;\n}\n\n.thumb {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n background: var(--color-control-thumb);\n border-radius: var(--radius-full);\n transition: transform 120ms ease;\n}\n\n.on .thumb {\n transform: translateX(16px);\n}\n","import { forwardRef, useState, type ButtonHTMLAttributes, type MouseEvent } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './Toggle.module.css';\n\nexport interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'children'> {\n /** Whether it is on, when controlled. */\n checked?: boolean;\n /** Whether it starts on, when uncontrolled. */\n defaultChecked?: boolean;\n /** Called with the new state. */\n onChange?: (checked: boolean) => void;\n}\n\n/**\n * Immediate on and off control. On is orange because it counts as selection. Use SwitchField to include a label;\n * on its own it needs an `aria-label`.\n */\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(\n { checked, defaultChecked = false, onChange, onClick, className, ...props },\n ref,\n) {\n const [innerChecked, setInnerChecked] = useState(defaultChecked);\n const isOn = checked ?? innerChecked;\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={isOn}\n className={cx(styles.toggle, isOn && styles.on, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (checked === undefined) setInnerChecked(!isOn);\n onChange?.(!isOn);\n }}\n {...props}\n >\n <span className={styles.thumb} />\n </button>\n );\n});\n",".root {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-16);\n cursor: pointer;\n}\n\n.text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.label {\n font: var(--font-label-m);\n color: var(--color-text-primary);\n}\n\n.description {\n font: var(--font-caption);\n color: var(--color-text-secondary);\n}\n\n.disabled {\n cursor: not-allowed;\n}\n\n.disabled .label,\n.disabled .description {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, useId, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport { Toggle, type ToggleProps } from '../Toggle';\nimport styles from './SwitchField.module.css';\n\nexport interface SwitchFieldProps extends ToggleProps {\n /** The visible label. */\n label: ReactNode;\n /** A short explanation below the label. */\n description?: ReactNode;\n}\n\n/** A labelled Toggle for settings lists. It takes effect immediately, so do not use it inside a form that needs saving. */\nexport const SwitchField = forwardRef<HTMLButtonElement, SwitchFieldProps>(function SwitchField(\n { label, description, id, className, disabled, ...props },\n ref,\n) {\n const baseId = useId();\n const toggleId = id ?? `${baseId}-toggle`;\n const labelId = `${baseId}-label`;\n const descriptionId = `${baseId}-description`;\n return (\n <label htmlFor={toggleId} className={cx(styles.root, disabled && styles.disabled, className)}>\n <span className={styles.text}>\n <span id={labelId} className={styles.label}>\n {label}\n </span>\n {description && (\n <span id={descriptionId} className={styles.description}>\n {description}\n </span>\n )}\n </span>\n <Toggle\n ref={ref}\n id={toggleId}\n disabled={disabled}\n aria-labelledby={labelId}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n />\n </label>\n );\n});\n","import { createContext, useContext } from 'react';\n\nexport interface TabsContextValue {\n /** The value of the selected tab. */\n value?: string;\n /** Selects a tab because the user asked to. */\n select: (value: string) => void;\n /** Sets the first selection when none was given, without reporting a change. */\n adopt: (value: string) => void;\n tabId: (value: string) => string;\n panelId: (value: string) => string;\n}\n\nexport const TabsContext = createContext<TabsContextValue | null>(null);\n\nexport function useTabsContext(part: string): TabsContextValue {\n const context = useContext(TabsContext);\n if (!context) throw new Error(`${part} must be used inside Tabs.`);\n return context;\n}\n",".tabs {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n","import { forwardRef, useId, useMemo, useState, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { TabsContext, type TabsContextValue } from './TabsContext';\nimport styles from './Tabs.module.css';\n\nexport interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {\n /** The value of the selected tab, when controlled. */\n value?: string;\n /** The value of the first selected tab, when uncontrolled. Defaults to the first tab that is enabled. */\n defaultValue?: string;\n /** Called with the value of the tab the user selects. */\n onChange?: (value: string) => void;\n}\n\nconst idPart = (value: string) => value.replace(/\\s+/g, '-');\n\n/** Switches between views of the same object. Holds a TabList and one TabPanel for each Tab. */\nexport const Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs({ value, defaultValue, onChange, className, ...props }, ref) {\n const id = useId();\n const [innerValue, setInnerValue] = useState(defaultValue);\n const current = value ?? innerValue;\n\n const context = useMemo<TabsContextValue>(\n () => ({\n value: current,\n select: (next) => {\n setInnerValue(next);\n onChange?.(next);\n },\n adopt: setInnerValue,\n tabId: (tab) => `${id}-tab-${idPart(tab)}`,\n panelId: (tab) => `${id}-panel-${idPart(tab)}`,\n }),\n [current, id, onChange],\n );\n\n return (\n <TabsContext.Provider value={context}>\n <div ref={ref} className={cx(styles.tabs, className)} {...props} />\n </TabsContext.Provider>\n );\n});\n",".tabList {\n position: relative;\n display: flex;\n gap: var(--space-4);\n}\n\n.tabList::after {\n position: absolute;\n right: 0;\n bottom: 0;\n left: 0;\n height: 1px;\n background: var(--color-border-subtle);\n content: '';\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { useTabsContext } from './TabsContext';\nimport styles from './TabList.module.css';\n\nexport type TabListProps = HTMLAttributes<HTMLDivElement>;\n\n/** The row of Tab instances on a hairline. Give it an `aria-label`. */\nexport const TabList = forwardRef<HTMLDivElement, TabListProps>(function TabList({ className, ...props }, ref) {\n const listRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => listRef.current as HTMLDivElement, []);\n const { value, adopt } = useTabsContext('TabList');\n\n useEffect(() => {\n if (value !== undefined) return;\n const first = listRef.current?.querySelector<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)');\n if (first?.dataset.value) adopt(first.dataset.value);\n }, [value, adopt]);\n\n return <div ref={listRef} role=\"tablist\" className={cx(styles.tabList, className)} {...props} />;\n});\n","/* Sits above the hairline of the TabList, so the underline covers it. */\n.tab {\n position: relative;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n padding: var(--space-10);\n border: none;\n border-bottom: var(--stroke-strong) solid transparent;\n background: transparent;\n color: var(--color-text-secondary);\n font: var(--font-label-m);\n white-space: nowrap;\n cursor: pointer;\n}\n\n.tab:hover:not(:disabled),\n.tab[data-state='hover'] {\n border-bottom-color: var(--color-border-default);\n color: var(--color-text-primary);\n}\n\n.tab:focus-visible {\n border-radius: var(--radius-sm);\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.tab:disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.tab.selected,\n.tab.selected:hover:not(:disabled) {\n border-bottom-color: var(--color-bg-accent);\n color: var(--color-text-primary);\n}\n\n.count {\n color: var(--color-text-tertiary);\n font: var(--font-mono-s);\n}\n\n.tab:disabled .count {\n color: var(--color-text-disabled);\n}\n","import { forwardRef, type ButtonHTMLAttributes, type KeyboardEvent } from 'react';\nimport { cx } from '../../lib/cx';\nimport { useTabsContext } from './TabsContext';\nimport styles from './Tab.module.css';\n\nexport interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {\n /** Connects this tab to the TabPanel with the same value. */\n value: string;\n /** Number shown after the label. */\n count?: number;\n}\n\n/** One tab in a TabList. The selected tab has an orange underline. Arrow keys move between tabs and select them. */\nexport const Tab = forwardRef<HTMLButtonElement, TabProps>(function Tab(\n { value, count, className, children, onClick, onKeyDown, type = 'button', ...props },\n ref,\n) {\n const { value: selectedValue, select, tabId, panelId } = useTabsContext('Tab');\n const selected = selectedValue === value;\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n const list = event.currentTarget.closest('[role=\"tablist\"]');\n if (!list) return;\n const tabs = Array.from(list.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)'));\n const index = tabs.indexOf(event.currentTarget);\n const targets: Record<string, number> = {\n ArrowRight: (index + 1) % tabs.length,\n ArrowLeft: (index - 1 + tabs.length) % tabs.length,\n Home: 0,\n End: tabs.length - 1,\n };\n const target = tabs[targets[event.key]];\n if (!target) return;\n event.preventDefault();\n target.focus();\n target.click();\n };\n\n return (\n <button\n ref={ref}\n id={tabId(value)}\n type={type}\n role=\"tab\"\n data-value={value}\n aria-selected={selected}\n aria-controls={panelId(value)}\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, selected && styles.selected, className)}\n onClick={(event) => {\n onClick?.(event);\n if (!selected) select(value);\n }}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {children}\n {count !== undefined && <span className={styles.count}>{count}</span>}\n </button>\n );\n});\n",".panel {\n padding-top: var(--space-16);\n border-radius: var(--radius-sm);\n color: var(--color-text-primary);\n font: var(--font-body-m);\n}\n\n.panel:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { useTabsContext } from './TabsContext';\nimport styles from './TabPanel.module.css';\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n /** Connects this panel to the Tab with the same value. */\n value: string;\n}\n\n/** The content of one tab. It only renders its children while its tab is selected. */\nexport const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(function TabPanel({ value, className, children, ...props }, ref) {\n const { value: selectedValue, tabId, panelId } = useTabsContext('TabPanel');\n const selected = selectedValue === value;\n return (\n <div\n ref={ref}\n id={panelId(value)}\n role=\"tabpanel\"\n aria-labelledby={tabId(value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.panel, className)}\n {...props}\n >\n {selected && children}\n </div>\n );\n});\n",".root {\n align-items: flex-start;\n}\n\n.textarea {\n display: block;\n resize: vertical;\n}\n\n.textarea:read-only,\n.textarea:disabled {\n resize: none;\n}\n","import { forwardRef, type TextareaHTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport { useFieldControl } from '../Field/useFieldControl';\nimport control from '../Input/control.module.css';\nimport { LockedTag } from '../Input/LockedTagInternal';\nimport styles from './Textarea.module.css';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Shows the error state and sets `aria-invalid`. */\n invalid?: boolean;\n /** Read-only look with a \"Locked\" tag, for values set by staff. */\n locked?: boolean;\n}\n\n/** Multi-line text control without a label. Use Field for a labelled textarea in a form. */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { invalid, locked, disabled, required, id, readOnly, rows = 3, className, 'aria-describedby': describedBy, ...props },\n ref,\n) {\n const field = useFieldControl({ id, invalid, disabled, locked, required, 'aria-describedby': describedBy });\n return (\n <div\n className={cx(\n control.control,\n styles.root,\n field.invalid && control.invalid,\n field.locked && control.locked,\n field.disabled && control.disabled,\n className,\n )}\n >\n <textarea\n ref={ref}\n id={field.id}\n rows={rows}\n className={cx(control.field, styles.textarea)}\n disabled={field.disabled}\n required={field.required}\n readOnly={field.locked || readOnly}\n aria-invalid={field.invalid || undefined}\n aria-describedby={field.describedBy}\n {...props}\n />\n {field.locked && <LockedTag />}\n </div>\n );\n});\n",".toast {\n position: relative;\n display: flex;\n align-items: flex-start;\n gap: var(--space-8);\n width: 360px;\n max-width: 100%;\n padding: var(--space-14) var(--space-16);\n background: var(--color-bg-surface);\n border: var(--stroke-hairline) solid var(--color-border-subtle);\n border-radius: var(--radius-lg);\n box-shadow: var(--elevation-overlay);\n color: var(--color-text-primary);\n}\n\n.dismissible {\n padding-right: var(--space-40);\n}\n\n.icon {\n flex: none;\n margin-top: var(--space-2);\n}\n\n.content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n\n.title {\n font: var(--font-heading-s);\n}\n\n.body {\n color: var(--color-text-secondary);\n font: var(--font-body-s);\n}\n\n.action {\n margin-top: var(--space-2);\n font: var(--font-label-s);\n}\n\n.dismiss {\n position: absolute;\n top: var(--space-8);\n right: var(--space-8);\n}\n\n.neutral .icon {\n color: var(--color-icon-primary);\n}\n\n.success .icon {\n color: var(--color-icon-success);\n}\n\n.warning .icon {\n color: var(--color-icon-warning);\n}\n\n.danger .icon {\n color: var(--color-icon-danger);\n}\n\n.progress .icon {\n color: var(--color-icon-primary);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport { IconButton } from '../IconButton';\nimport { ProgressBar } from '../ProgressBar';\nimport styles from './Toast.module.css';\n\nexport type ToastTone = 'neutral' | 'success' | 'warning' | 'danger' | 'progress';\n\nconst TONE_ICONS: Record<ToastTone, IconName> = {\n neutral: 'info',\n success: 'check-circle',\n warning: 'alert-triangle',\n danger: 'x-circle',\n progress: 'clock',\n};\n\nexport interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** What kind of message this is. */\n tone?: ToastTone;\n /** The headline. */\n title: ReactNode;\n /** A short confirmation of what happened. */\n body?: ReactNode;\n /** A follow-up, normally a Link. Never the only route to an action. */\n action?: ReactNode;\n /** Shows a dismiss button, and is called when it is pressed. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss button. */\n dismissLabel?: string;\n /** Percentage complete, from 0 to 100. Only used by the `progress` tone. */\n progress?: number;\n}\n\n/**\n * A brief floating message about something the user just did. Show it inside a ToastStack, whose live region\n * announces it. Danger is also an alert, so it is announced straight away.\n */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { tone = 'neutral', title, body, action, onDismiss, dismissLabel = 'Dismiss', progress = 0, className, ...props },\n ref,\n) {\n const value = Math.min(100, Math.max(0, progress));\n\n return (\n <div\n ref={ref}\n role={tone === 'danger' ? 'alert' : undefined}\n className={cx(styles.toast, styles[tone], onDismiss && styles.dismissible, className)}\n {...props}\n >\n <Icon name={TONE_ICONS[tone]} className={styles.icon} />\n <div className={styles.content}>\n <div className={styles.title}>{title}</div>\n {body && <div className={styles.body}>{body}</div>}\n {tone === 'progress' && <ProgressBar value={value} tone=\"accent\" aria-label={typeof title === 'string' ? title : 'Progress'} />}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n {onDismiss && <IconButton className={styles.dismiss} icon=\"x\" label={dismissLabel} variant=\"ghost\" size=\"sm\" onClick={onDismiss} />}\n </div>\n );\n});\n",".stack {\n position: fixed;\n right: var(--space-24);\n bottom: var(--space-24);\n z-index: 1300;\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n max-width: calc(100vw - var(--space-48));\n pointer-events: none;\n}\n\n.stack > * {\n pointer-events: auto;\n}\n","import { Children, forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport styles from './ToastStack.module.css';\n\nexport interface ToastStackProps extends HTMLAttributes<HTMLDivElement> {\n /** Toast elements, oldest first. The newest shows at the bottom. */\n children?: ReactNode;\n /** How many toasts to show. The newest ones win. */\n max?: number;\n /** Accessible name of the region. */\n 'aria-label'?: string;\n}\n\n/** The fixed bottom-right region that holds toasts. It stays mounted when empty, so screen readers keep watching it. */\nexport const ToastStack = forwardRef<HTMLDivElement, ToastStackProps>(function ToastStack(\n { children, max = 3, className, 'aria-label': ariaLabel = 'Notifications', ...props },\n ref,\n) {\n if (typeof document === 'undefined') return null;\n\n const visible = Children.toArray(children).slice(-max);\n\n return createPortal(\n <div\n ref={ref}\n role=\"region\"\n aria-label={ariaLabel}\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n data-focus-scope=\"\"\n className={cx(styles.stack, className)}\n {...props}\n >\n {visible}\n </div>,\n document.body,\n );\n});\n","import { createContext, useContext, type ReactNode } from 'react';\nimport type { ToastTone } from './Toast';\n\nexport interface ToastOptions {\n /** What kind of message this is. */\n tone?: ToastTone;\n /** The headline. */\n title: ReactNode;\n /** A short confirmation of what happened. */\n body?: ReactNode;\n /** A follow-up, normally a Link. */\n action?: ReactNode;\n /** Milliseconds before it leaves on its own. Defaults to about 5 s, except for danger, which stays until dismissed. */\n duration?: number;\n /** Percentage complete, for the `progress` tone. */\n progress?: number;\n}\n\nexport interface ToastContextValue {\n /** Shows a toast and returns its id. */\n toast: (options: ToastOptions) => string;\n /** Removes a toast by id. */\n dismiss: (id: string) => void;\n}\n\nexport const ToastContext = createContext<ToastContextValue | null>(null);\n\n/** Shows and dismisses toasts. Must be used inside a ToastProvider. */\nexport function useToast(): ToastContextValue {\n const context = useContext(ToastContext);\n if (!context) throw new Error('useToast must be used inside a ToastProvider.');\n return context;\n}\n","import { useCallback, useEffect, useMemo, useRef, useState, type FocusEvent, type ReactNode } from 'react';\nimport { Toast } from './Toast';\nimport { ToastStack } from './ToastStack';\nimport { ToastContext, type ToastOptions } from './useToast';\n\nconst DEFAULT_DURATION = 5000;\n\ninterface ToastRecord extends ToastOptions {\n id: string;\n}\n\ninterface ToastTimer {\n remaining: number;\n startedAt: number;\n handle?: ReturnType<typeof setTimeout>;\n}\n\nexport interface ToastProviderProps {\n /** The part of the app that can show toasts. */\n children?: ReactNode;\n /** How many toasts to show at once. */\n max?: number;\n}\n\n/**\n * Provides `useToast` and renders the ToastStack. Toasts leave after about 5 s, except danger, which stays.\n * Timers pause while the pointer or keyboard focus is inside the stack.\n */\nexport function ToastProvider({ children, max = 3 }: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const nextId = useRef(0);\n const timers = useRef(new Map<string, ToastTimer>());\n const hovered = useRef(false);\n const focused = useRef(false);\n const stackRef = useRef<HTMLDivElement>(null);\n\n const dismiss = useCallback((id: string) => {\n const timer = timers.current.get(id);\n if (timer) clearTimeout(timer.handle);\n timers.current.delete(id);\n setToasts((current) => current.filter((item) => item.id !== id));\n }, []);\n\n const runTimer = useCallback(\n (id: string, timer: ToastTimer) => {\n timer.startedAt = Date.now();\n timer.handle = setTimeout(() => dismiss(id), timer.remaining);\n },\n [dismiss],\n );\n\n const toast = useCallback(\n (options: ToastOptions) => {\n nextId.current += 1;\n const id = `toast-${nextId.current}`;\n const duration = options.duration ?? (options.tone === 'danger' || options.tone === 'progress' ? undefined : DEFAULT_DURATION);\n setToasts((current) => [...current, { ...options, id }]);\n if (duration !== undefined) {\n const timer: ToastTimer = { remaining: duration, startedAt: 0 };\n timers.current.set(id, timer);\n if (!hovered.current && !focused.current) runTimer(id, timer);\n }\n return id;\n },\n [runTimer],\n );\n\n const syncTimers = useCallback(() => {\n const paused = hovered.current || focused.current;\n timers.current.forEach((timer, id) => {\n if (paused && timer.handle !== undefined) {\n clearTimeout(timer.handle);\n timer.handle = undefined;\n timer.remaining -= Date.now() - timer.startedAt;\n } else if (!paused && timer.handle === undefined) {\n runTimer(id, timer);\n }\n });\n }, [runTimer]);\n\n const setHovered = (value: boolean) => {\n hovered.current = value;\n syncTimers();\n };\n const setFocused = (value: boolean) => {\n focused.current = value;\n syncTimers();\n };\n\n // Browsers may not fire blur when the focused toast is removed, which would leave the timers paused.\n useEffect(() => {\n if (focused.current && !stackRef.current?.contains(document.activeElement)) {\n focused.current = false;\n syncTimers();\n }\n }, [toasts, syncTimers]);\n\n useEffect(() => {\n const active = timers.current;\n return () => {\n active.forEach((timer) => clearTimeout(timer.handle));\n active.clear();\n };\n }, []);\n\n const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={value}>\n {children}\n <ToastStack\n ref={stackRef}\n max={max}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={(event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);\n }}\n >\n {toasts.map(({ id, duration: _duration, ...options }) => (\n <Toast key={id} {...options} onDismiss={() => dismiss(id)} />\n ))}\n </ToastStack>\n </ToastContext.Provider>\n );\n}\n",".tooltip {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1200;\n width: max-content;\n max-width: 240px;\n padding: var(--space-6) var(--space-8);\n background: var(--color-bg-inverse);\n border-radius: var(--radius-md);\n color: var(--color-text-inverse);\n font: var(--font-caption);\n}\n\n.arrow {\n position: absolute;\n width: 8px;\n height: 8px;\n background: var(--color-bg-inverse);\n transform: translate(-50%, -50%) rotate(45deg);\n}\n\n.tooltip[data-placement='top'] .arrow {\n top: 100%;\n left: var(--arrow-offset);\n}\n\n.tooltip[data-placement='bottom'] .arrow {\n top: 0;\n left: var(--arrow-offset);\n}\n\n.tooltip[data-placement='left'] .arrow {\n top: var(--arrow-offset);\n left: 100%;\n}\n\n.tooltip[data-placement='right'] .arrow {\n top: var(--arrow-offset);\n left: 0;\n}\n","import {\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEvent,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { cx } from '../../lib/cx';\nimport { TriggerSlot, useAnchoredPosition, type AnchoredPlacement } from './useAnchoredPosition';\nimport styles from './Tooltip.module.css';\n\nexport type TooltipPlacement = AnchoredPlacement;\n\n/** Long enough to travel from the target to the tooltip without it closing. */\nconst HIDE_DELAY = 100;\n/** Distance from the target, leaving room for the arrow. */\nconst GAP = 8;\n\nexport interface TooltipProps {\n /** The hint text. Never put essential information or actions in a tooltip. */\n content: ReactNode;\n /** Which side of the target the tooltip sits on. It flips if there isn't room. */\n placement?: TooltipPlacement;\n /** Milliseconds before the tooltip opens on hover or focus. */\n delay?: number;\n /** One focusable element, which must accept mouse, focus and ARIA props. */\n children: ReactElement<HTMLAttributes<HTMLElement>>;\n /** Extra class for the tooltip. */\n className?: string;\n}\n\n/** A short hint for one focusable element, shown on hover and focus. Escape hides it. */\nexport function Tooltip({ content, placement = 'top', delay = 150, children, className }: TooltipProps) {\n const [open, setOpen] = useState(false);\n const tooltipId = useId();\n const anchorRef = useRef<HTMLElement | null>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n const getAnchor = useCallback(() => anchorRef.current, []);\n useAnchoredPosition(open, getAnchor, tooltipRef, placement, GAP);\n\n const schedule = (nextOpen: boolean, wait: number) => {\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => setOpen(nextOpen), wait);\n };\n const show = (anchor: HTMLElement) => {\n anchorRef.current = anchor;\n schedule(true, delay);\n };\n const hideNow = () => {\n clearTimeout(timerRef.current);\n setOpen(false);\n };\n\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n useEffect(() => {\n if (!open) return;\n // Capture, so that a surrounding Dialog sees the key as handled and stays open.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n setOpen(false);\n }\n };\n document.addEventListener('keydown', onKeyDown, true);\n return () => document.removeEventListener('keydown', onKeyDown, true);\n }, [open]);\n\n const child = children.props;\n const triggerProps = {\n 'aria-describedby': open ? cx(child['aria-describedby'], tooltipId) : child['aria-describedby'],\n onMouseEnter: (event: MouseEvent<HTMLElement>) => {\n child.onMouseEnter?.(event);\n show(event.currentTarget);\n },\n onMouseLeave: (event: MouseEvent<HTMLElement>) => {\n child.onMouseLeave?.(event);\n schedule(false, HIDE_DELAY);\n },\n onFocus: (event: FocusEvent<HTMLElement>) => {\n child.onFocus?.(event);\n show(event.currentTarget);\n },\n onBlur: (event: FocusEvent<HTMLElement>) => {\n child.onBlur?.(event);\n hideNow();\n },\n };\n\n return (\n <>\n <TriggerSlot element={children} {...triggerProps} />\n {open &&\n createPortal(\n <div\n ref={tooltipRef}\n id={tooltipId}\n role=\"tooltip\"\n className={cx(styles.tooltip, className)}\n onMouseEnter={() => clearTimeout(timerRef.current)}\n onMouseLeave={() => schedule(false, HIDE_DELAY)}\n >\n {content}\n <span className={styles.arrow} aria-hidden=\"true\" />\n </div>,\n document.body,\n )}\n </>\n );\n}\n",".topBar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-24);\n box-sizing: border-box;\n height: 56px;\n padding: var(--space-0) var(--space-24);\n border-bottom: var(--stroke-hairline) solid var(--color-border-subtle);\n background: var(--color-bg-canvas);\n}\n\n.left,\n.right {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n\n.left {\n gap: var(--space-8);\n}\n\n.right {\n flex: none;\n gap: var(--space-16);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TopBar.module.css';\n\nexport interface TopBarProps extends HTMLAttributes<HTMLElement> {\n /** Where you are: a breadcrumb or context switchers. */\n left?: ReactNode;\n /** Global tools: status, docs link, inbox and account. */\n right?: ReactNode;\n}\n\n/** The 56 px bar across the top of the app. */\nexport const TopBar = forwardRef<HTMLElement, TopBarProps>(function TopBar({ left, right, className, ...props }, ref) {\n return (\n <header ref={ref} className={cx(styles.topBar, className)} {...props}>\n <div className={styles.left}>{left}</div>\n <div className={styles.right}>{right}</div>\n </header>\n );\n});\n",".switcher {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n min-width: 0;\n padding: var(--space-6) var(--space-8);\n border: none;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--color-text-primary);\n font: var(--font-heading-s);\n cursor: pointer;\n}\n\n.switcher:hover:not(:disabled),\n.switcher[data-state='hover'] {\n background: var(--color-bg-hover);\n}\n\n.switcher:focus-visible {\n outline: var(--stroke-strong) solid var(--color-border-focus);\n outline-offset: var(--space-2);\n}\n\n.switcher:disabled {\n color: var(--color-text-disabled);\n cursor: not-allowed;\n}\n\n.icon {\n flex: none;\n}\n\n.name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { Icon, type IconName } from '../../icons';\nimport { cx } from '../../lib/cx';\nimport styles from './ContextSwitcher.module.css';\n\nexport interface ContextSwitcherProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'name' | 'children'> {\n /** Name of the current organisation, project or environment. */\n name: string;\n /** Icon before the name. */\n icon?: IconName;\n}\n\n/** Shows the current context and opens the menu to change it. */\nexport const ContextSwitcher = forwardRef<HTMLButtonElement, ContextSwitcherProps>(function ContextSwitcher(\n { name, icon, className, type = 'button', ...props },\n ref,\n) {\n return (\n <button ref={ref} type={type} className={cx(styles.switcher, className)} {...props}>\n {icon && <Icon name={icon} className={styles.icon} />}\n <span className={styles.name}>{name}</span>\n <Icon name=\"chevrons-up-down\" className={styles.icon} />\n </button>\n );\n});\n",".separator {\n color: var(--color-text-tertiary);\n font: var(--font-body-m);\n}\n","import { forwardRef, type HTMLAttributes } from 'react';\nimport { cx } from '../../lib/cx';\nimport styles from './TopBarSeparator.module.css';\n\nexport type TopBarSeparatorProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'>;\n\n/** The slash between two context switchers. It is decorative, so screen readers skip it. */\nexport const TopBarSeparator = forwardRef<HTMLSpanElement, TopBarSeparatorProps>(function TopBarSeparator({ className, ...props }, ref) {\n return (\n <span ref={ref} className={cx(styles.separator, className)} aria-hidden=\"true\" {...props}>\n /\n </span>\n );\n});\n"],"mappings":";;;;AAEA,IAAM6gB,IAAS,6CAGFC,IAAY;CACvB,MAAM;CACN,OAAO;CACP,OAAO;CACP,GAAG;CACH,gBAAgB;CAChB,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,oBAAoB;CACpB,eAAe;CACf,cAAc;CACd,YAAY;CACZ,cAAc;CACd,iBAAiB;CACjB,Q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