@openwarelabs/ui 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppShell/AppShell.context.d.cts +21 -0
- package/dist/components/AppShell/AppShell.context.d.ts +21 -0
- package/dist/components/AppShell/AppShell.d.cts +17 -0
- package/dist/components/AppShell/AppShell.d.ts +17 -0
- package/dist/components/AppShell/AppShell.types.d.cts +46 -0
- package/dist/components/AppShell/AppShell.types.d.ts +46 -0
- package/dist/components/Chart/BarChart.d.cts +6 -0
- package/dist/components/Chart/BarChart.d.ts +6 -0
- package/dist/components/Chart/Cartesian.d.cts +8 -0
- package/dist/components/Chart/Cartesian.d.ts +8 -0
- package/dist/components/Chart/Chart.d.cts +5 -0
- package/dist/components/Chart/Chart.d.ts +5 -0
- package/dist/components/Chart/Chart.types.d.cts +83 -0
- package/dist/components/Chart/Chart.types.d.ts +83 -0
- package/dist/components/Chart/ChartParts.d.cts +16 -0
- package/dist/components/Chart/ChartParts.d.ts +16 -0
- package/dist/components/Chart/DonutChart.d.cts +6 -0
- package/dist/components/Chart/DonutChart.d.ts +6 -0
- package/dist/components/Chart/LineChart.d.cts +6 -0
- package/dist/components/Chart/LineChart.d.ts +6 -0
- package/dist/components/Chart/Sparkline.d.cts +6 -0
- package/dist/components/Chart/Sparkline.d.ts +6 -0
- package/dist/components/Chart/chartUtils.d.cts +13 -0
- package/dist/components/Chart/chartUtils.d.ts +13 -0
- package/dist/components/NavList/NavList.d.cts +6 -24
- package/dist/components/NavList/NavList.d.ts +6 -24
- package/dist/components/NavList/NavList.types.d.cts +23 -0
- package/dist/components/NavList/NavList.types.d.ts +23 -0
- package/dist/components.css +511 -0
- package/dist/icons.d.cts +3 -0
- package/dist/icons.d.ts +3 -0
- package/dist/index.cjs +1299 -729
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1281 -711
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +8 -8
- package/dist/styles.css +541 -0
- package/dist/tailwind.css +10 -0
- package/dist/tokens.css +30 -0
- package/dist/tokens.json +80 -0
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/utils/cx.ts", "../src/components/Text/Text.tsx", "../src/components/Button/Button.tsx", "../src/utils/text.ts", "../src/components/Spinner/Spinner.tsx", "../src/components/Button/ButtonGroup.tsx", "../src/hooks/useControllableState.ts", "../src/icons.tsx", "../src/components/SegmentedControl/SegmentedControl.tsx", "../src/hooks/useIndicator.ts", "../src/components/ChoiceCard/ChoiceCard.tsx", "../src/components/CodeBlock/CodeBlock.tsx", "../src/utils/copyText.ts", "../src/components/ToggleButtonGroup/ToggleButtonGroup.tsx", "../src/components/Toolbar/Toolbar.tsx", "../src/components/Tooltip/Tooltip.tsx", "../src/hooks/useFloating.ts", "../src/hooks/usePresence.ts", "../src/components/Field/Field.tsx", "../src/components/Checkbox/Checkbox.tsx", "../src/components/Form/Form.tsx", "../src/components/Alert/Alert.tsx", "../src/components/Input/Input.tsx", "../src/components/SearchField/SearchField.tsx", "../src/components/NumberField/NumberField.tsx", "../src/components/InputOTP/InputOTP.tsx", "../src/components/DateField/DateField.tsx", "../src/components/Calendar/dates.ts", "../src/components/DateField/SegmentedField.tsx", "../src/components/DateField/TimeField.tsx", "../src/components/Textarea/Textarea.tsx", "../src/utils/resizeTextArea.ts", "../src/components/Select/Select.tsx", "../src/components/ListBox/ListBox.tsx", "../src/components/Combobox/Combobox.tsx", "../src/components/RadioGroup/RadioGroup.tsx", "../src/components/Switch/Switch.tsx", "../src/components/Slider/Slider.tsx", "../src/components/FileDropZone/FileDropZone.tsx", "../src/components/Calendar/Calendar.tsx", "../src/components/Calendar/DatePicker.tsx", "../src/components/Calendar/RangeCalendar.tsx", "../src/components/Calendar/DateRangePicker.tsx", "../src/components/Badge/Badge.tsx", "../src/components/Progress/Progress.tsx", "../src/components/Meter/Meter.tsx", "../src/components/Skeleton/Skeleton.tsx", "../src/components/Toast/Toast.tsx", "../src/components/Dialog/Dialog.tsx", "../src/hooks/useModalDialog.ts", "../src/components/Drawer/Drawer.tsx", "../src/components/Popover/Popover.tsx", "../src/components/Menu/Menu.tsx", "../src/hooks/useMenuKeyboard.ts", "../src/components/CommandPalette/CommandPalette.tsx", "../src/components/CommandPalette/filterCommands.ts", "../src/components/Tabs/Tabs.tsx", "../src/components/Accordion/Accordion.tsx", "../src/components/Breadcrumbs/Breadcrumbs.tsx", "../src/components/Pagination/Pagination.tsx", "../src/components/Steps/Steps.tsx", "../src/components/NavList/NavList.tsx", "../src/components/Table/Table.tsx", "../src/components/Stat/Stat.tsx", "../src/components/FileTree/FileTree.tsx", "../src/components/EmptyState/EmptyState.tsx", "../src/components/Tag/Tag.tsx", "../src/components/Avatar/Avatar.tsx", "../src/components/Avatar/AvatarGroup.tsx", "../src/components/Kbd/Kbd.tsx", "../src/components/Card/Card.tsx", "../src/components/
|
|
4
|
-
"sourcesContent": ["// Openware UI. Import the components from here and the CSS once:\n// import \"@openwarelabs/ui/fonts.css\";\n// import \"@openwarelabs/ui/styles.css\";\n\n// Typography\nexport { Text } from \"./components/Text/Text\";\nexport type { TextProps, TextVariant, TextTone } from \"./components/Text/Text\";\n\n// Buttons\nexport { Button, buttonClassName } from \"./components/Button/Button\";\nexport type { ButtonProps, ButtonStyleOptions, ButtonVariant, ButtonSize, ButtonShape } from \"./components/Button/Button\";\nexport { ButtonGroup, CloseButton, ToggleButton } from \"./components/Button/ButtonGroup\";\nexport type { ButtonGroupProps, CloseButtonProps, ToggleButtonProps } from \"./components/Button/ButtonGroup\";\nexport { SegmentedControl } from \"./components/SegmentedControl/SegmentedControl\";\nexport type { SegmentedControlProps, SegmentedControlOption } from \"./components/SegmentedControl/SegmentedControl\";\nexport { ChoiceCard } from \"./components/ChoiceCard/ChoiceCard\";\nexport type { ChoiceCardProps } from \"./components/ChoiceCard/ChoiceCard\";\nexport { CopyButton, CodeBlock, Snippet } from \"./components/CodeBlock/CodeBlock\";\nexport type { CopyButtonProps, CodeBlockProps, SnippetProps } from \"./components/CodeBlock/CodeBlock\";\nexport { ToggleButtonGroup } from \"./components/ToggleButtonGroup/ToggleButtonGroup\";\nexport type {\n ToggleButtonGroupProps,\n ToggleButtonGroupOption,\n ToggleButtonGroupSingleProps,\n ToggleButtonGroupMultipleProps,\n} from \"./components/ToggleButtonGroup/ToggleButtonGroup\";\nexport { Toolbar, ToolbarSeparator } from \"./components/Toolbar/Toolbar\";\nexport type { ToolbarProps, ToolbarSeparatorProps } from \"./components/Toolbar/Toolbar\";\n\n// Forms\nexport { Field } from \"./components/Field/Field\";\nexport type { FieldProps } from \"./components/Field/Field\";\nexport { Form, FormError, useFormStatus } from \"./components/Form/Form\";\nexport type { FormProps, FormErrorProps, FormStatus, FormValues, FormErrors, ValidityCheck, ValidityMessages } from \"./components/Form/Form\";\nexport { Input } from \"./components/Input/Input\";\nexport type { InputProps } from \"./components/Input/Input\";\nexport { SearchField } from \"./components/SearchField/SearchField\";\nexport type { SearchFieldProps } from \"./components/SearchField/SearchField\";\nexport { NumberField } from \"./components/NumberField/NumberField\";\nexport type { NumberFieldProps } from \"./components/NumberField/NumberField\";\nexport { InputOTP } from \"./components/InputOTP/InputOTP\";\nexport type { InputOTPProps } from \"./components/InputOTP/InputOTP\";\nexport { DateField } from \"./components/DateField/DateField\";\nexport type { DateFieldProps } from \"./components/DateField/DateField\";\nexport { TimeField } from \"./components/DateField/TimeField\";\nexport type { TimeFieldProps } from \"./components/DateField/TimeField\";\nexport { Textarea } from \"./components/Textarea/Textarea\";\nexport type { TextareaProps } from \"./components/Textarea/Textarea\";\nexport { Select } from \"./components/Select/Select\";\nexport type { SelectProps, SelectOption, SelectGroup, SelectItem } from \"./components/Select/Select\";\nexport { ListBox } from \"./components/ListBox/ListBox\";\nexport type { ListBoxProps, ListBoxModeProps, ListBoxOption, ListBoxGroup, ListBoxItem, ListBoxSelectionMode } from \"./components/ListBox/ListBox\";\nexport { Combobox } from \"./components/Combobox/Combobox\";\nexport type { ComboboxProps, ComboboxOption } from \"./components/Combobox/Combobox\";\nexport { Checkbox, CheckboxGroup, Fieldset } from \"./components/Checkbox/Checkbox\";\nexport type { CheckboxProps, CheckboxGroupProps, FieldsetProps } from \"./components/Checkbox/Checkbox\";\nexport { RadioGroup, Radio } from \"./components/RadioGroup/RadioGroup\";\nexport type { RadioGroupProps, RadioProps } from \"./components/RadioGroup/RadioGroup\";\nexport { Switch } from \"./components/Switch/Switch\";\nexport type { SwitchProps } from \"./components/Switch/Switch\";\nexport { Slider } from \"./components/Slider/Slider\";\nexport type { SliderProps } from \"./components/Slider/Slider\";\nexport { FileDropZone } from \"./components/FileDropZone/FileDropZone\";\nexport type { FileDropZoneProps } from \"./components/FileDropZone/FileDropZone\";\n\n// Dates\nexport { Calendar } from \"./components/Calendar/Calendar\";\nexport type { CalendarProps, CalendarHandle } from \"./components/Calendar/Calendar\";\nexport { DatePicker } from \"./components/Calendar/DatePicker\";\nexport type { DatePickerProps } from \"./components/Calendar/DatePicker\";\nexport { RangeCalendar } from \"./components/Calendar/RangeCalendar\";\nexport type { RangeCalendarProps, DateRange } from \"./components/Calendar/RangeCalendar\";\nexport { formatDateRange } from \"./components/Calendar/dates\";\nexport { DateRangePicker } from \"./components/Calendar/DateRangePicker\";\nexport type { DateRangePickerProps, DateRangePreset } from \"./components/Calendar/DateRangePicker\";\nexport { todayISO, addDays, addMonths, formatDate, weekday, parseISO, toISO } from \"./components/Calendar/dates\";\nexport type { ISODate } from \"./components/Calendar/dates\";\n\n// Feedback\nexport { Alert } from \"./components/Alert/Alert\";\nexport type { AlertProps, AlertVariant } from \"./components/Alert/Alert\";\nexport { Badge } from \"./components/Badge/Badge\";\nexport type { BadgeProps, BadgeVariant } from \"./components/Badge/Badge\";\nexport { ProgressBar, ProgressCircle } from \"./components/Progress/Progress\";\nexport type { ProgressBarProps, ProgressCircleProps, ProgressTone } from \"./components/Progress/Progress\";\nexport { Meter } from \"./components/Meter/Meter\";\nexport type { MeterProps } from \"./components/Meter/Meter\";\nexport { Spinner } from \"./components/Spinner/Spinner\";\nexport type { SpinnerProps } from \"./components/Spinner/Spinner\";\nexport { Skeleton, SkeletonRows } from \"./components/Skeleton/Skeleton\";\nexport type { SkeletonProps, SkeletonRowsProps } from \"./components/Skeleton/Skeleton\";\nexport { Toaster, toast } from \"./components/Toast/Toast\";\nexport type { ToasterProps, ToastOptions } from \"./components/Toast/Toast\";\nexport { Tooltip } from \"./components/Tooltip/Tooltip\";\nexport type { TooltipProps } from \"./components/Tooltip/Tooltip\";\n\n// Overlays\nexport { Dialog, ConfirmDialog } from \"./components/Dialog/Dialog\";\nexport type { DialogProps, ConfirmDialogProps } from \"./components/Dialog/Dialog\";\nexport { Drawer } from \"./components/Drawer/Drawer\";\nexport type { DrawerProps } from \"./components/Drawer/Drawer\";\nexport { Popover } from \"./components/Popover/Popover\";\nexport type { PopoverProps } from \"./components/Popover/Popover\";\nexport { Menu, MenuItem, MenuLabel, MenuSeparator } from \"./components/Menu/Menu\";\nexport type { MenuProps, MenuItemProps } from \"./components/Menu/Menu\";\nexport { CommandPalette } from \"./components/CommandPalette/CommandPalette\";\nexport type { Command, CommandPaletteProps } from \"./components/CommandPalette/CommandPalette\";\nexport { filterCommands } from \"./components/CommandPalette/filterCommands\";\n\n// Navigation\nexport { Tabs, TabList, Tab, TabPanel } from \"./components/Tabs/Tabs\";\nexport type { TabsProps, TabListProps, TabProps, TabPanelProps } from \"./components/Tabs/Tabs\";\nexport { Accordion, AccordionItem, Disclosure } from \"./components/Accordion/Accordion\";\nexport type { AccordionProps, AccordionItemProps, DisclosureProps } from \"./components/Accordion/Accordion\";\nexport { Breadcrumbs, Link, linkClassName } from \"./components/Breadcrumbs/Breadcrumbs\";\nexport type { BreadcrumbsProps, BreadcrumbItem, LinkProps, LinkStyleOptions } from \"./components/Breadcrumbs/Breadcrumbs\";\nexport { Pagination, paginationItems } from \"./components/Pagination/Pagination\";\nexport type { PaginationProps } from \"./components/Pagination/Pagination\";\nexport { Steps } from \"./components/Steps/Steps\";\nexport type { StepsProps, StepItem } from \"./components/Steps/Steps\";\nexport { NavList, NavItem } from \"./components/NavList/NavList\";\nexport type { NavListProps, NavItemProps } from \"./components/NavList/NavList\";\n\n// Data display\nexport { Table } from \"./components/Table/Table\";\nexport type { TableProps, TableColumn, TableSort } from \"./components/Table/Table\";\nexport { Stat } from \"./components/Stat/Stat\";\nexport type { StatProps } from \"./components/Stat/Stat\";\nexport { FileTree } from \"./components/FileTree/FileTree\";\nexport type { FileTreeProps, FileTreeNode } from \"./components/FileTree/FileTree\";\nexport { EmptyState } from \"./components/EmptyState/EmptyState\";\nexport type { EmptyStateProps } from \"./components/EmptyState/EmptyState\";\nexport { Tag, TagGroup, ColorSwatch } from \"./components/Tag/Tag\";\nexport type { TagProps, TagGroupProps, ColorSwatchProps } from \"./components/Tag/Tag\";\nexport { Avatar } from \"./components/Avatar/Avatar\";\nexport type { AvatarProps, AvatarSize } from \"./components/Avatar/Avatar\";\nexport { AvatarGroup, User } from \"./components/Avatar/AvatarGroup\";\nexport type { AvatarGroupProps, UserProps } from \"./components/Avatar/AvatarGroup\";\nexport { Kbd, Code } from \"./components/Kbd/Kbd\";\n\n// Layout\nexport { Card, SettingsRow } from \"./components/Card/Card\";\nexport type { CardProps, SettingsRowProps } from \"./components/Card/Card\";\nexport { Stack, Separator, ScrollShadow, VisuallyHidden } from \"./components/Layout/Layout\";\nexport { Container } from \"./components/Container/Container\";\nexport type { ContainerProps, ContainerSize } from \"./components/Container/Container\";\nexport { Section } from \"./components/Section/Section\";\nexport type { SectionProps } from \"./components/Section/Section\";\nexport type { StackProps, SeparatorProps, ScrollShadowProps, SpaceToken } from \"./components/Layout/Layout\";\n\n// Marketing\nexport { Chip, SectionHeading, SiteHeader, DotGrid } from \"./components/Marketing/Marketing\";\nexport type { SectionHeadingProps, SiteHeaderProps, DotGridProps } from \"./components/Marketing/Marketing\";\n\n// AI\nexport { Prose } from \"./components/Prose/Prose\";\nexport type { ProseProps } from \"./components/Prose/Prose\";\nexport { TextShimmer } from \"./components/TextShimmer/TextShimmer\";\nexport type { TextShimmerProps } from \"./components/TextShimmer/TextShimmer\";\nexport { PromptInput } from \"./components/PromptInput/PromptInput\";\nexport type { PromptInputProps, PromptAttachment } from \"./components/PromptInput/PromptInput\";\nexport { PromptSuggestion, PromptSuggestions } from \"./components/PromptInput/PromptSuggestion\";\nexport type { PromptSuggestionProps, PromptSuggestionsProps } from \"./components/PromptInput/PromptSuggestion\";\nexport { ChatConversation } from \"./components/Chat/ChatConversation\";\nexport type { ChatConversationProps, ChatConversationHandle } from \"./components/Chat/ChatConversation\";\nexport { ChatMessage, ChatMessageActions, ChatAgentAvatar } from \"./components/Chat/ChatMessage\";\nexport type {\n ChatMessageProps,\n ChatMessageActionsProps,\n ChatAgentAvatarProps,\n ChatMessageFrom,\n ChatMessageStatus,\n ChatRating,\n} from \"./components/Chat/ChatMessage\";\nexport { ChatLoader } from \"./components/Chat/ChatLoader\";\nexport type { ChatLoaderProps } from \"./components/Chat/ChatLoader\";\nexport { ChatTool } from \"./components/ChatTool/ChatTool\";\nexport type { ChatToolProps, ChatToolStatus } from \"./components/ChatTool/ChatTool\";\nexport { ChainOfThought } from \"./components/ChainOfThought/ChainOfThought\";\nexport type { ChainOfThoughtProps, ChainOfThoughtStep, ChainOfThoughtStatus } from \"./components/ChainOfThought/ChainOfThought\";\nexport { ChatSource, ChatSources } from \"./components/ChatSource/ChatSource\";\nexport type { ChatSourceProps, ChatSourcesProps, ChatSourceItem } from \"./components/ChatSource/ChatSource\";\n\n// Hooks and helpers\nexport { ColorField, ColorPicker } from \"./components/ColorPicker/ColorPicker\";\nexport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from \"./components/ColorPicker/ColorPicker\";\nexport { ColorArea } from \"./components/ColorPicker/ColorArea\";\nexport type { ColorAreaProps } from \"./components/ColorPicker/ColorArea\";\nexport { ColorSlider } from \"./components/ColorPicker/ColorSlider\";\nexport type { ColorChannel, ColorSliderProps } from \"./components/ColorPicker/ColorSlider\";\nexport { ColorSwatchPicker } from \"./components/ColorPicker/ColorSwatchPicker\";\nexport type { ColorSwatchPickerOption, ColorSwatchPickerProps } from \"./components/ColorPicker/ColorSwatchPicker\";\nexport { applyBrand, brandCss, brandPresets, brandScale, brandSteps, brandVariables } from \"./utils/brand\";\nexport type { BrandPreset, BrandScale, BrandStep } from \"./utils/brand\";\nexport { useModalDialog } from \"./hooks/useModalDialog\";\nexport { useMenuKeyboard } from \"./hooks/useMenuKeyboard\";\nexport { useControllableState } from \"./hooks/useControllableState\";\nexport { useFloating, useDismiss } from \"./hooks/useFloating\";\nexport { usePresence } from \"./hooks/usePresence\";\nexport type { Presence } from \"./hooks/usePresence\";\nexport type { Placement } from \"./hooks/useFloating\";\nexport { cx } from \"./utils/cx\";\nexport { getInitials } from \"./utils/text\";\nexport { copyText } from \"./utils/copyText\";\n", "type ClassValue = string | false | null | undefined | Record<string, boolean | undefined>;\n\n/** Joins class names, skipping falsy ones; an object adds each key whose value is true. */\nexport function cx(...values: ClassValue[]): string {\n const classes: string[] = [];\n for (const value of values) {\n if (!value) continue;\n if (typeof value === \"string\") {\n classes.push(value);\n continue;\n }\n for (const [name, on] of Object.entries(value)) if (on) classes.push(name);\n }\n return classes.join(\" \");\n}\n", "import type { HTMLAttributes, JSX, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** The text styles on the Typography page, by the same names: `lead` is the class ow-type-lead. */\nexport type TextVariant =\n | \"hero\"\n | \"page-title\"\n | \"section-title\"\n | \"heading\"\n | \"lead\"\n | \"prose\"\n | \"dialog-title\"\n | \"card-title\"\n | \"body\"\n | \"copy\"\n | \"label\"\n | \"button\"\n | \"caption\"\n | \"badge\"\n | \"overline\"\n | \"code\"\n | \"kbd\";\n\nexport type TextTone = \"default\" | \"soft\" | \"muted\" | \"primary\" | \"danger\" | \"success\" | \"warning\";\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n /** Which text style: size, leading, weight and tracking from the Typography page. The display styles shrink on phones.\n * @default \"body\" */\n variant?: TextVariant;\n /** The element, for the page's outline. Defaults to one that suits the variant: h1 for hero and page-title, h2 for\n * section-title, h3 for heading and the titles, p for running text, span for the rest. */\n as?: keyof JSX.IntrinsicElements;\n /** The colour. Left out, lead, copy, caption and overline are muted, as the styles ask, and the rest take the\n * colour around them. */\n tone?: TextTone;\n /** @default \"start\" */\n align?: \"start\" | \"center\" | \"end\";\n /** One line, cut off with an ellipsis.\n * @default false */\n truncate?: boolean;\n children?: ReactNode;\n}\n\nconst elements: Record<TextVariant, keyof JSX.IntrinsicElements> = {\n hero: \"h1\",\n \"page-title\": \"h1\",\n \"section-title\": \"h2\",\n heading: \"h3\",\n lead: \"p\",\n prose: \"p\",\n \"dialog-title\": \"h2\",\n \"card-title\": \"h3\",\n body: \"p\",\n copy: \"p\",\n label: \"span\",\n button: \"span\",\n caption: \"span\",\n badge: \"span\",\n overline: \"span\",\n code: \"code\",\n kbd: \"kbd\",\n};\n\nconst mutedByDefault: TextVariant[] = [\"lead\", \"copy\", \"caption\", \"overline\"];\n\n/**\n * Text in one of Openware's styles: `<Text variant=\"lead\">`. The variant sets the look and a sensible element;\n * `as` changes the element without changing the look, so the outline stays right.\n */\nexport function Text({ variant = \"body\", as, tone, align, truncate = false, className, children, ...props }: TextProps) {\n const Element = (as ?? elements[variant]) as \"p\";\n const colour = tone ?? (mutedByDefault.includes(variant) ? \"muted\" : undefined);\n return (\n <Element\n className={cx(\n \"ow-text\",\n `ow-type-${variant}`,\n `ow-text--${variant}`,\n colour && `ow-text--${colour}`,\n align && align !== \"start\" && `ow-text--${align}`,\n truncate && \"ow-text--truncate\",\n className,\n )}\n {...props}\n >\n {children}\n </Element>\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { toAriaShortcut } from \"../../utils/text\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n/** `rounded` is the app's 8px corner; `pill` is the marketing site's. */\nexport type ButtonShape = \"rounded\" | \"pill\";\n\nexport interface ButtonStyleOptions {\n /** primary for the one main action, secondary for the rest, ghost for low-stakes actions, danger for destructive ones.\n * @default \"secondary\" */\n variant?: ButtonVariant;\n /** sm 32px, md 40px, lg 44px (36, 40 and 46px as pills).\n * @default \"md\" */\n size?: ButtonSize;\n /** @default \"rounded\" */\n shape?: ButtonShape;\n /** A square button holding only an icon. Give it an aria-label.\n * @default false */\n iconOnly?: boolean;\n}\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleOptions {\n /** An icon before the label, usually a 16px lucide-react icon. */\n startIcon?: ReactNode;\n /** An icon after the label, such as an arrow or a chevron. */\n endIcon?: ReactNode;\n /** Keyboard shortcut shown at the end, e.g. \"\u2318N\". Only pass one that actually works. */\n shortcut?: string;\n /** Shows a spinner in place of the start icon and disables the button, keeping its width.\n * @default false */\n loading?: boolean;\n /** Stretches the button to its container's width.\n * @default false */\n fullWidth?: boolean;\n}\n\n/**\n * The class names of a button, for things that must be another element: a router <Link>, an <a>.\n * `<Link className={buttonClassName({ variant: \"primary\" })}>Pricing</Link>`\n */\nexport function buttonClassName({\n variant = \"secondary\",\n size = \"md\",\n shape = \"rounded\",\n iconOnly = false,\n}: ButtonStyleOptions = {}): string {\n return cx(\n \"ow-button\",\n `ow-button--${variant}`,\n `ow-button--${size}`,\n shape === \"pill\" && \"ow-button--pill\",\n iconOnly && \"ow-button--icon-only\",\n );\n}\n\n/**\n * A tactile button: a light top-to-bottom gradient, a highlight along the top edge and a soft shadow,\n * pressed in by a pixel on click.\n */\nexport const Button = /* @__PURE__ */ forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n className,\n disabled,\n endIcon,\n fullWidth = false,\n iconOnly = false,\n loading = false,\n shape = \"rounded\",\n shortcut,\n size = \"md\",\n startIcon,\n type = \"button\",\n variant = \"secondary\",\n ...buttonProps\n },\n ref,\n) {\n const leading = loading ? <Spinner size=\"sm\" tone=\"current\" label=\"\" /> : startIcon;\n return (\n <button\n ref={ref}\n className={cx(\n buttonClassName({ variant, size, shape, iconOnly }),\n shortcut && !iconOnly && \"ow-button--with-shortcut\",\n loading && \"ow-button--loading\",\n fullWidth && \"ow-button--full\",\n className,\n )}\n type={type}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n aria-keyshortcuts={shortcut ? toAriaShortcut(shortcut) : undefined}\n {...buttonProps}\n >\n {leading ? <span className=\"ow-button__icon\">{leading}</span> : null}\n {iconOnly && loading ? null : children}\n {endIcon && !iconOnly ? <span className=\"ow-button__icon\">{endIcon}</span> : null}\n {shortcut && !iconOnly ? (\n <kbd aria-hidden=\"true\" className=\"ow-button__shortcut\">\n {shortcut}\n </kbd>\n ) : null}\n </button>\n );\n});\n", "/** \"Alex Silver\" \u2192 \"AS\", \"alex\" \u2192 \"A\". Empty input returns \"\". */\nexport function getInitials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? \"\") : \"\";\n\n return `${first}${last}`.toUpperCase();\n}\n\n/** \"\u2318N\" \u2192 \"Meta+N\", \"Ctrl+O\" \u2192 \"Control+O\", for aria-keyshortcuts. */\nexport function toAriaShortcut(shortcut: string): string {\n return shortcut.replace(\"\u2318\", \"Meta+\").replace(\"Ctrl+\", \"Control+\");\n}\n", "import { cx } from \"../../utils/cx\";\n\nexport interface SpinnerProps {\n /** sm 14px, md 20px, lg 28px.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** `primary` draws the arc in the progress colour; `current` takes the text colour, for use inside buttons.\n * @default \"primary\" */\n tone?: \"primary\" | \"current\";\n /** Read out by screen readers. Pass an empty string when something nearby already says it's loading.\n * @default \"Loading\" */\n label?: string;\n className?: string;\n}\n\n/** A small spinning ring for work that takes a moment. */\nexport function Spinner({ size = \"md\", tone = \"primary\", label = \"Loading\", className }: SpinnerProps) {\n return (\n <span\n className={cx(\"ow-spinner\", `ow-spinner--${size}`, `ow-spinner--${tone}`, className)}\n {...(label ? { role: \"status\", \"aria-label\": label } : { \"aria-hidden\": true })}\n />\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button, type ButtonProps } from \"./Button\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Joins the buttons into one control with shared borders. Off, they sit 8px apart.\n * @default true */\n attached?: boolean;\n /** @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n}\n\n/** Buttons that belong together: a toolbar's actions, or a split choice like \"Day \u00B7 Week \u00B7 Month\". */\nexport function ButtonGroup({ attached = true, orientation = \"horizontal\", className, ...props }: ButtonGroupProps) {\n return (\n <div\n role=\"group\"\n className={cx(\n \"ow-button-group\",\n attached && \"ow-button-group--attached\",\n orientation === \"vertical\" && \"ow-button-group--vertical\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface CloseButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** sm 24px for toasts and tags, md 32px for dialogs and panels.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** What it closes, for screen readers.\n * @default \"Close\" */\n label?: string;\n}\n\n/** The \u2715 in a dialog, drawer or panel header. */\nexport const CloseButton = /* @__PURE__ */ forwardRef<HTMLButtonElement, CloseButtonProps>(function CloseButton(\n { size = \"md\", label = \"Close\", className, type = \"button\", ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n aria-label={label}\n className={cx(\"ow-close-button\", `ow-close-button--${size}`, className)}\n {...buttonProps}\n >\n <XIcon size={size === \"sm\" ? 14 : 17} />\n </button>\n );\n});\n\nexport interface ToggleButtonProps extends Omit<ButtonProps, \"variant\"> {\n /** Whether it's on. Leave out to let the button keep its own state. */\n pressed?: boolean;\n /** The starting state when uncontrolled.\n * @default false */\n defaultPressed?: boolean;\n onPressedChange?(pressed: boolean): void;\n /** @default \"secondary\" */\n variant?: \"secondary\" | \"ghost\";\n}\n\n/** A button that stays pressed in while something is on: bold text, a filter, a view mode. */\nexport const ToggleButton = /* @__PURE__ */ forwardRef<HTMLButtonElement, ToggleButtonProps>(function ToggleButton(\n { pressed, defaultPressed = false, onPressedChange, onClick, className, variant = \"secondary\", ...buttonProps },\n ref,\n) {\n const [isPressed, setPressed] = useControllableState(pressed, defaultPressed, onPressedChange);\n return (\n <Button\n ref={ref}\n variant={variant}\n aria-pressed={isPressed}\n className={cx(isPressed && \"ow-button--pressed\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setPressed(!isPressed);\n }}\n {...buttonProps}\n />\n );\n});\n", "import { useCallback, useRef, useState } from \"react\";\n\n/**\n * State that a parent may control (`value` + `onChange`) or leave to the component (`defaultValue`).\n * Returns the current value and a setter that calls `onChange` either way.\n */\nexport function useControllableState<T>(\n value: T | undefined,\n defaultValue: T,\n onChange?: (next: T) => void,\n): [T, (next: T | ((previous: T) => T)) => void] {\n const [internal, setInternal] = useState<T>(defaultValue);\n const isControlled = value !== undefined;\n const current = isControlled ? value : internal;\n const currentRef = useRef(current);\n currentRef.current = current;\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const setValue = useCallback(\n (next: T | ((previous: T) => T)) => {\n const resolved =\n typeof next === \"function\" ? (next as (previous: T) => T)(currentRef.current) : next;\n if (Object.is(resolved, currentRef.current)) return;\n if (!isControlled) setInternal(resolved);\n onChangeRef.current?.(resolved);\n },\n [isControlled],\n );\n\n return [current, setValue];\n}\n", "import type { ReactNode, SVGProps } from \"react\";\n\n/*\n * The few icons the components draw themselves. They are Lucide shapes (ISC licence, lucide.dev):\n * a 24-unit grid, 2px round strokes in currentColor. For your own icons, use lucide-react.\n */\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n size?: number;\n}\n\nfunction icon(paths: ReactNode) {\n return function Icon({ size = 16, strokeWidth = 2, ...props }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n {paths}\n </svg>\n );\n };\n}\n\nexport const CheckIcon = /* @__PURE__ */ icon(<path d=\"M20 6 9 17l-5-5\" />);\nexport const ChevronDownIcon = /* @__PURE__ */ icon(<path d=\"m6 9 6 6 6-6\" />);\nexport const SearchIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </>,\n);\nexport const CornerDownLeftIcon = /* @__PURE__ */ icon(\n <>\n <polyline points=\"9 10 4 15 9 20\" />\n <path d=\"M20 4v7a4 4 0 0 1-4 4H4\" />\n </>,\n);\nexport const XIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>,\n);\nexport const UserIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </>,\n);\nexport const TrashIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M3 6h18\" />\n <path d=\"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6\" />\n <path d=\"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2\" />\n <line x1=\"10\" x2=\"10\" y1=\"11\" y2=\"17\" />\n <line x1=\"14\" x2=\"14\" y1=\"11\" y2=\"17\" />\n </>,\n);\nexport const CircleCheckIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </>,\n);\nexport const CircleAlertIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </>,\n);\nexport const ChevronRightIcon = /* @__PURE__ */ icon(<path d=\"m9 18 6-6-6-6\" />);\nexport const ChevronLeftIcon = /* @__PURE__ */ icon(<path d=\"m15 18-6-6 6-6\" />);\nexport const ChevronUpIcon = /* @__PURE__ */ icon(<path d=\"m18 15-6-6-6 6\" />);\nexport const MinusIcon = /* @__PURE__ */ icon(<path d=\"M5 12h14\" />);\nexport const PlusIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </>,\n);\nexport const InfoIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </>,\n);\nexport const TriangleAlertIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </>,\n);\nexport const PipetteIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m2 22 1-1h3l9-9\" />\n <path d=\"M3 21v-3l9-9\" />\n <path d=\"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z\" />\n </>,\n);\nexport const CopyIcon = /* @__PURE__ */ icon(\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>,\n);\nexport const CalendarIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M8 2v4\" />\n <path d=\"M16 2v4\" />\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\" />\n <path d=\"M3 10h18\" />\n </>,\n);\nexport const FileIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n </>,\n);\nexport const FolderIcon = /* @__PURE__ */ icon(\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />,\n);\nexport const FolderOpenIcon = /* @__PURE__ */ icon(\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />,\n);\nexport const UploadIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <polyline points=\"17 8 12 3 7 8\" />\n <line x1=\"12\" x2=\"12\" y1=\"3\" y2=\"15\" />\n </>,\n);\nexport const ArrowUpRightIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </>,\n);\nexport const ArrowUpIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m5 12 7-7 7 7\" />\n <path d=\"M12 19V5\" />\n </>,\n);\nexport const ArrowDownIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </>,\n);\nexport const ChevronsUpDownIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </>,\n);\nexport const InboxIcon = /* @__PURE__ */ icon(\n <>\n <polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </>,\n);\nexport const EllipsisIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </>,\n);\n", "import { useRef, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { useIndicator } from \"../../hooks/useIndicator\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** A 16px icon before the label. With no label, give the option an aria-label. */\n icon?: ReactNode;\n disabled?: boolean;\n \"aria-label\"?: string;\n}\n\nexport interface SegmentedControlProps {\n options: SegmentedControlOption[];\n value?: string;\n /** The starting value when uncontrolled. Defaults to the first option. */\n defaultValue?: string;\n onChange?(value: string): void;\n /** sm 28px, md 32px tall.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Stretches the segments to fill the container.\n * @default false */\n fullWidth?: boolean;\n /** Names the choice for screen readers. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Two to five mutually exclusive options in a well, with the chosen one raised: a view switch, a filter.\n * It behaves like a radio group: the arrow keys move and choose.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = \"md\",\n fullWidth = false,\n disabled = false,\n className,\n ...aria\n}: SegmentedControlProps) {\n const [current, setCurrent] = useControllableState(value, defaultValue ?? options[0]?.value ?? \"\", onChange);\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n const groupRef = useRef<HTMLDivElement>(null);\n useIndicator(groupRef, '[aria-checked=\"true\"]', current);\n const enabled = options.map((option, index) => ({ option, index })).filter(({ option }) => !option.disabled);\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>, index: number) {\n const keys: Record<string, number> = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };\n let target: number | undefined;\n if (event.key in keys) {\n const position = enabled.findIndex((entry) => entry.index === index);\n target = enabled[(position + keys[event.key]! + enabled.length) % enabled.length]?.index;\n } else if (event.key === \"Home\") target = enabled[0]?.index;\n else if (event.key === \"End\") target = enabled[enabled.length - 1]?.index;\n if (target === undefined) return;\n event.preventDefault();\n refs.current[target]?.focus();\n setCurrent(options[target]!.value);\n }\n\n const focusable = options.some((option) => option.value === current && !option.disabled) ? current : enabled[0]?.option.value;\n\n return (\n <div\n ref={groupRef}\n role=\"radiogroup\"\n className={cx(\"ow-segmented\", `ow-segmented--${size}`, fullWidth && \"ow-segmented--full\", disabled && \"ow-segmented--disabled\", className)}\n {...aria}\n >\n {options.map((option, index) => {\n const isSelected = option.value === current;\n return (\n <button\n key={option.value}\n ref={(element) => {\n refs.current[index] = element;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={option[\"aria-label\"]}\n tabIndex={option.value === focusable ? 0 : -1}\n disabled={disabled || option.disabled}\n className={cx(\"ow-segmented__item\", isSelected && \"ow-segmented__item--selected\")}\n onClick={() => setCurrent(option.value)}\n onKeyDown={(event) => onKeyDown(event, index)}\n >\n {option.icon ? <span className=\"ow-segmented__icon\">{option.icon}</span> : null}\n {option.label}\n </button>\n );\n })}\n <span className=\"ow-indicator\" aria-hidden=\"true\" />\n </div>\n );\n}\n", "import { useLayoutEffect, type RefObject } from \"react\";\n\n/**\n * Measures the selected child of `containerRef` (the first match of `selector`) and writes its box to the\n * container as --ow-indicator-x, -y, -w and -h, so one absolutely placed element (.ow-indicator) can slide\n * between choices. The container gets data-indicator=\"placed\" on the first measure (no animation) and \"ready\"\n * a frame later (animated from then on). It re-measures when `key` changes or anything resizes.\n */\nexport function useIndicator(containerRef: RefObject<HTMLElement | null>, selector: string, key: unknown) {\n useLayoutEffect(() => {\n const container = containerRef.current;\n if (!container) return undefined;\n let frame = 0;\n\n const measure = () => {\n const selected = container.querySelector<HTMLElement>(selector);\n if (!selected) {\n delete container.dataset.indicator;\n return;\n }\n container.style.setProperty(\"--ow-indicator-x\", `${selected.offsetLeft}px`);\n container.style.setProperty(\"--ow-indicator-y\", `${selected.offsetTop}px`);\n container.style.setProperty(\"--ow-indicator-w\", `${selected.offsetWidth}px`);\n container.style.setProperty(\"--ow-indicator-h\", `${selected.offsetHeight}px`);\n if (!container.dataset.indicator) {\n container.dataset.indicator = \"placed\";\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (container.dataset.indicator) container.dataset.indicator = \"ready\";\n });\n });\n }\n };\n\n measure();\n if (typeof ResizeObserver === \"undefined\") return () => cancelAnimationFrame(frame);\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n for (const child of container.children) observer.observe(child);\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n };\n }, [containerRef, selector, key]);\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { toAriaShortcut } from \"../../utils/text\";\n\nexport interface ChoiceCardProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"title\"> {\n title: string;\n /** One line under the title saying what this choice does. */\n description: string;\n /** A 20px lucide-react icon, shown on a tinted tile. */\n icon: ReactNode;\n /** Marks the recommended choice with a tinted border. */\n recommended?: boolean;\n /** Keyboard shortcut shown in the top-right corner, e.g. \"\u2318N\". Only pass one that actually works. */\n shortcut?: string;\n}\n\n/** A large, card-shaped button for picking between a few options, e.g. on an empty state. */\nexport const ChoiceCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, ChoiceCardProps>(function ChoiceCard(\n { className, description, icon, recommended = false, shortcut, title, type = \"button\", ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n className={cx(\"ow-choice\", recommended && \"ow-choice--recommended\", className)}\n type={type}\n aria-keyshortcuts={shortcut ? toAriaShortcut(shortcut) : undefined}\n {...buttonProps}\n >\n <span className=\"ow-choice__top\">\n <span className=\"ow-choice__icon\">{icon}</span>\n {shortcut ? (\n <kbd aria-hidden=\"true\" className=\"ow-choice__shortcut\">\n {shortcut}\n </kbd>\n ) : null}\n </span>\n <span className=\"ow-choice__text\">\n <span className=\"ow-choice__title\">{title}</span>\n <span className=\"ow-choice__description\">{description}</span>\n </span>\n </button>\n );\n});\n", "import { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nimport { CheckIcon, CopyIcon } from \"../../icons\";\nimport { copyText } from \"../../utils/copyText\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface CopyButtonProps {\n /** The text to copy. */\n value: string;\n /** Shown beside the icon, and read out.\n * @default \"Copy\" */\n label?: string;\n /** Shown for two seconds after copying.\n * @default \"Copied\" */\n copiedLabel?: string;\n /** Just the icon; the label is still read out.\n * @default false */\n iconOnly?: boolean;\n /** `default` sits on surfaces; `onDark` sits on a code block.\n * @default \"default\" */\n tone?: \"default\" | \"onDark\";\n onCopy?(): void;\n className?: string;\n}\n\n/** Copies a value and says so: the icon turns into a check for two seconds and screen readers hear \"Copied\". */\nexport function CopyButton({ value, label = \"Copy\", copiedLabel = \"Copied\", iconOnly = false, tone = \"default\", onCopy, className }: CopyButtonProps) {\n const [copied, setCopied] = useState(false);\n const timer = useRef(0);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n return (\n <button\n type=\"button\"\n className={cx(\n \"ow-copy-button\",\n tone === \"onDark\" && \"ow-copy-button--on-dark\",\n iconOnly && \"ow-copy-button--icon-only\",\n copied && \"ow-copy-button--copied\",\n className,\n )}\n aria-label={iconOnly ? (copied ? copiedLabel : label) : undefined}\n onClick={async () => {\n if (await copyText(value)) {\n setCopied(true);\n onCopy?.();\n window.clearTimeout(timer.current);\n timer.current = window.setTimeout(() => setCopied(false), 2000);\n }\n }}\n >\n <span className=\"ow-copy-button__icon\" aria-hidden=\"true\">\n <CopyIcon size={14} />\n <CheckIcon size={14} />\n </span>\n {iconOnly ? null : <span>{copied ? copiedLabel : label}</span>}\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {copied ? copiedLabel : \"\"}\n </span>\n </button>\n );\n}\n\nexport interface CodeBlockProps {\n /** The code, as plain text. It's what the copy button copies. */\n code: string;\n /** Pre-highlighted HTML for the code (from Shiki or Prism, say). Without it the code shows plain. */\n html?: string;\n /** A file name or caption in the header. */\n title?: ReactNode;\n /** Shown on the right of the header, e.g. \"tsx\". */\n language?: string;\n /** @default false */\n showLineNumbers?: boolean;\n /** @default true */\n copyable?: boolean;\n /** Scrolls past this height (pixels). */\n maxHeight?: number;\n className?: string;\n}\n\n/** Code on a night ground, the same in both themes, with a copy button. */\nexport function CodeBlock({ code, html, title, language, showLineNumbers = false, copyable = true, maxHeight, className }: CodeBlockProps) {\n const hasHeader = title !== undefined || language !== undefined;\n const lines = code.replace(/\\n$/, \"\").split(\"\\n\");\n return (\n <div className={cx(\"ow-code-block\", showLineNumbers && \"ow-code-block--numbered\", className)}>\n {hasHeader ? (\n <div className=\"ow-code-block__header\">\n <span className=\"ow-code-block__title\">{title}</span>\n {language ? <span className=\"ow-code-block__language\">{language}</span> : null}\n {copyable ? <CopyButton value={code} tone=\"onDark\" iconOnly label=\"Copy code\" /> : null}\n </div>\n ) : copyable ? (\n <CopyButton value={code} tone=\"onDark\" iconOnly label=\"Copy code\" className=\"ow-code-block__floating-copy\" />\n ) : null}\n <pre className=\"ow-code-block__pre\" style={maxHeight ? { maxHeight } : undefined} tabIndex={0}>\n {showLineNumbers ? (\n <span className=\"ow-code-block__numbers\" aria-hidden=\"true\">\n {lines.map((_, index) => (\n <span key={index}>{index + 1}</span>\n ))}\n </span>\n ) : null}\n {html ? (\n <code className=\"ow-code-block__code\" dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <code className=\"ow-code-block__code\">{code.replace(/\\n$/, \"\")}</code>\n )}\n </pre>\n </div>\n );\n}\n\nexport interface SnippetProps {\n /** The command or value, copied as is. */\n value: string;\n /** A muted prompt before it, such as \"$\".\n * @default \"$\" */\n prompt?: string | null;\n className?: string;\n}\n\n/** One line to copy: an install command, an API key name, a URL. */\nexport function Snippet({ value, prompt = \"$\", className }: SnippetProps) {\n return (\n <div className={cx(\"ow-snippet\", className)}>\n <code className=\"ow-snippet__code\">\n {prompt ? (\n <span className=\"ow-snippet__prompt\" aria-hidden=\"true\">\n {prompt}\n </span>\n ) : null}\n {value}\n </code>\n <CopyButton value={value} iconOnly label={`Copy ${value}`} />\n </div>\n );\n}\n", "/** Copies text to the clipboard, falling back to a hidden textarea where the Clipboard API is refused. */\nexport async function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let ok = false;\n try {\n ok = document.execCommand(\"copy\");\n } catch {\n ok = false;\n }\n area.remove();\n return ok;\n }\n}\n", "import { useContext, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { ToggleButton } from \"../Button/ButtonGroup\";\nimport { ToolbarContext } from \"../Toolbar/Toolbar\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface ToggleButtonGroupOption {\n /** Identifies the option in `value`. */\n value: string;\n /** The visible text. Leave it out for an icon-only option, and give that an aria-label. */\n label?: ReactNode;\n /** A 16px icon before the label, or on its own. */\n icon?: ReactNode;\n /** Names an icon-only option for screen readers; a tooltip shows the same words. */\n \"aria-label\"?: string;\n /** Greys the option out; the arrow keys skip it.\n * @default false */\n disabled?: boolean;\n}\n\nexport interface ToggleButtonGroupProps {\n /** The toggles, in order. */\n options: ToggleButtonGroupOption[];\n /** `multiple` lets any number be on, like bold and italic; `single` allows at most one, like an alignment.\n * Either way all can be off, unless `disallowEmptySelection`.\n * @default \"single\" */\n selectionMode?: \"single\" | \"multiple\";\n /** What's on: in single mode a value, or \"\" for none; in multiple mode an array of values. Leave it out to let the\n * group keep its own state. */\n value?: string | string[];\n /** The starting value when uncontrolled.\n * @default \"\" or [] */\n defaultValue?: string | string[];\n /** Called with the new value: a string (\"\" for none) in single mode, an array in the options' order in multiple mode. */\n onChange?(value: string | string[]): void;\n /** Keeps one option on: pressing the only one that's on leaves it on.\n * @default false */\n disallowEmptySelection?: boolean;\n /** sm 32px, md 40px tall, like Button. Inside a Toolbar it takes the toolbar's size.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Inside a Toolbar it takes the toolbar's orientation.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Disables every option, keeping what's on visible.\n * @default false */\n disabled?: boolean;\n /** Names the group for screen readers, e.g. \"Text style\". */\n \"aria-label\"?: string;\n /** The id of a visible label for the group, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** The id of a hint or description for the group. */\n \"aria-describedby\"?: string;\n /** An id for the group's element. */\n id?: string;\n /** Extra classes for the group. */\n className?: string;\n}\n\ntype SharedProps = Omit<ToggleButtonGroupProps, \"selectionMode\" | \"value\" | \"defaultValue\" | \"onChange\">;\n\n/** The props in single mode: `value` is one option's value, or \"\" when none is on. */\nexport type ToggleButtonGroupSingleProps = SharedProps & {\n selectionMode?: \"single\";\n value?: string;\n defaultValue?: string;\n onChange?(value: string): void;\n};\n\n/** The props in multiple mode: `value` is the values of the options that are on. */\nexport type ToggleButtonGroupMultipleProps = SharedProps & {\n selectionMode: \"multiple\";\n value?: string[];\n defaultValue?: string[];\n onChange?(value: string[]): void;\n};\n\nconst toList = (value: string | string[] | undefined): string[] | undefined =>\n value === undefined ? undefined : Array.isArray(value) ? value : value === \"\" ? [] : [value];\n\nconst hasLabel = (option: ToggleButtonGroupOption) => option.label !== undefined && option.label !== null && option.label !== false && option.label !== \"\";\n\n/**\n * Toggle buttons joined into one control: several can be on (bold, italic, underline) or at most one (an alignment),\n * and, unlike a SegmentedControl, all can be off. On its own it's one tab stop with the arrow keys moving between its\n * buttons; inside a Toolbar it leaves the arrow keys to the toolbar.\n */\nexport function ToggleButtonGroup(props: ToggleButtonGroupSingleProps | ToggleButtonGroupMultipleProps) {\n const {\n options,\n selectionMode = \"single\",\n value,\n defaultValue,\n onChange,\n disallowEmptySelection = false,\n size: sizeProp,\n orientation: orientationProp,\n disabled = false,\n className,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n } = props as ToggleButtonGroupProps;\n const toolbar = useContext(ToolbarContext);\n const size = sizeProp ?? toolbar?.size ?? \"md\";\n const orientation = orientationProp ?? toolbar?.orientation ?? \"horizontal\";\n const multiple = selectionMode === \"multiple\";\n\n const [selected, setSelected] = useControllableState<string[]>(toList(value), toList(defaultValue) ?? [], (next) =>\n onChange?.(multiple ? next : (next[0] ?? \"\")),\n );\n const [focusedValue, setFocusedValue] = useState<string | null>(null);\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const rank = (item: string) => {\n const index = options.findIndex((option) => option.value === item);\n return index < 0 ? options.length : index;\n };\n\n function toggle(item: string) {\n let next: string[];\n if (selected.includes(item)) next = multiple ? selected.filter((entry) => entry !== item) : [];\n else next = multiple ? [...selected, item].sort((a, b) => rank(a) - rank(b)) : [item];\n if (next.length === 0 && disallowEmptySelection) return;\n setSelected(next);\n }\n\n // On its own, the group is one tab stop: the button focused last, else the first that's on, else the first.\n const enabled = disabled ? [] : options.filter((option) => !option.disabled);\n const tabStop = enabled.find((option) => option.value === focusedValue) ?? enabled.find((option) => selected.includes(option.value)) ?? enabled[0];\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>, current: string) {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = getComputedStyle(event.currentTarget).direction === \"rtl\";\n const steps: Record<string, number> = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1, ArrowDown: 1, ArrowUp: -1 };\n const position = enabled.findIndex((option) => option.value === current);\n let target: number | undefined;\n if (event.key in steps) target = (position + steps[event.key]! + enabled.length) % enabled.length;\n else if (event.key === \"Home\") target = 0;\n else if (event.key === \"End\") target = enabled.length - 1;\n if (target === undefined || !enabled[target]) return;\n event.preventDefault();\n refs.current[options.indexOf(enabled[target]!)]?.focus();\n }\n\n const iconOnly = options.length > 0 && options.every((option) => option.icon && !hasLabel(option));\n\n return (\n <div\n role=\"group\"\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={cx(\n \"ow-toggle-group\",\n `ow-toggle-group--${size}`,\n orientation === \"vertical\" && \"ow-toggle-group--vertical\",\n iconOnly && \"ow-toggle-group--icon-only\",\n className,\n )}\n >\n {options.map((option, index) => {\n const optionIconOnly = Boolean(option.icon) && !hasLabel(option);\n const button = (\n <ToggleButton\n key={option.value}\n ref={(element) => {\n refs.current[index] = element;\n }}\n size={size}\n iconOnly={optionIconOnly}\n startIcon={optionIconOnly ? undefined : option.icon}\n aria-label={option[\"aria-label\"]}\n pressed={selected.includes(option.value)}\n onPressedChange={() => toggle(option.value)}\n disabled={disabled || option.disabled}\n // In a toolbar, the toolbar sets the tab stops and handles the arrow keys.\n tabIndex={toolbar ? undefined : option === tabStop ? 0 : -1}\n onFocus={() => setFocusedValue(option.value)}\n onKeyDown={toolbar ? undefined : (event) => onKeyDown(event, option.value)}\n >\n {optionIconOnly ? option.icon : option.label}\n </ToggleButton>\n );\n return optionIconOnly && option[\"aria-label\"] ? (\n <Tooltip key={option.value} label={option[\"aria-label\"]} placement={orientation === \"vertical\" ? \"right\" : \"top\"}>\n {button}\n </Tooltip>\n ) : (\n button\n );\n })}\n </div>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n type FocusEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the toolbar for screen readers, e.g. \"Formatting\". Every toolbar needs a name, from this or aria-labelledby. */\n \"aria-label\"?: string;\n /** The id of a visible heading that names the toolbar, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Which way it runs. The arrow keys follow it: Left and Right across a horizontal toolbar, Up and Down a vertical one.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** `raised` is a bar of its own: a surface with a hairline border and a soft shadow. `plain` has no ground, for a\n * toolbar in a card or panel header.\n * @default \"raised\" */\n variant?: \"raised\" | \"plain\";\n /** The bar's padding and gaps, and the size its ToggleButtonGroups and separators take. Give its Buttons the same size.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n}\n\nexport interface ToolbarSeparatorProps {\n /** Extra classes for the line. */\n className?: string;\n}\n\ninterface ToolbarContextValue {\n orientation: \"horizontal\" | \"vertical\";\n size: \"sm\" | \"md\";\n}\n\n/** Lets what's inside a Toolbar follow its orientation and size, and leave the arrow keys to it. */\nexport const ToolbarContext = /* @__PURE__ */ createContext<ToolbarContextValue | null>(null);\n\nconst candidates =\n 'button, a[href], input:not([type=\"hidden\"]), select, textarea, [contenteditable=\"\"], [contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [tabindex]';\n\n/** Input types that edit text on one line: Left and Right move the caret, and only leave the field from its edge. */\nconst textTypes = [\"text\", \"search\", \"url\", \"tel\", \"password\", \"email\"];\n/** Input types that don't use the arrow keys at all. */\nconst pressTypes = [\"button\", \"checkbox\", \"submit\", \"reset\", \"image\", \"file\", \"color\"];\n\n/**\n * The controls the toolbar moves between, in DOM order: every enabled, visible, focusable element, except those in\n * a popover (a menu or listbox opened from the toolbar) or a nested toolbar, and those whose own tabindex of -1 says\n * they're not tab stops (the toolbar remembers the ones it set itself).\n */\nfunction itemsOf(root: HTMLElement, managed: WeakSet<HTMLElement>): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(candidates)).filter((element) => {\n if (element.matches(\":disabled\") || element.closest(\"[inert]\")) return false;\n const tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex !== null && Number(tabIndex) < 0 && !managed.has(element)) return false;\n if (!ownedBy(root, element)) return false;\n return element.getClientRects().length > 0;\n });\n}\n\n/** Whether an element belongs to this toolbar rather than to a popover or another toolbar inside it. */\nfunction ownedBy(root: HTMLElement, element: HTMLElement): boolean {\n for (let node = element.parentElement; node && node !== root; node = node.parentElement) {\n if (node.hasAttribute(\"popover\") || node.getAttribute(\"role\") === \"toolbar\") return false;\n }\n return root.contains(element);\n}\n\n/** Whether a control needs the key itself: fields keep their caret keys, an open select keeps every arrow. */\nfunction keepsKey(element: HTMLElement, key: string, forward: boolean): boolean {\n if (element.isContentEditable || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) return true;\n if (element.getAttribute(\"aria-expanded\") === \"true\" && element.hasAttribute(\"aria-haspopup\")) return true;\n const role = element.getAttribute(\"role\");\n if (role === \"slider\" || role === \"spinbutton\") return true;\n if (!(element instanceof HTMLInputElement) || pressTypes.includes(element.type)) return false;\n if (!textTypes.includes(element.type)) return true;\n if (key === \"ArrowUp\" || key === \"ArrowDown\") return false;\n if (key === \"Home\" || key === \"End\") return true;\n const { selectionStart, selectionEnd, value } = element;\n if (selectionStart === null || selectionEnd === null || selectionStart !== selectionEnd) return true;\n return forward ? selectionEnd < value.length : selectionStart > 0;\n}\n\n/**\n * A row of controls for one context: an editor's formatting bar, a table's actions. It's a single tab stop: the\n * arrow keys move between every control inside it, ToggleButtonGroups' buttons included, and Tab leaves it, coming\n * back to the control that was focused last.\n */\nexport const Toolbar = /* @__PURE__ */ forwardRef<HTMLDivElement, ToolbarProps>(function Toolbar(\n { orientation = \"horizontal\", variant = \"raised\", size = \"md\", className, children, onKeyDown, onFocus, ...props },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const activeRef = useRef<HTMLElement | null>(null);\n const activeIndex = useRef(0);\n const managed = useRef(new WeakSet<HTMLElement>());\n const context = useMemo(() => ({ orientation, size }), [orientation, size]);\n\n const setRef = useCallback(\n (element: HTMLDivElement | null) => {\n rootRef.current = element;\n if (typeof forwardedRef === \"function\") forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n },\n [forwardedRef],\n );\n\n // Roving tabindex: the active control is the one tab stop; the rest are -1. When it goes (removed or disabled),\n // the control that took its place in the order becomes the tab stop.\n const sync = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n const items = itemsOf(root, managed.current);\n let active = activeRef.current && items.includes(activeRef.current) ? activeRef.current : null;\n if (!active) {\n const focused = items.find((item) => item === document.activeElement);\n active = focused ?? items[Math.min(activeIndex.current, items.length - 1)] ?? null;\n }\n // With every control disabled there's nothing to move to; keep the memory for when they come back.\n if (active) {\n activeRef.current = active;\n activeIndex.current = items.indexOf(active);\n }\n for (const item of items) {\n const tabIndex = item === active ? \"0\" : \"-1\";\n if (item.getAttribute(\"tabindex\") !== tabIndex) item.setAttribute(\"tabindex\", tabIndex);\n managed.current.add(item);\n }\n }, []);\n\n useLayoutEffect(sync);\n\n // Controls inside can appear, go or be disabled without the toolbar rendering again. Writes only happen when\n // something differs, so the observer settles after its own changes.\n useEffect(() => {\n const root = rootRef.current;\n if (!root || typeof MutationObserver === \"undefined\") return undefined;\n const observer = new MutationObserver(sync);\n observer.observe(root, { subtree: true, childList: true, attributes: true, attributeFilter: [\"disabled\", \"hidden\", \"inert\", \"tabindex\"] });\n return () => observer.disconnect();\n }, [sync]);\n\n function handleFocus(event: FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n const root = rootRef.current;\n const target = event.target as HTMLElement;\n if (!root || target === root || !ownedBy(root, target)) return;\n // Whatever takes focus (a click, a menu handing focus back, a control that moves focus itself) becomes the tab stop.\n managed.current.add(target);\n activeRef.current = target;\n sync();\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const root = rootRef.current;\n if (!root || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const target = event.target as HTMLElement;\n const items = itemsOf(root, managed.current);\n const index = items.indexOf(target);\n if (index < 0) return;\n const rtl = getComputedStyle(root).direction === \"rtl\";\n const nextKey = orientation === \"vertical\" ? \"ArrowDown\" : rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const previousKey = orientation === \"vertical\" ? \"ArrowUp\" : rtl ? \"ArrowRight\" : \"ArrowLeft\";\n let next: number;\n if (event.key === nextKey) next = (index + 1) % items.length;\n else if (event.key === previousKey) next = (index - 1 + items.length) % items.length;\n else if (event.key === \"Home\") next = 0;\n else if (event.key === \"End\") next = items.length - 1;\n else return;\n if (keepsKey(target, event.key, event.key === nextKey || event.key === \"End\")) return;\n event.preventDefault();\n items[next]?.focus();\n }\n\n return (\n <div\n ref={setRef}\n role=\"toolbar\"\n aria-orientation={orientation}\n className={cx(\"ow-toolbar\", `ow-toolbar--${variant}`, `ow-toolbar--${size}`, orientation === \"vertical\" && \"ow-toolbar--vertical\", className)}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...props}\n >\n <ToolbarContext.Provider value={context}>{children}</ToolbarContext.Provider>\n </div>\n );\n});\n\n/** A line between groups of controls in a Toolbar, across the toolbar's direction. */\nexport function ToolbarSeparator({ className }: ToolbarSeparatorProps) {\n const toolbar = useContext(ToolbarContext);\n return (\n <div\n role=\"separator\"\n aria-orientation={toolbar?.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n className={cx(\"ow-toolbar__separator\", className)}\n />\n );\n}\n", "import { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\n\nexport interface TooltipProps {\n /** A few words. */\n label: ReactNode;\n /** The thing it explains: usually an icon-only Button with the same words as its aria-label. */\n children: ReactNode;\n /** Which side it prefers; it flips to the opposite side when there's no room. `right` suits icons in a folded sidebar.\n * @default \"top\" */\n placement?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** Milliseconds of hovering before it shows. Moving to a neighbour while one is showing skips the wait.\n * @default 400 */\n delay?: number;\n}\n\n/** When the last tooltip closed: another one opened soon after shows at once, as people scan a toolbar. */\nlet lastClosedAt = 0;\nconst warmWindow = 500;\n\n/**\n * A small dark label beside its child (above, unless `placement` says otherwise) on hover or keyboard focus. It's for sighted users only: the child\n * carries the same words for screen readers (an aria-label, or visually hidden text), so they aren't read twice.\n * It sits in the top layer, so scroll areas and dialogs can't clip it.\n */\nexport function Tooltip({ children, label, placement = \"top\", delay = 400 }: TooltipProps) {\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timer = useRef(0);\n const [open, setOpen] = useState(false);\n const { mounted, state } = usePresence(open, 100);\n const style = useFloating({ open: mounted, anchorRef, floatingRef: bubbleRef, placement, offset: 6 });\n\n const show = (immediately = false) => {\n window.clearTimeout(timer.current);\n if (immediately || Date.now() - lastClosedAt < warmWindow) setOpen(true);\n else timer.current = window.setTimeout(() => setOpen(true), delay);\n };\n const hide = () => {\n window.clearTimeout(timer.current);\n setOpen((current) => {\n if (current) lastClosedAt = Date.now();\n return false;\n });\n };\n\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n // Escape hides it without moving focus, as WCAG 1.4.13 asks.\n useEffect(() => {\n if (!open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") hide();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [open]);\n\n return (\n <span\n ref={anchorRef}\n className=\"ow-tooltip\"\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") show();\n }}\n onPointerLeave={hide}\n onPointerDown={hide}\n onFocus={(event) => {\n if (event.target.matches(\":focus-visible\")) show(true);\n }}\n onBlur={hide}\n >\n {children}\n {mounted ? (\n <span ref={bubbleRef} {...manualPopover} data-state={state} className=\"ow-tooltip__bubble ow-floating\" style={style} aria-hidden=\"true\">\n {label}\n </span>\n ) : null}\n </span>\n );\n}\n", "import { useCallback, useEffect, useLayoutEffect, useState, type CSSProperties, type RefObject } from \"react\";\n\nexport type Placement = \"bottom-start\" | \"bottom-end\" | \"bottom\" | \"top-start\" | \"top-end\" | \"top\" | \"left\" | \"right\";\n\ninterface Options {\n open: boolean;\n anchorRef: RefObject<HTMLElement | null>;\n floatingRef: RefObject<HTMLElement | null>;\n placement?: Placement;\n /** Distance from the anchor in pixels. */\n offset?: number;\n /** Make the floating element at least as wide as the anchor. */\n matchWidth?: boolean;\n /** The tallest it gets before scrolling. */\n maxHeight?: number;\n}\n\nconst margin = 8;\n\n/**\n * Positions a floating element (a popover, a listbox) against its anchor with fixed coordinates, flips it above\n * or below (or, for \"left\" and \"right\", to the other side) when there's no room, keeps it on screen, and follows the anchor when the page scrolls or resizes.\n * It also puts the element in the browser's top layer (popover=\"manual\"), so dialogs and overflow can't clip it.\n * Pass the element's `mounted` from usePresence as `open`, so it stays placed while it animates out.\n */\nexport function useFloating({\n open,\n anchorRef,\n floatingRef,\n placement = \"bottom-start\",\n offset = 4,\n matchWidth = false,\n maxHeight = 360,\n}: Options): CSSProperties {\n const [style, setStyle] = useState<CSSProperties>({\n position: \"fixed\",\n inset: \"auto\",\n left: 0,\n right: \"auto\",\n top: 0,\n bottom: \"auto\",\n visibility: \"hidden\",\n });\n\n const place = useCallback(() => {\n const anchor = anchorRef.current;\n const floating = floatingRef.current;\n if (!anchor || !floating) return;\n const rect = anchor.getBoundingClientRect();\n const width = Math.max(floating.offsetWidth, matchWidth ? rect.width : 0);\n const height = floating.scrollHeight;\n\n // Beside the anchor, centred on it: for a tooltip on a folded sidebar's icons.\n if (placement === \"left\" || placement === \"right\") {\n const roomLeft = rect.left - offset - margin;\n const roomRight = window.innerWidth - rect.right - offset - margin;\n const onLeft = placement === \"left\" ? width <= roomLeft || roomLeft > roomRight : width > roomRight && roomLeft > roomRight;\n const top = Math.min(Math.max(margin, rect.top + rect.height / 2 - height / 2), window.innerHeight - height - margin);\n floating.dataset.side = onLeft ? \"left\" : \"right\";\n setStyle({\n position: \"fixed\",\n inset: \"auto\",\n margin: 0,\n left: onLeft ? \"auto\" : rect.right + offset,\n right: onLeft ? window.innerWidth - rect.left + offset : \"auto\",\n top,\n bottom: \"auto\",\n maxHeight: Math.max(120, Math.min(maxHeight, window.innerHeight - 2 * margin)),\n [\"--ow-floating-origin\" as string]: `${onLeft ? \"right\" : \"left\"} center`,\n });\n return;\n }\n const below = window.innerHeight - rect.bottom - offset - margin;\n const above = rect.top - offset - margin;\n const wantsTop = placement.startsWith(\"top\");\n const fitsBelow = height <= below;\n const fitsAbove = height <= above;\n const top = wantsTop ? fitsAbove || above > below : !fitsBelow && above > below;\n\n const align = placement.endsWith(\"start\") ? \"start\" : placement.endsWith(\"end\") ? \"end\" : \"center\";\n let left = align === \"start\" ? rect.left : align === \"end\" ? rect.right - width : rect.left + rect.width / 2 - width / 2;\n left = Math.min(Math.max(margin, left), window.innerWidth - width - margin);\n\n // Which way it opened, for the enter and exit animations (base.css: .ow-floating).\n floating.dataset.side = top ? \"top\" : \"bottom\";\n // Every edge is set, every time: a value React clears falls back to the browser's\n // [popover] { inset: 0 }, which pins the layer to the top of the window.\n setStyle({\n position: \"fixed\",\n inset: \"auto\",\n margin: 0,\n left,\n right: \"auto\",\n top: top ? \"auto\" : rect.bottom + offset,\n bottom: top ? window.innerHeight - rect.top + offset : \"auto\",\n minWidth: matchWidth ? rect.width : undefined,\n maxHeight: Math.max(120, Math.min(maxHeight, top ? above : below)),\n [\"--ow-floating-origin\" as string]: `${top ? \"bottom\" : \"top\"} ${align === \"start\" ? \"left\" : align === \"end\" ? \"right\" : \"center\"}`,\n });\n }, [anchorRef, floatingRef, placement, offset, matchWidth, maxHeight]);\n\n // Top layer: above modal dialogs and outside any overflow: hidden.\n useLayoutEffect(() => {\n const floating = floatingRef.current;\n if (!open || !floating) return;\n try {\n if (!floating.matches(\":popover-open\")) floating.showPopover();\n } catch {\n // Without popover support it still shows as a fixed element.\n }\n place();\n return () => {\n try {\n if (floating.matches(\":popover-open\")) floating.hidePopover();\n } catch {\n // Already hidden.\n }\n };\n }, [open, floatingRef, place]);\n\n useEffect(() => {\n if (!open) return;\n const onScroll = (event: Event) => {\n if (floatingRef.current?.contains(event.target as Node)) return;\n place();\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(() => place());\n if (floatingRef.current) observer?.observe(floatingRef.current);\n window.addEventListener(\"scroll\", onScroll, true);\n window.addEventListener(\"resize\", place);\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"scroll\", onScroll, true);\n window.removeEventListener(\"resize\", place);\n };\n }, [open, place, floatingRef]);\n\n return style;\n}\n\n/** Calls `onDismiss` on a press outside every given element, or on Escape. */\nexport function useDismiss(open: boolean, refs: Array<RefObject<HTMLElement | null>>, onDismiss: (reason: \"outside\" | \"escape\") => void) {\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (refs.every((ref) => !ref.current?.contains(target))) onDismiss(\"outside\");\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n // Close this layer, not the dialog around it.\n event.preventDefault();\n event.stopPropagation();\n onDismiss(\"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 // eslint-disable-next-line react-hooks/exhaustive-deps -- refs are stable objects.\n }, [open, onDismiss]);\n}\n\n/** The attribute that makes an element a manual popover, typed loosely for React 18. */\nexport const manualPopover = { popover: \"manual\" } as Record<string, string>;\n", "import { useEffect, useState } from \"react\";\n\n/** How long a closing layer stays mounted for its exit animation (base.css: ow-floating-out). */\nexport const exitDuration = 140;\n\nexport interface Presence {\n /** Render the element while this is true: it stays true through the exit animation. */\n mounted: boolean;\n /** Put this on the element as data-state, so CSS can run the enter or the exit animation. */\n state: \"open\" | \"closed\";\n}\n\n/**\n * Keeps an element mounted for a moment after `open` turns false, so it can animate out instead of vanishing.\n * With reduced motion it unmounts at once.\n */\nexport function usePresence(open: boolean, exitMs = exitDuration): Presence {\n const [mounted, setMounted] = useState(open);\n if (open && !mounted) setMounted(true);\n\n useEffect(() => {\n if (open || !mounted) return undefined;\n const reduceMotion = typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n const timer = window.setTimeout(() => setMounted(false), reduceMotion ? 0 : exitMs);\n return () => window.clearTimeout(timer);\n }, [open, mounted, exitMs]);\n\n return { mounted: open || mounted, state: open ? \"open\" : \"closed\" };\n}\n", "import { cloneElement, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState, type ReactElement, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { FormContext, type FormFieldEntry, type ValidityMessages } from \"../Form/Form\";\n\nexport interface FieldProps {\n /** The label, set above the control. Leave it out for a control that has its own, like a Checkbox. */\n label?: ReactNode;\n /** One control: an Input, Textarea, Select, or any element that takes an id. */\n children: ReactElement;\n /** A muted line under the control. */\n hint?: ReactNode;\n /** An error under the control; it also marks the control invalid. Inside a Form, it takes the place of the Form's. */\n error?: ReactNode;\n /**\n * The field's name, for a control with no `name` of its own (Select, Combobox, Switch, DatePicker): Field submits\n * the control's `value` (or `checked`) under it in a hidden input, and inside a Form shows the Form's error for it.\n * The control must be controlled; a string, a number, true or an array of them is sent.\n */\n name?: string;\n /**\n * Inside a Form, what to say when one of the browser's checks fails, in place of its own message: one string for\n * any check, or one per check, like { valueMissing: \"Enter your work email.\", typeMismatch: \"\u2026\" }.\n */\n errorMessages?: ValidityMessages;\n className?: string;\n}\n\n/** Elements a <label for> can name. */\nconst isLabelable = (element: HTMLElement) =>\n element instanceof HTMLInputElement ||\n element instanceof HTMLSelectElement ||\n element instanceof HTMLTextAreaElement ||\n element instanceof HTMLButtonElement ||\n element instanceof HTMLMeterElement ||\n element instanceof HTMLOutputElement ||\n element instanceof HTMLProgressElement;\n\n/** A stable key for a control's value, to notice when it changes. */\nconst keyOf = (value: unknown) => JSON.stringify(value ?? null);\n\n/**\n * A label above a control, with an optional hint and error below. Field wires them together:\n * it gives the control an id (unless it has one), points aria-describedby at the hint and error,\n * and marks it invalid when there is an error. Inside a Form, it shows the Form's error for its control's name.\n */\nexport function Field({ label, children, hint, error, name: nameProp, errorMessages, className }: FieldProps) {\n const form = useContext(FormContext);\n const generatedId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const labelId = `${generatedId}-label`;\n const hintId = `${generatedId}-hint`;\n const errorId = `${generatedId}-error`;\n\n const child = isValidElement<Record<string, unknown>>(children) ? children : null;\n const controlId = (child?.props.id as string | undefined) ?? `${generatedId}-control`;\n const name = nameProp ?? (child?.props.name as string | undefined);\n const shownError = error || (form && name ? form.status.errors[name] : undefined);\n const describedBy =\n [child?.props[\"aria-describedby\"] as string | undefined, hint ? hintId : undefined, shownError ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n\n // Our own controls draw the invalid state from `isInvalid`; native elements get aria-invalid. It's only passed\n // when there's something to say, so a control without the prop (SegmentedControl) doesn't get it as an attribute.\n // Checkbox passes its props to its <input>, so it gets aria-invalid too.\n const invalid = (child?.props.isInvalid as boolean | undefined) ?? (shownError ? true : undefined);\n const invalidProp =\n child && typeof child.type !== \"string\" && child.type !== Checkbox\n ? invalid === undefined\n ? {}\n : { isInvalid: invalid }\n : { \"aria-invalid\": shownError ? true : undefined };\n\n // A control with no name of its own (Select, Switch) has no input to submit, so Field carries its value.\n const carries = Boolean(nameProp && child && typeof child.type !== \"string\" && child.props.name === undefined);\n const carried = carries && child ? (\"value\" in child.props ? child.props.value : child.props.checked) : undefined;\n // Strings and numbers are sent as they are, true as \"on\" (like a checkbox); anything else isn't sent.\n const carriedValues = (Array.isArray(carried) ? carried : [carried]).filter(\n (value): value is string | number | true => typeof value === \"string\" || typeof value === \"number\" || value === true,\n );\n const carriedKey = carries ? keyOf(carried) : undefined;\n\n // <label for> only names inputs, selects, textareas and buttons. When the control turns out to be something else\n // (a radiogroup like SegmentedControl, a ListBox, a DateField's group), it's named with aria-labelledby instead.\n const [labelsByFor, setLabelsByFor] = useState(true);\n useLayoutEffect(() => {\n if (!label) return;\n const control = rootRef.current?.ownerDocument.getElementById(controlId);\n setLabelsByFor(!control || isLabelable(control));\n });\n const labelledBy =\n label && !labelsByFor && child && child.props[\"aria-label\"] === undefined && child.props[\"aria-labelledby\"] === undefined\n ? { \"aria-labelledby\": labelId }\n : {};\n\n const entry = useRef<FormFieldEntry>({ name, root: rootRef, controlId, errorMessages });\n entry.current = { name, root: rootRef, controlId, errorMessages };\n const register = form?.register;\n useEffect(() => register?.(entry), [register]);\n\n // Such a control fires no input events either, so Field tells the Form when its value changes.\n const changed = form?.changed;\n const lastCarried = useRef(carriedKey);\n useEffect(() => {\n if (lastCarried.current === carriedKey) return;\n lastCarried.current = carriedKey;\n if (name) changed?.(name);\n }, [carriedKey, changed, name]);\n\n return (\n <div ref={rootRef} className={cx(\"ow-field\", className)}>\n {label ? (\n <label id={labelId} className=\"ow-field__label\" htmlFor={controlId}>\n {label}\n </label>\n ) : null}\n {child ? cloneElement(child, { id: controlId, \"aria-describedby\": describedBy, ...labelledBy, ...invalidProp }) : children}\n {carries && nameProp\n ? carriedValues.map((value, index) => <input key={index} type=\"hidden\" name={nameProp} value={value === true ? \"on\" : String(value)} />)\n : null}\n {hint ? (\n <p id={hintId} className=\"ow-field__hint\">\n {hint}\n </p>\n ) : null}\n {shownError ? (\n <p id={errorId} role=\"alert\" className=\"ow-field__error\">\n {shownError}\n </p>\n ) : null}\n </div>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useId,\n useRef,\n type ForwardedRef,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, MinusIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\ninterface CheckboxGroupContextValue {\n value: string[];\n toggle(value: string, checked: boolean): void;\n name: string;\n disabled: boolean;\n}\n\nconst CheckboxGroupContext = /* @__PURE__ */ createContext<CheckboxGroupContextValue | null>(null);\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n /** `sm` is 14px, for dense rows; `md` is 16px.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** `danger` for choices that make an action destructive, like also deleting files.\n * @default \"primary\" */\n tone?: \"primary\" | \"danger\";\n /** Shows a dash: some, not all, of what it controls is checked (a \"select all\" box).\n * @default false */\n indeterminate?: boolean;\n /** The label. With it, Checkbox renders its own <label>; without it, wrap it in yours. */\n children?: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A real checkbox input, restyled. It keeps native behaviour (Space to toggle, form submission, `disabled`).\n * Give it children for its label, or wrap the bare box in your own <label>. Inside a CheckboxGroup, give it a `value`.\n */\nexport const Checkbox = /* @__PURE__ */ forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n {\n className,\n size = \"md\",\n tone = \"primary\",\n indeterminate = false,\n children,\n description,\n value,\n checked,\n onChange,\n disabled,\n name,\n \"aria-describedby\": describedBy,\n ...inputProps\n },\n ref,\n) {\n const group = useContext(CheckboxGroupContext);\n const innerRef = useRef<HTMLInputElement | null>(null);\n const descriptionId = useId();\n const inGroup = group !== null && value !== undefined;\n\n useEffect(() => {\n if (innerRef.current) innerRef.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n const box = (\n <span\n className={cx(\n \"ow-checkbox\",\n `ow-checkbox--${size}`,\n tone === \"danger\" && \"ow-checkbox--danger\",\n children === undefined && className,\n )}\n >\n <input\n ref={(element) => {\n innerRef.current = element;\n assignRef(ref, element);\n }}\n type=\"checkbox\"\n className=\"ow-checkbox__input\"\n value={value}\n name={inGroup ? group.name : name}\n checked={inGroup ? group.value.includes(String(value)) : checked}\n disabled={disabled || (inGroup && group.disabled)}\n aria-describedby={[describedBy, description ? descriptionId : undefined].filter(Boolean).join(\" \") || undefined}\n onChange={(event) => {\n onChange?.(event);\n if (inGroup) group.toggle(String(value), event.target.checked);\n }}\n {...inputProps}\n />\n {indeterminate ? (\n <MinusIcon className=\"ow-checkbox__check ow-checkbox__check--dash\" size={size === \"sm\" ? 10 : 12} strokeWidth={3} />\n ) : (\n <CheckIcon className=\"ow-checkbox__check\" size={size === \"sm\" ? 10 : 12} strokeWidth={3} />\n )}\n </span>\n );\n\n if (children === undefined) return box;\n return (\n <label className={cx(\"ow-check-label\", (disabled || (inGroup && group.disabled)) && \"ow-check-label--disabled\", className)}>\n {box}\n <span className=\"ow-check-label__text\">\n <span>{children}</span>\n {description ? (\n <span id={descriptionId} className=\"ow-check-label__description\">\n {description}\n </span>\n ) : null}\n </span>\n </label>\n );\n});\n\nexport interface CheckboxGroupProps {\n /** The question, shown as the group's legend. */\n label: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n /** The checked values. */\n value?: string[];\n /** @default [] */\n defaultValue?: string[];\n onChange?(value: string[]): void;\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** An error under the options. */\n error?: ReactNode;\n disabled?: boolean;\n /** The form field name for every box. */\n name?: string;\n /** Checkboxes, each with a `value` and a label. */\n children: ReactNode;\n className?: string;\n}\n\n/** Several options where any number can be chosen, under one label. */\nexport function CheckboxGroup({\n label,\n description,\n value,\n defaultValue = [],\n onChange,\n orientation = \"vertical\",\n error,\n disabled = false,\n name,\n children,\n className,\n}: CheckboxGroupProps) {\n const [current, setCurrent] = useControllableState(value, defaultValue, onChange);\n const generatedName = useId();\n const errorId = useId();\n return (\n <CheckboxGroupContext.Provider\n value={{\n value: current,\n name: name ?? generatedName,\n disabled,\n toggle(item, checked) {\n setCurrent(checked ? [...current.filter((v) => v !== item), item] : current.filter((v) => v !== item));\n },\n }}\n >\n <Fieldset\n legend={label}\n description={description}\n error={error}\n errorId={errorId}\n className={cx(orientation === \"horizontal\" && \"ow-fieldset--horizontal\", className)}\n >\n {children}\n </Fieldset>\n </CheckboxGroupContext.Provider>\n );\n}\n\nexport interface FieldsetProps {\n /** The group's title. */\n legend: ReactNode;\n /** A muted line under the legend. */\n description?: ReactNode;\n /** An error under the content, announced when it appears. */\n error?: ReactNode;\n /** @internal */\n errorId?: string;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** Groups related controls under a legend: a set of checkboxes, an address, a pair of dates. */\nexport function Fieldset({ legend, description, error, errorId, disabled, children, className }: FieldsetProps) {\n const generatedId = useId();\n const descriptionId = `${generatedId}-description`;\n const resolvedErrorId = errorId ?? `${generatedId}-error`;\n return (\n <fieldset\n className={cx(\"ow-fieldset\", className)}\n disabled={disabled}\n aria-describedby={[description ? descriptionId : \"\", error ? resolvedErrorId : \"\"].filter(Boolean).join(\" \") || undefined}\n >\n <legend className=\"ow-fieldset__legend\">{legend}</legend>\n {description ? (\n <p id={descriptionId} className=\"ow-fieldset__description\">\n {description}\n </p>\n ) : null}\n <div className=\"ow-fieldset__content\">{children}</div>\n {error ? (\n <p id={resolvedErrorId} role=\"alert\" className=\"ow-field__error\">\n {error}\n </p>\n ) : null}\n </fieldset>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type FormEvent,\n type FormHTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Alert } from \"../Alert/Alert\";\n\n/** What onSubmit and validate get: each name in the form with its value, or a string[] when the name appears more than once. */\nexport type FormValues = Record<string, string | string[]>;\n\n/** Messages by field name. */\nexport type FormErrors = Partial<Record<string, string>>;\n\n/** The browser's own checks, by their ValidityState names. */\nexport type ValidityCheck =\n | \"valueMissing\"\n | \"typeMismatch\"\n | \"patternMismatch\"\n | \"tooShort\"\n | \"tooLong\"\n | \"rangeUnderflow\"\n | \"rangeOverflow\"\n | \"stepMismatch\"\n | \"badInput\";\n\n/** What to say when a browser check fails: one message for any of them, or one per check. */\nexport type ValidityMessages = string | Partial<Record<ValidityCheck, string>>;\n\n/** What a Form tells the components inside it, through the render function or useFormStatus(). */\nexport interface FormStatus {\n /** True while the promise onSubmit returned is pending. */\n isSubmitting: boolean;\n /** The errors showing now, by field name. */\n errors: FormErrors;\n}\n\nexport interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, \"onSubmit\" | \"children\"> {\n /**\n * Called with the values once every check passes. Return a promise to keep the form busy until it settles; if it\n * rejects, the error's message shows in FormError (\"That didn't work. Try again.\" when it has none). Without\n * onSubmit, a valid form submits the usual way, to its `action`.\n */\n onSubmit?(values: FormValues, event: FormEvent<HTMLFormElement>): unknown;\n /** Checks the values after the browser's own checks, for rules it can't express: return { [name]: message } for what's wrong. */\n validate?(values: FormValues): FormErrors | void;\n /** Errors from the server, by field name. Each shows under its field until the person changes that field. */\n validationErrors?: FormErrors;\n /** The fields and buttons, or a function of the form's status: ({ isSubmitting, errors }) => \u2026 */\n children?: ReactNode | ((status: FormStatus) => ReactNode);\n}\n\n/** @internal What a Field tells its Form, so the Form can word its errors, focus it and tell which field lost focus. */\nexport interface FormFieldEntry {\n name: string | undefined;\n root: RefObject<HTMLElement>;\n controlId: string;\n errorMessages: ValidityMessages | undefined;\n}\n\ninterface FormContextValue {\n status: FormStatus;\n formError: string | undefined;\n register(entry: MutableRefObject<FormFieldEntry>): () => void;\n changed(name: string): void;\n addErrorSlot(): () => void;\n}\n\n/** @internal */\nexport const FormContext = /* @__PURE__ */ createContext<FormContextValue | null>(null);\n\ninterface Validatable extends HTMLElement {\n name: string;\n willValidate: boolean;\n validity: ValidityState;\n validationMessage: string;\n}\n\nconst checks: ValidityCheck[] = [\n \"valueMissing\",\n \"typeMismatch\",\n \"patternMismatch\",\n \"tooShort\",\n \"tooLong\",\n \"rangeUnderflow\",\n \"rangeOverflow\",\n \"stepMismatch\",\n \"badInput\",\n];\n\nconst failedMessage = \"That didn't work. Try again.\";\nconst focusable = ':is(input:not([type=\"hidden\"]), select, textarea, button, [tabindex]):not(:disabled):not([tabindex=\"-1\"])';\nconst idle: FormStatus = { isSubmitting: false, errors: {} };\n\nconst controlsOf = (form: HTMLFormElement) => Array.from(form.elements) as Validatable[];\n\nfunction canFocus(element: Element | null | undefined): element is HTMLElement {\n return element instanceof HTMLElement && element.matches(focusable) && element.getClientRects().length > 0;\n}\n\nfunction firstFocusable(root: Element | null | undefined) {\n return root ? Array.from(root.querySelectorAll(focusable)).find(canFocus) : undefined;\n}\n\nfunction valuesOf(form: HTMLFormElement, submitter?: HTMLElement | null): FormValues {\n const data = new FormData(form);\n // The button that submitted the form is part of what it sends, as in a plain form.\n if ((submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) && submitter.name) {\n data.append(submitter.name, submitter.value);\n }\n const values: FormValues = {};\n data.forEach((value, name) => {\n if (typeof value !== \"string\") return;\n const existing = values[name];\n values[name] = existing === undefined ? value : [...(Array.isArray(existing) ? existing : [existing]), value];\n });\n return values;\n}\n\nfunction messageOf(error: unknown) {\n if (typeof error === \"string\" && error) return error;\n if (error instanceof Error && error.message) return error.message;\n return failedMessage;\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n typeof value === \"object\" && value !== null && typeof (value as PromiseLike<unknown>).then === \"function\";\n\nfunction sameErrors(a: FormErrors, b: FormErrors) {\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);\n}\n\n/**\n * A form that checks its fields before it submits. On submit it runs the browser's checks (required, type, minLength,\n * pattern, min, max\u2026), then `validate`, then any `validationErrors`; each message shows under its Field and focus goes to\n * the first wrong field. Only when everything passes does it call onSubmit with the values.\n */\nexport const Form = /* @__PURE__ */ forwardRef<HTMLFormElement, FormProps>(function Form(\n { onSubmit, validate, validationErrors, children, className, onChange, onBlur, onReset, ...formProps },\n ref,\n) {\n const formRef = useRef<HTMLFormElement | null>(null);\n const fields = useRef(new Set<MutableRefObject<FormFieldEntry>>());\n const [local, setLocal] = useState<FormErrors>({});\n const [dismissed, setDismissed] = useState<ReadonlySet<string>>(() => new Set());\n const [isSubmitting, setSubmitting] = useState(false);\n const [formError, setFormError] = useState<string>();\n const [errorSlots, setErrorSlots] = useState(0);\n const [focusRequest, setFocusRequest] = useState(0);\n const [refreshRequest, setRefreshRequest] = useState(0);\n const queue = useRef({ changed: new Set<string>(), blurred: new Set<string>() });\n const submitted = useRef(false);\n const busy = useRef(false);\n const mounted = useRef(true);\n const attempts = useRef(0);\n const latest = useRef({ validate, validationErrors, local, dismissed });\n latest.current = { validate, validationErrors, local, dismissed };\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const setFormRef = useCallback(\n (element: HTMLFormElement | null) => {\n formRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n [ref],\n );\n\n const entryFor = (name: string) => [...fields.current].find((entry) => entry.current.name === name)?.current;\n\n /** The field a node belongs to: the Field around it, or its own name. */\n function nameAt(node: EventTarget | null) {\n if (!(node instanceof Element)) return undefined;\n for (const entry of fields.current) {\n const { name, root } = entry.current;\n if (name && root.current?.contains(node)) return name;\n }\n return (node as Validatable).name || undefined;\n }\n\n /** The browser's checks, then validate(): the first message for each name. */\n function collect(form: HTMLFormElement): FormErrors {\n const found: FormErrors = {};\n for (const element of controlsOf(form)) {\n const { name } = element;\n if (!name || found[name] || !element.willValidate || element.validity.valid) continue;\n const messages = entryFor(name)?.errorMessages;\n const failed = checks.find((check) => element.validity[check]);\n found[name] = typeof messages === \"string\" ? messages : (failed && messages?.[failed]) || element.validationMessage || \"Check this field.\";\n }\n const custom = latest.current.validate?.(valuesOf(form)) ?? {};\n for (const [name, message] of Object.entries(custom)) if (message && !found[name]) found[name] = message;\n return found;\n }\n\n const serverErrors = useMemo(() => {\n const active: FormErrors = {};\n for (const [name, message] of Object.entries(validationErrors ?? {})) if (message && !dismissed.has(name)) active[name] = message;\n return active;\n }, [validationErrors, dismissed]);\n\n // The browser's and validate()'s messages come before the server's.\n const errors = useMemo(() => ({ ...serverErrors, ...local }), [serverErrors, local]);\n const errorsRef = useRef(errors);\n errorsRef.current = errors;\n\n // Changes and blurs are handled after React renders them, so hidden inputs that carry a value have caught up.\n const request = useCallback((name: string, kind: \"changed\" | \"blurred\") => {\n // With no message showing, a change has nothing to clear: skip the render.\n if (kind === \"changed\" && !Object.keys(errorsRef.current).length) return;\n queue.current[kind].add(name);\n setRefreshRequest((count) => count + 1);\n }, []);\n\n // A hidden input that carries a control's value (a code, a date) changes without an input event, so watch it.\n useEffect(() => {\n const form = formRef.current;\n if (!form || typeof MutationObserver === \"undefined\") return;\n const observer = new MutationObserver((mutations) => {\n for (const { target } of mutations) {\n const name = target instanceof HTMLInputElement && target.type === \"hidden\" ? nameAt(target) : undefined;\n if (name) request(name, \"changed\");\n }\n });\n observer.observe(form, { subtree: true, attributes: true, attributeFilter: [\"value\"] });\n return () => observer.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- nameAt reads refs only.\n }, [request]);\n\n useEffect(() => {\n const form = formRef.current;\n const { changed, blurred } = queue.current;\n queue.current = { changed: new Set(), blurred: new Set() };\n if (!form || (!changed.size && !blurred.size)) return;\n\n // A server error is about the value it was sent, so it goes once that value changes.\n const server = latest.current.validationErrors ?? {};\n const edited = [...changed].filter((name) => server[name] && !latest.current.dismissed.has(name));\n if (edited.length) setDismissed((previous) => new Set([...previous, ...edited]));\n\n // Messages already showing are checked again (and go once fixed); a field that lost focus can get a new one.\n const current = latest.current.local;\n const names = new Set([...Object.keys(current), ...blurred]);\n if (!names.size) return;\n const fresh = collect(form);\n const next: FormErrors = {};\n for (const name of names) if (fresh[name]) next[name] = fresh[name];\n if (!sameErrors(next, current)) setLocal(next);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per request.\n }, [refreshRequest]);\n\n // New errors from the server show again, even where the person had edited, and take focus. Not on first render.\n const serverKey = JSON.stringify(validationErrors ?? {});\n const serverSeen = useRef<{ key: string; attempts: number } | null>(null);\n useEffect(() => {\n const previous = serverSeen.current;\n serverSeen.current = { key: serverKey, attempts: attempts.current };\n if (!previous || (previous.key === serverKey && previous.attempts === attempts.current)) return;\n setDismissed(new Set());\n if (Object.values(validationErrors ?? {}).some(Boolean)) setFocusRequest((count) => count + 1);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- serverKey stands for validationErrors.\n }, [validationErrors]);\n\n // Focus the first field with an error, in the order they appear.\n useEffect(() => {\n const form = formRef.current;\n if (!focusRequest || !form) return;\n const targets: HTMLElement[] = [];\n for (const name of Object.keys(errorsRef.current)) {\n const entry = entryFor(name);\n const named = controlsOf(form).filter((element) => element.name === name);\n const control = entry ? document.getElementById(entry.controlId) : null;\n const target =\n (canFocus(control) ? control : firstFocusable(entry?.root.current)) ??\n named.find(canFocus) ??\n // A hidden input that carries a value: focus what's beside it, such as a code's first box.\n firstFocusable(named[0]?.parentElement);\n if (target) targets.push(target);\n }\n targets.sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));\n targets[0]?.focus();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per request.\n }, [focusRequest]);\n\n function handleSubmit(event: FormEvent<HTMLFormElement>) {\n const form = event.currentTarget;\n const submitter = (event.nativeEvent as SubmitEvent).submitter;\n if (busy.current) {\n event.preventDefault();\n return;\n }\n attempts.current += 1;\n submitted.current = true;\n setFormError(undefined);\n\n // A button with formNoValidate, such as \"Save draft\", submits without the checks, as in a plain form.\n const skipChecks = (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) && submitter.formNoValidate;\n const found = skipChecks ? {} : collect(form);\n setLocal(found);\n if (!skipChecks && Object.keys({ ...serverErrors, ...found }).length) {\n event.preventDefault();\n setFocusRequest((count) => count + 1);\n return;\n }\n if (!onSubmit) return;\n\n event.preventDefault();\n let result: unknown;\n try {\n result = onSubmit(valuesOf(form, submitter), event);\n } catch (error) {\n setFormError(messageOf(error));\n return;\n }\n if (!isThenable(result)) return;\n busy.current = true;\n setSubmitting(true);\n result.then(\n () => {\n busy.current = false;\n if (mounted.current) setSubmitting(false);\n },\n (error: unknown) => {\n busy.current = false;\n if (!mounted.current) return;\n setSubmitting(false);\n setFormError(messageOf(error));\n },\n );\n }\n\n function handleChange(event: FormEvent<HTMLFormElement>) {\n onChange?.(event);\n const name = nameAt(event.target);\n if (name) request(name, \"changed\");\n }\n\n function handleBlur(event: FocusEvent<HTMLFormElement>) {\n onBlur?.(event);\n if (!submitted.current) return;\n const name = nameAt(event.target);\n // Moving between the boxes of one field, or the options of one radio group, isn't leaving it.\n if (name && nameAt(event.relatedTarget) !== name) request(name, \"blurred\");\n }\n\n function handleReset(event: FormEvent<HTMLFormElement>) {\n onReset?.(event);\n submitted.current = false;\n setLocal({});\n setFormError(undefined);\n setDismissed(new Set(Object.keys(validationErrors ?? {})));\n }\n\n const register = useCallback((entry: MutableRefObject<FormFieldEntry>) => {\n fields.current.add(entry);\n return () => {\n fields.current.delete(entry);\n };\n }, []);\n\n const changed = useCallback((name: string) => request(name, \"changed\"), [request]);\n\n const addErrorSlot = useCallback(() => {\n setErrorSlots((count) => count + 1);\n return () => setErrorSlots((count) => count - 1);\n }, []);\n\n const status = useMemo<FormStatus>(() => ({ isSubmitting, errors }), [isSubmitting, errors]);\n const context = useMemo<FormContextValue>(\n () => ({ status, formError, register, changed, addErrorSlot }),\n [status, formError, register, changed, addErrorSlot],\n );\n\n return (\n <FormContext.Provider value={context}>\n <form\n ref={setFormRef}\n {...formProps}\n noValidate\n aria-busy={isSubmitting || undefined}\n className={cx(\"ow-form\", className)}\n onSubmit={handleSubmit}\n onChange={handleChange}\n onBlur={handleBlur}\n onReset={handleReset}\n >\n {typeof children === \"function\" ? children(status) : children}\n {formError && errorSlots === 0 ? <FormErrorAlert message={formError} /> : null}\n </form>\n </FormContext.Provider>\n );\n});\n\nfunction FormErrorAlert({ message, className }: { message: string; className?: string }) {\n return (\n <Alert variant=\"danger\" className={cx(\"ow-form__error\", className)}>\n {message}\n </Alert>\n );\n}\n\nexport interface FormErrorProps {\n className?: string;\n}\n\n/**\n * Where a Form says why a submission failed: the message from a rejected onSubmit, in a danger Alert (role=\"alert\").\n * Put it just above the buttons. Without one, the Form shows the message at its end.\n */\nexport function FormError({ className }: FormErrorProps) {\n const form = useContext(FormContext);\n const addErrorSlot = form?.addErrorSlot;\n useEffect(() => addErrorSlot?.(), [addErrorSlot]);\n return form?.formError ? <FormErrorAlert message={form.formError} className={className} /> : null;\n}\n\n/** The status of the Form around a component, for a submit button that shows `loading` while it submits. */\nexport function useFormStatus(): FormStatus {\n return useContext(FormContext)?.status ?? idle;\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\";\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** info for news, success for something done, warning for something that needs the person, danger for something that failed.\n * @default \"info\" */\n variant?: AlertVariant;\n /** A short bold line. */\n title?: ReactNode;\n /** Replaces the variant's icon; false hides it. */\n icon?: ReactNode | false;\n /** Buttons under the text, usually small ones. */\n actions?: ReactNode;\n /** Shows a \u2715 that calls this. */\n onClose?(): void;\n children?: ReactNode;\n}\n\nconst icons: Record<AlertVariant, ReactNode> = {\n info: <InfoIcon size={16} />,\n success: <CircleCheckIcon size={16} />,\n warning: <TriangleAlertIcon size={16} />,\n danger: <CircleAlertIcon size={16} />,\n neutral: <InfoIcon size={16} />,\n};\n\n/** A message inside the page about the page: a notice, a warning before an action, an error that blocks the work. */\nexport function Alert({\n variant = \"info\",\n title,\n icon,\n actions,\n onClose,\n children,\n className,\n role,\n ...props\n}: AlertProps) {\n return (\n <div\n role={role ?? (variant === \"danger\" || variant === \"warning\" ? \"alert\" : \"status\")}\n className={cx(\"ow-alert\", `ow-alert--${variant}`, className)}\n {...props}\n >\n {icon === false ? null : <span className=\"ow-alert__icon\">{icon ?? icons[variant]}</span>}\n <div className=\"ow-alert__body\">\n {title ? <div className=\"ow-alert__title\">{title}</div> : null}\n {children ? <div className=\"ow-alert__description\">{children}</div> : null}\n {actions ? <div className=\"ow-alert__actions\">{actions}</div> : null}\n </div>\n {onClose ? <CloseButton size=\"sm\" label=\"Dismiss\" className=\"ow-alert__close\" onClick={onClose} /> : null}\n </div>\n );\n}\n", "import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid.\n * @default false */\n isInvalid?: boolean;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Inside the field, before the text: a 16px icon, a unit, a prefix like \"https://\". */\n startContent?: ReactNode;\n /** Inside the field, after the text: a unit, a small ghost Button, a Spinner. */\n endContent?: ReactNode;\n}\n\n/**\n * A single-line text field. With startContent or endContent, the field becomes a group and `className`\n * goes on the group, so width and margins apply to the whole field.\n */\nexport const Input = /* @__PURE__ */ forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, isInvalid = false, size = \"md\", startContent, endContent, ...inputProps },\n ref,\n) {\n const invalid = isInvalid || undefined;\n if (startContent === undefined && endContent === undefined) {\n return (\n <input\n ref={ref}\n className={cx(\"ow-input\", size === \"sm\" && \"ow-input--sm\", isInvalid && \"ow-input--invalid\", className)}\n aria-invalid={invalid}\n {...inputProps}\n />\n );\n }\n return (\n <div\n className={cx(\n \"ow-input-group\",\n size === \"sm\" && \"ow-input-group--sm\",\n isInvalid && \"ow-input-group--invalid\",\n inputProps.disabled && \"ow-input-group--disabled\",\n className,\n )}\n >\n {startContent !== undefined ? <span className=\"ow-input-group__addon\">{startContent}</span> : null}\n <input ref={ref} className=\"ow-input-group__input\" aria-invalid={invalid} {...inputProps} />\n {endContent !== undefined ? <span className=\"ow-input-group__addon\">{endContent}</span> : null}\n </div>\n );\n});\n", "import { forwardRef, useRef, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { SearchIcon } from \"../../icons\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\nimport { Input, type InputProps } from \"../Input/Input\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\nexport interface SearchFieldProps\n extends Omit<InputProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"startContent\" | \"endContent\" | \"onSubmit\"> {\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called with the text when the person presses Enter. */\n onSubmit?(value: string): void;\n /** Shows a spinner in place of the clear button while results load.\n * @default false */\n loading?: boolean;\n /** Names the field when there's no visible label.\n * @default \"Search\" */\n \"aria-label\"?: string;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A search box: a magnifier, the text, and a clear button once there's something to clear. Escape clears it. */\nexport const SearchField = /* @__PURE__ */ forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n value,\n defaultValue = \"\",\n onChange,\n onSubmit,\n loading = false,\n placeholder = \"Search\",\n \"aria-label\": ariaLabel = \"Search\",\n size = \"md\",\n onKeyDown,\n ...inputProps\n },\n ref,\n) {\n const [text, setText] = useControllableState(value, defaultValue, onChange);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && text) {\n event.preventDefault();\n event.stopPropagation();\n setText(\"\");\n } else if (event.key === \"Enter\") {\n onSubmit?.(text);\n }\n }\n\n return (\n <Input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n type=\"search\"\n size={size}\n placeholder={placeholder}\n aria-label={ariaLabel}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={handleKeyDown}\n startContent={<SearchIcon size={size === \"sm\" ? 14 : 16} />}\n endContent={\n loading ? (\n <Spinner size=\"sm\" label=\"Searching\" />\n ) : text ? (\n <CloseButton\n size=\"sm\"\n label=\"Clear search\"\n onClick={() => {\n setText(\"\");\n inputRef.current?.focus();\n }}\n />\n ) : null\n }\n {...inputProps}\n />\n );\n});\n", "import { forwardRef, useState, type InputHTMLAttributes, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { MinusIcon, PlusIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"value\" | \"defaultValue\" | \"onChange\" | \"size\" | \"type\" | \"min\" | \"max\" | \"step\"> {\n /** The number, or null when empty. */\n value?: number | null;\n /** @default null */\n defaultValue?: number | null;\n onChange?(value: number | null): void;\n min?: number;\n max?: number;\n /** How much the buttons and arrow keys change it. PageUp and PageDown move ten steps.\n * @default 1 */\n step?: number;\n /** How the number is shown while the field isn't being edited, e.g. { style: \"currency\", currency: \"EUR\" }. */\n formatOptions?: Intl.NumberFormatOptions;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default false */\n isInvalid?: boolean;\n /** Names the field when there's no visible label (Field gives it one). */\n \"aria-label\"?: string;\n}\n\nconst decimals = (step: number) => (String(step).split(\".\")[1] ?? \"\").length;\n\n/** A number with \u2212 and + buttons either side. Up and Down step it; the value is clamped to min and max. */\nexport const NumberField = /* @__PURE__ */ forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n step = 1,\n formatOptions,\n size = \"md\",\n isInvalid = false,\n disabled,\n className,\n onBlur,\n onFocus,\n onKeyDown,\n name,\n form,\n ...inputProps\n },\n ref,\n) {\n const [number, setNumber] = useControllableState(value, defaultValue, onChange);\n const [draft, setDraft] = useState<string | null>(null);\n const format = (n: number | null) =>\n n === null ? \"\" : formatOptions ? new Intl.NumberFormat(undefined, formatOptions).format(n) : String(n);\n\n const clamp = (n: number) => {\n const rounded = Number(n.toFixed(decimals(step)));\n return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, rounded));\n };\n\n // While the field has focus, `draft` holds the raw text; otherwise the number is shown formatted.\n function commit(text: string, keepEditing = false) {\n setDraft(keepEditing ? text : null);\n const cleaned = text.replace(/[^\\d.,-]/g, \"\").replace(\",\", \".\");\n if (cleaned === \"\" || cleaned === \"-\") {\n setNumber(null);\n return;\n }\n const parsed = Number(cleaned);\n if (Number.isNaN(parsed)) return;\n const next = clamp(parsed);\n setNumber(next);\n if (keepEditing) setDraft(String(next));\n }\n\n function stepBy(multiple: number) {\n const base = draft !== null && draft !== \"\" && !Number.isNaN(Number(draft)) ? Number(draft) : (number ?? min ?? 0);\n const next = clamp(base + step * multiple);\n setNumber(next);\n if (draft !== null) setDraft(String(next));\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const moves: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => min !== undefined && commit(String(min), draft !== null),\n End: () => max !== undefined && commit(String(max), draft !== null),\n Enter: () => draft !== null && commit(draft, true),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n }\n\n const atMin = min !== undefined && number !== null && number <= min;\n const atMax = max !== undefined && number !== null && number >= max;\n\n return (\n <div\n className={cx(\n \"ow-number-field\",\n size === \"sm\" && \"ow-number-field--sm\",\n isInvalid && \"ow-number-field--invalid\",\n disabled && \"ow-number-field--disabled\",\n className,\n )}\n >\n <button\n type=\"button\"\n className=\"ow-number-field__step\"\n aria-label=\"Decrease\"\n tabIndex={-1}\n disabled={disabled || atMin}\n onClick={() => stepBy(-1)}\n >\n <MinusIcon size={14} />\n </button>\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals(step) > 0 || (min ?? 0) < 0 ? \"decimal\" : \"numeric\"}\n role=\"spinbutton\"\n autoComplete=\"off\"\n className=\"ow-number-field__input\"\n aria-valuenow={number ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={number === null ? undefined : format(number)}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n value={draft ?? format(number)}\n onFocus={(event) => {\n onFocus?.(event);\n setDraft(number === null ? \"\" : String(number));\n }}\n onChange={(event) => setDraft(event.target.value)}\n onBlur={(event) => {\n onBlur?.(event);\n commit(event.target.value);\n }}\n onKeyDown={handleKeyDown}\n {...inputProps}\n />\n {/* The field shows the number formatted (\"\u20AC1,200.00\"), so a form gets the plain number from here instead. */}\n {name ? <input type=\"hidden\" name={name} form={form} value={number ?? \"\"} disabled={disabled} /> : null}\n <button\n type=\"button\"\n className=\"ow-number-field__step\"\n aria-label=\"Increase\"\n tabIndex={-1}\n disabled={disabled || atMax}\n onClick={() => stepBy(1)}\n >\n <PlusIcon size={14} />\n </button>\n </div>\n );\n});\n", "import { useRef, type ClipboardEvent, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface InputOTPProps {\n /** How many characters the code has.\n * @default 6 */\n length?: number;\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called once every box is filled. */\n onComplete?(value: string): void;\n /** `numeric` accepts digits only; `alphanumeric` letters and digits (shown upper case).\n * @default \"numeric\" */\n type?: \"numeric\" | \"alphanumeric\";\n /** Splits the boxes into groups with a dash between, e.g. 3 for \"123\u2013456\". */\n groupSize?: number;\n /** @default false */\n isInvalid?: boolean;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Names the code for screen readers.\n * @default \"Verification code\" */\n \"aria-label\"?: string;\n /** The form field name; a hidden input carries the whole code. */\n name?: string;\n /** Names the code by another element's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of the hint or error that describe it, read from every box; Field sets this. */\n \"aria-describedby\"?: string;\n /** The id of the first box, so a Field's label points at it and clicking the label starts there; Field sets this. */\n id?: string;\n className?: string;\n}\n\n/**\n * A one-time code in separate boxes. Typing moves forward, Backspace moves back,\n * and pasting a code fills every box. The browser can fill it from a text message.\n */\nexport function InputOTP({\n length = 6,\n value,\n defaultValue = \"\",\n onChange,\n onComplete,\n type = \"numeric\",\n groupSize,\n isInvalid = false,\n disabled,\n autoFocus,\n \"aria-label\": ariaLabel = \"Verification code\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n name,\n className,\n}: InputOTPProps) {\n const [code, setCode] = useControllableState(value, defaultValue, onChange);\n const refs = useRef<Array<HTMLInputElement | null>>([]);\n // The code as of the last change, read by handlers that run before React renders it,\n // such as the next box's onFocus when typing moves focus forward.\n const latest = useRef(code);\n latest.current = code;\n const allowed = type === \"numeric\" ? /\\d/ : /[a-z0-9]/i;\n const clean = (text: string) => [...text].filter((char) => allowed.test(char)).join(\"\").toUpperCase();\n const chars = Array.from({ length }, (_, index) => code[index] ?? \"\");\n\n function update(next: string, focusIndex: number) {\n const trimmed = next.slice(0, length);\n latest.current = trimmed;\n setCode(trimmed);\n refs.current[Math.min(focusIndex, length - 1)]?.focus();\n if (trimmed.length === length && !trimmed.includes(\" \")) onComplete?.(trimmed);\n }\n\n function setAt(index: number, char: string) {\n const next = chars.map((existing, i) => (i === index ? char : existing));\n // Keep the code contiguous: an empty box ends it.\n const firstGap = next.indexOf(\"\");\n return (firstGap === -1 ? next : next.slice(0, firstGap)).join(\"\");\n }\n\n function onInput(index: number, text: string) {\n const typed = clean(text);\n if (!typed) return;\n if (typed.length > 1) {\n // Autofill or a paste into one box.\n update(chars.slice(0, index).join(\"\") + typed, index + typed.length);\n return;\n }\n update(setAt(index, typed), index + 1);\n }\n\n function onKeyDown(index: number, event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === \"Backspace\") {\n event.preventDefault();\n // Removes one character; the ones after it move back a box.\n if (chars[index]) update(code.slice(0, index) + code.slice(index + 1), index);\n else if (index > 0) update(code.slice(0, index - 1) + code.slice(index), index - 1);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n refs.current[Math.max(0, index - 1)]?.focus();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n refs.current[Math.min(length - 1, index + 1, code.length)]?.focus();\n }\n }\n\n function onPaste(index: number, event: ClipboardEvent<HTMLInputElement>) {\n event.preventDefault();\n const pasted = clean(event.clipboardData.getData(\"text\"));\n if (pasted) update(chars.slice(0, index).join(\"\") + pasted, index + pasted.length);\n }\n\n return (\n <div\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={cx(\"ow-otp\", isInvalid && \"ow-otp--invalid\", className)}\n >\n {chars.map((char, index) => (\n <span key={index} className=\"ow-otp__slot\">\n {groupSize && index > 0 && index % groupSize === 0 ? (\n <span className=\"ow-otp__separator\" aria-hidden=\"true\" />\n ) : null}\n <input\n ref={(element) => {\n refs.current[index] = element;\n }}\n className=\"ow-otp__input\"\n type=\"text\"\n inputMode={type === \"numeric\" ? \"numeric\" : \"text\"}\n autoComplete={index === 0 ? \"one-time-code\" : \"off\"}\n autoCapitalize=\"characters\"\n maxLength={length}\n id={index === 0 ? id : undefined}\n aria-label={`Character ${index + 1} of ${length}`}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n autoFocus={autoFocus && index === 0}\n value={char}\n // Clicking an empty box past the end goes to the next one to fill.\n onFocus={(event) => {\n const filled = latest.current.length;\n if (index > filled) refs.current[filled]?.focus();\n else event.target.select();\n }}\n onChange={(event) => onInput(index, event.target.value.replace(char, \"\") || event.target.value)}\n onKeyDown={(event) => onKeyDown(index, event)}\n onPaste={(event) => onPaste(index, event)}\n />\n </span>\n ))}\n {name ? <input type=\"hidden\" name={name} value={code} /> : null}\n </div>\n );\n}\n", "import { forwardRef, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { todayISO, type ISODate } from \"../Calendar/dates\";\nimport { localeDigits, SegmentedField, type Part, type Segment, type SegmentValues } from \"./SegmentedField\";\n\nexport interface DateFieldProps {\n /** The date as \"YYYY-MM-DD\", or \"\" while any part is empty. */\n value?: ISODate;\n /** @default \"\" */\n defaultValue?: ISODate;\n /** Called with \"YYYY-MM-DD\" when the date is complete and whenever it changes after that, and with \"\" when a part is cleared. */\n onChange?(value: ISODate): void;\n /** The earliest valid date, \"YYYY-MM-DD\". An earlier one shows the field as invalid. */\n min?: ISODate;\n /** The latest valid date, \"YYYY-MM-DD\". A later one shows the field as invalid. */\n max?: ISODate;\n /** The order of day, month and year and the separators between them follow this locale: dd/mm/yyyy in \"en-IE\",\n * mm/dd/yyyy in \"en-US\", dd.mm.yyyy in \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid. A date outside\n * min and max does this by itself.\n * @default false */\n isInvalid?: boolean;\n /** @default false */\n disabled?: boolean;\n /** The date can be focused and read but not changed.\n * @default false */\n readOnly?: boolean;\n /** The form field name: a hidden input carries the \"YYYY-MM-DD\" value. */\n name?: string;\n /** Inside the field, before the date: a 16px calendar icon. */\n startContent?: ReactNode;\n /** Goes on the group. Field sets it, and its label then names the group and focuses the first segment when clicked. */\n id?: string;\n /** Names the date for screen readers when there's no visible label. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** Field points it at its hint and error; each segment is described by them. */\n \"aria-describedby\"?: string;\n className?: string;\n}\n\ntype DateParts = { day?: number | undefined; month?: number | undefined; year?: number | undefined };\n\nconst pad = (n: number, length = 2) => String(n).padStart(length, \"0\");\nconst isLeapYear = (year: number) => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\n/** Days in a month (1\u201312); with no month, 31, and with no year, February has 29. */\nfunction daysIn(year: number | undefined, month: number | undefined): number {\n if (month === undefined) return 31;\n if (month === 2) return year === undefined || isLeapYear(year) ? 29 : 28;\n return [4, 6, 9, 11].includes(month) ? 30 : 31;\n}\n\nfunction fromISO(iso: string): DateParts {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return {};\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > daysIn(year, month)) return {};\n return { year, month, day };\n}\n\nfunction toISOValue({ day, month, year }: DateParts): ISODate {\n return day === undefined || month === undefined || year === undefined ? \"\" : `${pad(year, 4)}-${pad(month)}-${pad(day)}`;\n}\n\n/** A day past the end of the month (31 when February is chosen) becomes its last day. */\nfunction constrain(parts: DateParts): DateParts {\n const last = daysIn(parts.year, parts.month);\n return parts.day !== undefined && parts.day > last ? { ...parts, day: last } : parts;\n}\n\ntype DateLayout = Array<{ type: \"day\" | \"month\" | \"year\" } | { type: \"literal\"; text: string }>;\n\n/** The order of day, month and year and the separators between them, from the locale's short numeric date. */\nfunction dateLayout(locale: string | undefined): DateLayout {\n const format = new Intl.DateTimeFormat(locale, { year: \"numeric\", month: \"2-digit\", day: \"2-digit\", timeZone: \"UTC\" });\n const layout: DateLayout = [];\n for (const part of format.formatToParts(new Date(Date.UTC(2026, 10, 23)))) {\n if (part.type === \"day\" || part.type === \"month\" || part.type === \"year\") layout.push({ type: part.type });\n else if (part.type === \"literal\") layout.push({ type: \"literal\", text: part.value });\n }\n return layout;\n}\n\n/**\n * A date typed into day, month and year segments in the locale's order, like macOS's date fields. Each segment\n * takes digits and moves on when it's full; the arrow keys step it. Pair it with a Calendar in a Popover, or use\n * DatePicker, when people would rather pick from a month.\n */\nexport const DateField = /* @__PURE__ */ forwardRef<HTMLDivElement, DateFieldProps>(function DateField(\n {\n value,\n defaultValue = \"\",\n onChange,\n min,\n max,\n locale,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n readOnly = false,\n name,\n startContent,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n },\n ref,\n) {\n const [current, setCurrent] = useControllableState<ISODate>(value, defaultValue, onChange);\n // The segments can hold a date that isn't complete yet; the value is \"\" until it is.\n const [parts, setParts] = useState<DateParts>(() => fromISO(current));\n const partsRef = useRef(parts);\n partsRef.current = parts;\n const [synced, setSynced] = useState(current);\n if (current !== synced) {\n setSynced(current);\n if (current !== toISOValue(parts)) setParts(fromISO(current));\n }\n\n function update(changes: SegmentValues) {\n const next = constrain({ ...partsRef.current, ...changes });\n partsRef.current = next;\n setParts(next);\n setCurrent(toISOValue(next));\n }\n\n const formats = useMemo(() => {\n const two = new Intl.NumberFormat(locale, { minimumIntegerDigits: 2, useGrouping: false });\n const four = new Intl.NumberFormat(locale, { minimumIntegerDigits: 4, useGrouping: false });\n const month = new Intl.DateTimeFormat(locale, { month: \"long\", timeZone: \"UTC\" });\n const months = Array.from({ length: 12 }, (_, index) => month.format(new Date(Date.UTC(2026, index, 1))));\n return { two, four, months, digits: localeDigits(locale), layout: dateLayout(locale) };\n }, [locale]);\n\n // Up or Down on an empty segment starts from today, or the nearest date min and max allow.\n let reference = todayISO();\n if (min && reference < min) reference = min;\n if (max && reference > max) reference = max;\n const start = fromISO(reference);\n const lastDay = daysIn(parts.year, parts.month);\n\n const segments: Record<\"day\" | \"month\" | \"year\", Segment> = {\n day: {\n type: \"day\",\n label: \"Day\",\n value: parts.day,\n min: 1,\n max: lastDay,\n placeholder: \"dd\",\n format: (n) => formats.two.format(n),\n describe: String,\n start: Math.min(start.day ?? 1, lastDay),\n page: 7,\n wrap: true,\n width: 2,\n },\n month: {\n type: \"month\",\n label: \"Month\",\n value: parts.month,\n min: 1,\n max: 12,\n placeholder: \"mm\",\n format: (n) => formats.two.format(n),\n describe: (n) => `${n} \u2013 ${formats.months[n - 1]}`,\n start: start.month ?? 1,\n page: 2,\n wrap: true,\n width: 2,\n },\n year: {\n type: \"year\",\n label: \"Year\",\n value: parts.year,\n min: 1,\n max: 9999,\n placeholder: \"yyyy\",\n format: (n) => formats.four.format(n),\n describe: String,\n start: start.year ?? 2026,\n page: 5,\n wrap: false,\n deferTyping: true,\n width: 4,\n },\n };\n const layout: Part[] = formats.layout.map((part) => (part.type === \"literal\" ? part : segments[part.type]));\n\n const outOfRange = current !== \"\" && ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <SegmentedField\n parts={layout}\n value={current}\n onSegmentsChange={update}\n parsePaste={(text) => (/^\\d{4}-\\d{2}-\\d{2}$/.test(text) && toISOValue(fromISO(text)) ? fromISO(text) : null)}\n digits={formats.digits}\n forwardedRef={ref}\n id={id}\n name={name}\n size={size}\n isInvalid={isInvalid || outOfRange}\n disabled={disabled}\n readOnly={readOnly}\n startContent={startContent}\n className={className}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n />\n );\n});\n", "/** Dates as \"YYYY-MM-DD\" strings: no time, no time zone, so a date never shifts by a day. */\nexport type ISODate = string;\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\nexport function toISO(year: number, month: number, day: number): ISODate {\n // setUTCFullYear, not Date.UTC, which reads years 0\u201399 as 1900\u20131999. Months and days past the end roll over.\n const date = new Date(0);\n date.setUTCFullYear(year, month, day);\n return `${String(date.getUTCFullYear()).padStart(4, \"0\")}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())}`;\n}\n\nexport function parseISO(iso: ISODate): { year: number; month: number; day: number } {\n const [year, month, day] = iso.split(\"-\").map(Number);\n return { year: year!, month: month! - 1, day: day! };\n}\n\nexport function todayISO(): ISODate {\n const now = new Date();\n return toISO(now.getFullYear(), now.getMonth(), now.getDate());\n}\n\nexport function addDays(iso: ISODate, days: number): ISODate {\n const { year, month, day } = parseISO(iso);\n return toISO(year, month, day + days);\n}\n\nexport function addMonths(iso: ISODate, months: number): ISODate {\n const { year, month, day } = parseISO(iso);\n const lastDay = new Date(Date.UTC(year, month + months + 1, 0)).getUTCDate();\n return toISO(year, month + months, Math.min(day, lastDay));\n}\n\n/** 0 = Sunday \u2026 6 = Saturday. */\nexport function weekday(iso: ISODate): number {\n const { year, month, day } = parseISO(iso);\n return new Date(Date.UTC(year, month, day)).getUTCDay();\n}\n\nexport function toDate(iso: ISODate): Date {\n const { year, month, day } = parseISO(iso);\n return new Date(Date.UTC(year, month, day));\n}\n\nexport function formatDate(iso: ISODate, locale: string | undefined, options: Intl.DateTimeFormatOptions): string {\n return new Intl.DateTimeFormat(locale, { ...options, timeZone: \"UTC\" }).format(toDate(iso));\n}\n\n/**\n * Two dates as one range in the locale, sharing what they have in common: \"3 \u2013 9 Oct 2026\", \"28 Sept \u2013 4 Oct 2026\".\n * The same day twice is written once.\n */\nexport function formatDateRange(start: ISODate, end: ISODate, locale: string | undefined, options: Intl.DateTimeFormatOptions): string {\n const format = new Intl.DateTimeFormat(locale, { ...options, timeZone: \"UTC\" });\n if (typeof format.formatRangeToParts !== \"function\") {\n return start === end ? format.format(toDate(start)) : `${format.format(toDate(start))} \u2013 ${format.format(toDate(end))}`;\n }\n const parts = format.formatRangeToParts(toDate(start), toDate(end));\n // A bare en dash (\"3\u20139 Oct\") gets spaces, so a range reads as two dates; other locales' separators stay.\n return parts\n .map((part, index) => {\n const between = part.source === \"shared\" && parts[index - 1]?.source === \"startRange\" && parts[index + 1]?.source === \"endRange\";\n return between && part.value === \"\u2013\" ? \" \u2013 \" : part.value;\n })\n .join(\"\");\n}\n\n/** Keeps a date between min and max, when they're given. */\nexport function clampDate(date: ISODate, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n if (min && date < min) return min;\n if (max && date > max) return max;\n return date;\n}\n\n/** The first day of the month a date falls in. */\nexport function startOfMonth(iso: ISODate): ISODate {\n const { year, month } = parseISO(iso);\n return toISO(year, month, 1);\n}\n\n/** Months counted from year 0, so two months can be compared and subtracted. */\nexport function monthIndex(iso: ISODate): number {\n const { year, month } = parseISO(iso);\n return year * 12 + month;\n}\n\n/** The six weeks a month grid shows for the month starting on `first`, each starting on `weekStartsOn`. */\nexport function monthWeeks(first: ISODate, weekStartsOn: 0 | 1): ISODate[][] {\n const offset = (weekday(first) - weekStartsOn + 7) % 7;\n const gridStart = addDays(first, -offset);\n return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => addDays(gridStart, w * 7 + d)));\n}\n", "import { useEffect, useRef, useState, type ClipboardEvent, type ForwardedRef, type KeyboardEvent, type MouseEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/*\n * The engine DateField and TimeField share: a group of spinbutton segments that take typed digits, step with the\n * arrow keys and move between each other, with the separators between them. Each field works out its segments\n * (order, range, how a value is shown) and keeps the values; this draws them and turns keys into changes.\n */\n\nexport type SegmentType = \"day\" | \"month\" | \"year\" | \"hour\" | \"minute\" | \"second\" | \"dayPeriod\";\n\n/** Values by segment; a key set to undefined clears that segment. */\nexport type SegmentValues = { [Type in SegmentType]?: number | undefined };\n\nexport interface Segment {\n type: SegmentType;\n /** Read out as the segment's name: \"Day\", \"Hour\". */\n label: string;\n value: number | undefined;\n min: number;\n max: number;\n /** Shown while it's empty: \"dd\", \"\u2013\u2013\". */\n placeholder: string;\n /** The value as shown: \"07\", \"PM\". */\n format(value: number): string;\n /** The value as read out (aria-valuetext): \"10 \u2013 October\". */\n describe(value: number): string;\n /** Up or Down on an empty segment starts here, without stepping. */\n start: number;\n /** Up and Down move by this, landing on its multiples. */\n step?: number;\n /** PageUp and PageDown move by this. */\n page: number;\n /** Past the max goes round to the min. The year stops instead. */\n wrap: boolean;\n /** Typing only sets the value once it's whole or the segment loses focus, so a year of 2026 doesn't pass through 0002. */\n deferTyping?: boolean;\n /** Letters that set a value: a and p for AM and PM. */\n letters?: Record<string, number>;\n /** Kept this many digits wide, so the field doesn't change width as it fills. */\n width?: 2 | 4;\n}\n\nexport type Part = Segment | { type: \"literal\"; text: string };\n\nexport interface SegmentedFieldProps {\n parts: Part[];\n /** The field's whole value, for the hidden input. */\n value: string;\n onSegmentsChange(changes: SegmentValues): void;\n /** Reads pasted text in the field's own format, such as \"2026-10-13\"; null when it can't. */\n parsePaste?(text: string): SegmentValues | null;\n /** The locale's digits, 0 to 9. */\n digits: string[];\n forwardedRef: ForwardedRef<HTMLDivElement>;\n id?: string;\n name?: string;\n size: \"sm\" | \"md\";\n isInvalid: boolean;\n disabled: boolean;\n readOnly: boolean;\n startContent?: ReactNode;\n className?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n}\n\ninterface Typing {\n type: SegmentType;\n text: string;\n}\n\nconst escapeHTML = (text: string) => text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n\nexport function SegmentedField({\n parts,\n value,\n onSegmentsChange,\n parsePaste,\n digits,\n forwardedRef,\n id,\n name,\n size,\n isInvalid,\n disabled,\n readOnly,\n startContent,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n}: SegmentedFieldProps) {\n const segments = parts.filter((part): part is Segment => part.type !== \"literal\");\n const editable = !disabled && !readOnly;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const segmentRefs = useRef<Array<HTMLSpanElement | null>>([]);\n // What each segment should show, to put back if the browser edits it anyway (an IME composition can't be cancelled).\n const texts = useRef<string[]>([]);\n // Digits typed into the focused segment that may still grow (\"1\" in a month waits for a second digit). Kept in a\n // ref as well, because typing moves focus and the blur that follows runs before React renders.\n const [typing, setTypingState] = useState<Typing | null>(null);\n const typingRef = useRef<Typing | null>(null);\n const [labelId, setLabelId] = useState<string>();\n\n function setTyping(next: Typing | null) {\n typingRef.current = next;\n setTypingState(next);\n }\n\n function focusSegment(index: number) {\n segmentRefs.current[Math.max(0, Math.min(segments.length - 1, index))]?.focus();\n }\n\n function parseDigit(char: string): number | undefined {\n if (char >= \"0\" && char <= \"9\") return Number(char);\n const index = digits.indexOf(char);\n return index >= 0 ? index : undefined;\n }\n\n const fits = (segment: Segment, n: number) => n >= segment.min && n <= segment.max;\n\n /** Ends typing in the segment; a year typed so far is set now. Returns the segment's value after that. */\n function flush(segment?: Segment): number | undefined {\n const typed = typingRef.current;\n if (!typed || (segment && typed.type !== segment.type)) return segment?.value;\n setTyping(null);\n const owner = segments.find((candidate) => candidate.type === typed.type);\n if (!owner?.deferTyping) return owner?.value;\n const n = Number(typed.text);\n if (!fits(owner, n)) return owner.value;\n onSegmentsChange({ [owner.type]: n });\n return n;\n }\n\n /** Typing a digit: fills the segment and moves on once no further digit could fit. Returns the focused index. */\n function typeDigit(index: number, digit: number): number {\n const segment = segments[index]!;\n const typed = typingRef.current;\n let text = (typed?.type === segment.type ? typed.text : \"\") + digit;\n let n = Number(text);\n if (n > segment.max) {\n text = String(digit);\n n = digit;\n }\n const complete = n * 10 > segment.max || text.length >= String(segment.max).length;\n if (fits(segment, n) && (complete || !segment.deferTyping)) onSegmentsChange({ [segment.type]: n });\n if (!complete) {\n setTyping({ type: segment.type, text });\n return index;\n }\n setTyping(null);\n if (!fits(segment, n) || index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n /** A letter sets AM or PM, from any segment; from the AM/PM segment itself it then moves on. */\n function typeLetter(index: number, char: string): number {\n const letter = char.toLowerCase();\n const target = segments.findIndex((segment) => segment.letters?.[letter] !== undefined);\n if (target < 0) return index;\n flush();\n onSegmentsChange({ [segments[target]!.type]: segments[target]!.letters![letter] });\n if (target !== index || index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n /** A separator (/ . : or a space) ends a half-typed segment and moves on, so \"1/5/2026\" is the 1st of May, not the 15th. */\n function typeSeparator(index: number): number {\n if (typingRef.current?.type !== segments[index]!.type) return index;\n flush();\n if (index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n function insertText(index: number, text: string) {\n let current = index;\n for (const char of text) {\n const digit = parseDigit(char);\n if (digit !== undefined && !segments[current]!.letters) current = typeDigit(current, digit);\n else if (/[\\p{P}\\p{S}\\s]/u.test(char)) current = typeSeparator(current);\n else current = typeLetter(current, char);\n }\n }\n\n function step(index: number, key: string) {\n const segment = segments[index]!;\n const current = flush(segment);\n const unit = segment.step ?? 1;\n const top = segment.min + Math.floor((segment.max - segment.min) / unit) * unit;\n let next: number;\n if (key === \"Home\") next = segment.min;\n else if (key === \"End\") next = top;\n else if (current === undefined) next = segment.start;\n else if (key === \"PageUp\" || key === \"PageDown\") {\n const moved = current + (key === \"PageUp\" ? segment.page : -segment.page);\n const range = segment.max - segment.min + 1;\n next = segment.wrap ? segment.min + ((((moved - segment.min) % range) + range) % range) : Math.min(segment.max, Math.max(segment.min, moved));\n } else {\n // Snap to the step: with 15-minute steps, Up from 07 goes to 15 and Down to 00.\n const offset = current - segment.min;\n const moved = segment.min + (key === \"ArrowUp\" ? Math.floor(offset / unit) + 1 : Math.ceil(offset / unit) - 1) * unit;\n if (moved > segment.max) next = segment.wrap ? segment.min : segment.max;\n else if (moved < segment.min) next = segment.wrap ? top : segment.min;\n else next = moved;\n }\n onSegmentsChange({ [segment.type]: next });\n }\n\n /** Backspace or Delete empties the segment; Backspace on an empty one goes back to the one before. */\n function clear(index: number, moveBack: boolean) {\n const segment = segments[index]!;\n const wasTyping = typingRef.current?.type === segment.type;\n if (wasTyping) setTyping(null);\n if (segment.value !== undefined) onSegmentsChange({ [segment.type]: undefined });\n else if (!wasTyping && moveBack) focusSegment(index - 1);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLSpanElement>, index: number) {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n switch (event.key) {\n case \"ArrowLeft\":\n case \"ArrowRight\":\n event.preventDefault();\n flush();\n focusSegment(index + (event.key === \"ArrowRight\" ? 1 : -1));\n return;\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n event.preventDefault();\n if (editable) step(index, event.key);\n return;\n case \"Backspace\":\n case \"Delete\":\n event.preventDefault();\n if (editable) clear(index, event.key === \"Backspace\");\n return;\n }\n }\n\n const indexOf = (target: EventTarget | null) => {\n const element = target instanceof Element ? target.closest<HTMLElement>(\"[data-segment]\") : null;\n return element ? Number(element.dataset.segment) : undefined;\n };\n\n /** Reads digit groups in the segments' order, so \"13/10/2026\" pastes into dd/mm/yyyy, and a or p for AM/PM. */\n function readGroups(text: string): SegmentValues | null {\n const numeric = segments.filter((segment) => !segment.letters);\n const groups: number[] = [];\n let group = \"\";\n for (const char of `${text} `) {\n const digit = parseDigit(char);\n if (digit !== undefined) group += digit;\n else if (group) {\n groups.push(Number(group));\n group = \"\";\n }\n }\n if (groups.length !== numeric.length) return null;\n const changes: SegmentValues = {};\n for (const [i, segment] of numeric.entries()) {\n const n = groups[i]!;\n // The day's range depends on the month, which may be changing too: the field fits it afterwards.\n if (n < segment.min || n > (segment.type === \"day\" ? 31 : segment.max)) return null;\n changes[segment.type] = n;\n }\n const period = segments.find((segment) => segment.letters);\n const letter = period && [...text.toLowerCase()].find((char) => period.letters![char] !== undefined);\n if (period && letter) changes[period.type] = period.letters![letter];\n return changes;\n }\n\n function onPaste(event: ClipboardEvent<HTMLDivElement>) {\n event.preventDefault();\n if (!editable) return;\n const text = event.clipboardData.getData(\"text/plain\").trim();\n const changes = parsePaste?.(text) ?? readGroups(text);\n if (changes) {\n setTyping(null);\n onSegmentsChange(changes);\n return;\n }\n const index = indexOf(event.target);\n if (index !== undefined) insertText(index, text);\n }\n\n /** A click on the field but not on a segment (the padding, a separator, the icon) focuses the nearest segment. */\n function onMouseDown(event: MouseEvent<HTMLDivElement>) {\n if (disabled || event.button !== 0) return;\n const target = event.target as Element;\n if (target.closest(\"[data-segment], button, a, input, select, textarea\")) return;\n event.preventDefault();\n let nearest = 0;\n let distance = Infinity;\n segmentRefs.current.slice(0, segments.length).forEach((element, index) => {\n if (!element) return;\n const box = element.getBoundingClientRect();\n const gap = event.clientX < box.left ? box.left - event.clientX : Math.max(0, event.clientX - box.right);\n if (gap < distance) {\n distance = gap;\n nearest = index;\n }\n });\n focusSegment(nearest);\n }\n\n // The browser's editing events, read through a ref so the listeners can be added once.\n const handlers = useRef({ beforeInput: (_event: InputEvent) => {}, input: (_event: InputEvent) => {}, compositionEnd: (_event: CompositionEvent) => {} });\n const restore = (index: number) => {\n const element = segmentRefs.current[index];\n if (element && element.textContent !== texts.current[index]) element.textContent = texts.current[index] ?? \"\";\n };\n handlers.current = {\n // Segments are contentEditable so phones open their number pad; every edit is cancelled and done here instead.\n beforeInput(event) {\n const index = indexOf(event.target);\n if (event.inputType === \"insertCompositionText\" || index === undefined) return;\n event.preventDefault();\n if (!editable) return;\n if (event.inputType.startsWith(\"delete\")) clear(index, event.inputType === \"deleteContentBackward\");\n else if (event.data) insertText(index, event.data);\n },\n input(event) {\n const index = indexOf(event.target);\n if (index !== undefined && !event.isComposing) restore(index);\n },\n compositionEnd(event) {\n const index = indexOf(event.target);\n if (index === undefined) return;\n restore(index);\n if (editable && event.data) insertText(index, event.data);\n },\n };\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n const beforeInput = (event: Event) => handlers.current.beforeInput(event as InputEvent);\n const input = (event: Event) => handlers.current.input(event as InputEvent);\n const compositionEnd = (event: Event) => handlers.current.compositionEnd(event as CompositionEvent);\n root.addEventListener(\"beforeinput\", beforeInput);\n root.addEventListener(\"input\", input);\n root.addEventListener(\"compositionend\", compositionEnd);\n return () => {\n root.removeEventListener(\"beforeinput\", beforeInput);\n root.removeEventListener(\"input\", input);\n root.removeEventListener(\"compositionend\", compositionEnd);\n };\n }, []);\n\n // A label can't point at a group, so the one Field puts above (label[for=id]) is wired up here: it names the\n // group, and clicking it focuses the first segment.\n const focusFirst = useRef(() => {});\n focusFirst.current = () => {\n if (!disabled) focusSegment(0);\n };\n useEffect(() => {\n const root = rootRef.current;\n if (!root || !id) return;\n const scope = root.getRootNode() as Document | ShadowRoot;\n const labels = Array.from(scope.querySelectorAll<HTMLLabelElement>(`label[for=\"${CSS.escape(id)}\"]`));\n const label = labels[0];\n if (!label) {\n setLabelId(undefined);\n return;\n }\n if (!label.id) label.id = `${id}-label`;\n setLabelId(label.id);\n const onClick = () => focusFirst.current();\n labels.forEach((element) => element.addEventListener(\"click\", onClick));\n return () => labels.forEach((element) => element.removeEventListener(\"click\", onClick));\n }, [id]);\n\n let segmentIndex = -1;\n\n return (\n <div\n ref={(element) => {\n rootRef.current = element;\n if (typeof forwardedRef === \"function\") forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n }}\n id={id}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={[...new Set([ariaLabelledBy, labelId].filter(Boolean))].join(\" \") || undefined}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-date-field\",\n size === \"sm\" && \"ow-date-field--sm\",\n startContent !== undefined && \"ow-date-field--with-start\",\n isInvalid && \"ow-date-field--invalid\",\n disabled && \"ow-date-field--disabled\",\n readOnly && \"ow-date-field--readonly\",\n className,\n )}\n onMouseDown={onMouseDown}\n onPaste={onPaste}\n >\n {startContent !== undefined ? <span className=\"ow-date-field__addon\">{startContent}</span> : null}\n <span className=\"ow-date-field__segments\">\n {parts.map((part, partIndex) => {\n if (part.type === \"literal\") {\n return (\n <span key={`literal-${partIndex}`} className=\"ow-date-field__literal\" aria-hidden=\"true\">\n {part.text}\n </span>\n );\n }\n segmentIndex += 1;\n const index = segmentIndex;\n const typed = typing?.type === part.type ? typing.text : null;\n const current = typed !== null && part.deferTyping ? Number(typed) : part.value;\n const isPlaceholder = typed === null && part.value === undefined;\n const text =\n typed !== null\n ? [...typed].map((digit) => digits[Number(digit)]).join(\"\")\n : part.value !== undefined\n ? part.format(part.value)\n : part.placeholder;\n texts.current[index] = text;\n return (\n <span\n key={part.type}\n ref={(element) => {\n segmentRefs.current[index] = element;\n }}\n role=\"spinbutton\"\n data-segment={index}\n className={cx(\n \"ow-date-field__segment\",\n part.width && `ow-date-field__segment--digits-${part.width}`,\n isPlaceholder && \"ow-date-field__segment--placeholder\",\n )}\n tabIndex={disabled ? undefined : 0}\n contentEditable={editable || undefined}\n suppressContentEditableWarning\n inputMode={part.letters ? \"text\" : \"numeric\"}\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n enterKeyHint={index < segments.length - 1 ? \"next\" : \"done\"}\n aria-label={part.label}\n aria-valuenow={current}\n aria-valuemin={part.min}\n aria-valuemax={part.max}\n aria-valuetext={current === undefined ? \"Empty\" : part.describe(current)}\n aria-invalid={isInvalid || undefined}\n aria-readonly={readOnly || undefined}\n aria-disabled={disabled || undefined}\n aria-describedby={ariaDescribedBy}\n dangerouslySetInnerHTML={{ __html: escapeHTML(text) }}\n onKeyDown={(event) => onKeyDown(event, index)}\n onBlur={() => flush()}\n />\n );\n })}\n </span>\n {name !== undefined ? <input type=\"hidden\" name={name} value={value} disabled={disabled} /> : null}\n </div>\n );\n}\n\n/** The locale's digits, 0 to 9, so typed and shown numbers follow its numbering system. */\nexport function localeDigits(locale: string | undefined): string[] {\n const format = new Intl.NumberFormat(locale, { useGrouping: false });\n return Array.from({ length: 10 }, (_, digit) => format.format(digit));\n}\n", "import { forwardRef, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { localeDigits, SegmentedField, type Part, type Segment, type SegmentValues } from \"./SegmentedField\";\n\nexport interface TimeFieldProps {\n /** The time on a 24-hour clock, \"HH:MM\", or \"HH:MM:SS\" when granularity is \"second\"; \"\" while any part is empty. */\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n /** Called with \"HH:MM\" (or \"HH:MM:SS\") when the time is complete and whenever it changes after that, and with \"\" when a part is cleared. */\n onChange?(value: string): void;\n /** 12 shows hours 1\u201312 and an AM/PM segment; 24 shows 00\u201323. Defaults to the locale's clock. */\n hourCycle?: 12 | 24;\n /** \"second\" adds a seconds segment.\n * @default \"minute\" */\n granularity?: \"minute\" | \"second\";\n /** Up and Down move the minutes by this much, landing on its multiples: 5, 15. Typed minutes can still be anything.\n * @default 1 */\n minuteStep?: number;\n /** The earliest valid time, \"HH:MM\". An earlier one shows the field as invalid. */\n min?: string;\n /** The latest valid time, \"HH:MM\". A later one shows the field as invalid. */\n max?: string;\n /** The separators, the AM/PM words and where they go follow this locale. Defaults to the browser's. */\n locale?: string;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid. A time outside\n * min and max does this by itself.\n * @default false */\n isInvalid?: boolean;\n /** @default false */\n disabled?: boolean;\n /** The time can be focused and read but not changed.\n * @default false */\n readOnly?: boolean;\n /** The form field name: a hidden input carries the \"HH:MM\" value. */\n name?: string;\n /** Inside the field, before the time: a 16px clock icon. */\n startContent?: ReactNode;\n /** Goes on the group. Field sets it, and its label then names the group and focuses the first segment when clicked. */\n id?: string;\n /** Names the time for screen readers when there's no visible label. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** Field points it at its hint and error; each segment is described by them. */\n \"aria-describedby\"?: string;\n className?: string;\n}\n\ntype TimeParts = { hour?: number | undefined; minute?: number | undefined; second?: number | undefined; dayPeriod?: number | undefined };\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\n/** \"09:30\" or \"09:30:15\" as seconds since midnight, or undefined when it isn't a time. */\nfunction toSeconds(time: string | undefined): number | undefined {\n const match = time ? /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/.exec(time) : null;\n if (!match) return undefined;\n const [hour, minute, second] = [Number(match[1]), Number(match[2]), Number(match[3] ?? 0)];\n return hour < 24 && minute < 60 && second < 60 ? hour * 3600 + minute * 60 + second : undefined;\n}\n\n/** Splits seconds since midnight into the segments as shown: on a 12-hour clock, 1\u201312 and AM (0) or PM (1). */\nfunction split(total: number, twelve: boolean, seconds: boolean): TimeParts {\n const hour = Math.floor(total / 3600);\n const parts: TimeParts = { hour, minute: Math.floor((total % 3600) / 60), second: seconds ? total % 60 : undefined };\n return twelve ? { ...parts, hour: hour % 12 || 12, dayPeriod: hour >= 12 ? 1 : 0 } : parts;\n}\n\nfunction toTime({ hour, minute, second, dayPeriod }: TimeParts, twelve: boolean, seconds: boolean): string {\n if (hour === undefined || minute === undefined || (seconds && second === undefined) || (twelve && dayPeriod === undefined)) return \"\";\n const hour24 = twelve ? (hour % 12) + (dayPeriod ? 12 : 0) : hour;\n return `${pad(hour24)}:${pad(minute)}${seconds ? `:${pad(second!)}` : \"\"}`;\n}\n\nfunction fromTime(time: string, twelve: boolean, seconds: boolean): TimeParts {\n const total = toSeconds(time);\n return total === undefined ? {} : split(total, twelve, seconds);\n}\n\nfunction localeHourCycle(locale: string | undefined): 12 | 24 {\n const options = new Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions();\n if (options.hourCycle) return options.hourCycle === \"h11\" || options.hourCycle === \"h12\" ? 12 : 24;\n return options.hour12 ? 12 : 24;\n}\n\ntype TimeLayout = Array<{ type: \"hour\" | \"minute\" | \"second\" | \"dayPeriod\" } | { type: \"literal\"; text: string }>;\n\n/** The order of the segments, the separators and the AM/PM words, from the locale's time format. */\nfunction timeLayout(locale: string | undefined, twelve: boolean, seconds: boolean) {\n const format = new Intl.DateTimeFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: seconds ? \"2-digit\" : undefined,\n hourCycle: twelve ? \"h12\" : \"h23\",\n timeZone: \"UTC\",\n });\n const periodOf = (hour: number) => format.formatToParts(new Date(Date.UTC(2026, 0, 1, hour))).find((part) => part.type === \"dayPeriod\")?.value;\n const layout: TimeLayout = [];\n for (const part of format.formatToParts(new Date(Date.UTC(2026, 0, 1, 13, 45, 30)))) {\n if (part.type === \"hour\" || part.type === \"minute\" || part.type === \"second\" || (part.type === \"dayPeriod\" && twelve)) layout.push({ type: part.type });\n else if (part.type === \"literal\") layout.push({ type: \"literal\", text: part.value });\n }\n // Some locales put no AM/PM in a 12-hour time; add it at the end so the time can still be told apart.\n if (twelve && !layout.some((part) => part.type === \"dayPeriod\")) layout.push({ type: \"literal\", text: \" \" }, { type: \"dayPeriod\" });\n return { layout, am: periodOf(1) ?? \"AM\", pm: periodOf(13) ?? \"PM\" };\n}\n\n/**\n * A time typed into hour, minute and optional second segments, with AM/PM on a 12-hour clock. It works like\n * DateField: digits fill a segment and move on, the arrow keys step it, and the value is always on a 24-hour clock.\n */\nexport const TimeField = /* @__PURE__ */ forwardRef<HTMLDivElement, TimeFieldProps>(function TimeField(\n {\n value,\n defaultValue = \"\",\n onChange,\n hourCycle,\n granularity = \"minute\",\n minuteStep = 1,\n min,\n max,\n locale,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n readOnly = false,\n name,\n startContent,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n },\n ref,\n) {\n const [current, setCurrent] = useControllableState(value, defaultValue, onChange);\n const localeCycle = useMemo(() => localeHourCycle(locale), [locale]);\n const twelve = (hourCycle ?? localeCycle) === 12;\n const seconds = granularity === \"second\";\n const [parts, setParts] = useState<TimeParts>(() => fromTime(current, twelve, seconds));\n const partsRef = useRef(parts);\n partsRef.current = parts;\n // The segments can hold a time that isn't complete yet; they're set again from the value when it changes from\n // outside, or when the clock or granularity changes what they show.\n const shape = `${current}|${twelve}|${seconds}`;\n const [synced, setSynced] = useState(shape);\n if (shape !== synced) {\n setSynced(shape);\n if (current !== toTime(parts, twelve, seconds) || !synced.endsWith(`|${twelve}|${seconds}`)) setParts(fromTime(current, twelve, seconds));\n }\n\n function update(changes: SegmentValues) {\n const next = { ...partsRef.current, ...changes };\n // An hour typed on a 12-hour clock is AM, as the placeholder shows, until A or P says otherwise.\n if (twelve && changes.hour !== undefined && next.dayPeriod === undefined) next.dayPeriod = 0;\n partsRef.current = next;\n setParts(next);\n setCurrent(toTime(next, twelve, seconds));\n }\n\n const formats = useMemo(() => {\n const one = new Intl.NumberFormat(locale, { useGrouping: false });\n const two = new Intl.NumberFormat(locale, { minimumIntegerDigits: 2, useGrouping: false });\n return { one, two, digits: localeDigits(locale), ...timeLayout(locale, twelve, seconds) };\n }, [locale, twelve, seconds]);\n\n // Up or Down on an empty segment starts from the current hour, or the nearest time min and max allow.\n const now = new Date();\n let reference = now.getHours() * 3600;\n const minSeconds = toSeconds(min);\n const maxSeconds = toSeconds(max);\n if (minSeconds !== undefined && reference < minSeconds) reference = minSeconds;\n if (maxSeconds !== undefined && reference > maxSeconds) reference = maxSeconds;\n const start = split(reference, twelve, true);\n const step = Math.max(1, Math.min(30, Math.round(minuteStep)));\n\n const letters: Record<string, number> = { a: 0, p: 1 };\n const amLetter = formats.am.charAt(0).toLowerCase();\n const pmLetter = formats.pm.charAt(0).toLowerCase();\n if (amLetter !== pmLetter) Object.assign(letters, { [amLetter]: 0, [pmLetter]: 1 });\n\n const segments: Record<\"hour\" | \"minute\" | \"second\" | \"dayPeriod\", Segment> = {\n hour: {\n type: \"hour\",\n label: \"Hour\",\n value: parts.hour,\n min: twelve ? 1 : 0,\n max: twelve ? 12 : 23,\n placeholder: \"\u2013\u2013\",\n // 9:05 AM on a 12-hour clock, 09:05 on a 24-hour one.\n format: (n) => (twelve ? formats.one : formats.two).format(n),\n describe: String,\n start: start.hour ?? 0,\n page: 2,\n wrap: true,\n width: twelve ? undefined : 2,\n },\n minute: {\n type: \"minute\",\n label: \"Minute\",\n value: parts.minute,\n min: 0,\n max: 59,\n placeholder: \"\u2013\u2013\",\n format: (n) => formats.two.format(n),\n describe: (n) => formats.two.format(n),\n start: Math.floor((start.minute ?? 0) / step) * step,\n step,\n page: Math.max(15, step),\n wrap: true,\n width: 2,\n },\n second: {\n type: \"second\",\n label: \"Second\",\n value: parts.second,\n min: 0,\n max: 59,\n placeholder: \"\u2013\u2013\",\n format: (n) => formats.two.format(n),\n describe: (n) => formats.two.format(n),\n start: start.second ?? 0,\n page: 15,\n wrap: true,\n width: 2,\n },\n dayPeriod: {\n type: \"dayPeriod\",\n label: \"AM/PM\",\n value: parts.dayPeriod,\n min: 0,\n max: 1,\n placeholder: formats.am,\n format: (n) => (n ? formats.pm : formats.am),\n describe: (n) => (n ? formats.pm : formats.am),\n start: start.dayPeriod ?? 0,\n page: 1,\n wrap: true,\n letters,\n },\n };\n const layout: Part[] = formats.layout.map((part) => (part.type === \"literal\" ? part : segments[part.type]));\n\n const total = toSeconds(current);\n const outOfRange = total !== undefined && ((minSeconds !== undefined && total < minSeconds) || (maxSeconds !== undefined && total > maxSeconds));\n\n return (\n <SegmentedField\n parts={layout}\n value={current}\n onSegmentsChange={update}\n // \"14:30\" pastes as a 24-hour time even on a 12-hour clock; \"2:30 pm\" is read in the segments' order.\n parsePaste={(text) => (/^\\d{1,2}:\\d{2}(:\\d{2})?$/.test(text) && toSeconds(text) !== undefined ? fromTime(text, twelve, seconds) : null)}\n digits={formats.digits}\n forwardedRef={ref}\n id={id}\n name={name}\n size={size}\n isInvalid={isInvalid || outOfRange}\n disabled={disabled}\n readOnly={readOnly}\n startContent={startContent}\n className={className}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n />\n );\n});\n", "import {\n forwardRef,\n useLayoutEffect,\n useRef,\n type ChangeEvent,\n type CSSProperties,\n type ForwardedRef,\n type TextareaHTMLAttributes,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { resizeTextArea } from \"../../utils/resizeTextArea\";\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Grows with its text, up to `autoGrowMaxHeight`, then scrolls. */\n autoGrow?: boolean;\n /** The tallest an auto-growing box gets. A number is pixels. Default 180. */\n autoGrowMaxHeight?: number | string;\n /** Borderless and transparent, for use inside your own field container (a chat composer). */\n bare?: boolean;\n isInvalid?: boolean;\n}\n\nconst defaultAutoGrowMaxHeight = 180;\n\nfunction assignRef(ref: ForwardedRef<HTMLTextAreaElement>, element: HTMLTextAreaElement | null) {\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n}\n\n/** A multi-line text field, 72px tall at least; it can grow with its text. */\nexport const Textarea = /* @__PURE__ */ forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n autoGrow = false,\n autoGrowMaxHeight = defaultAutoGrowMaxHeight,\n bare = false,\n className,\n isInvalid = false,\n onChange,\n style,\n value,\n ...textareaProps\n },\n ref,\n) {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useLayoutEffect(() => {\n if (autoGrow && textAreaRef.current) resizeTextArea(textAreaRef.current);\n }, [autoGrow, autoGrowMaxHeight, value]);\n\n function setTextAreaRef(element: HTMLTextAreaElement | null) {\n textAreaRef.current = element;\n assignRef(ref, element);\n if (autoGrow && element) resizeTextArea(element);\n }\n\n function handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n // A controlled box is resized once its new value renders (the layout effect above).\n if (autoGrow && value === undefined) resizeTextArea(event.currentTarget);\n onChange?.(event);\n }\n\n const textareaStyle: CSSProperties | undefined = autoGrow\n ? {\n ...style,\n maxHeight: typeof autoGrowMaxHeight === \"number\" ? `${autoGrowMaxHeight}px` : autoGrowMaxHeight,\n }\n : style;\n\n return (\n <textarea\n {...textareaProps}\n ref={setTextAreaRef}\n className={cx(\n \"ow-textarea\",\n bare && \"ow-textarea--bare\",\n isInvalid && !bare && \"ow-textarea--invalid\",\n autoGrow && \"ow-textarea--auto-grow\",\n className,\n )}\n aria-invalid={isInvalid || undefined}\n style={textareaStyle}\n value={value}\n onChange={handleChange}\n />\n );\n});\n", "/** Text longer than this can't fit under any auto-grow cap, however wide the box. */\nconst surelyOverflowingLength = 20_000;\n\n/**\n * Whether the text needs more lines than fit under maxHeight even before wrapping. Counting line breaks is cheap;\n * measuring (scrollHeight) lays out all of the text, which takes tens of milliseconds per keystroke for a long draft.\n */\nfunction surelyOverflows(textArea: HTMLTextAreaElement, maxHeight: number): boolean {\n const text = textArea.value;\n if (text.length > surelyOverflowingLength) return true;\n const style = window.getComputedStyle(textArea);\n const lineHeight = Number.parseFloat(style.lineHeight) || Number.parseFloat(style.fontSize) * 1.2;\n if (!lineHeight) return false;\n const needed = Math.ceil(maxHeight / lineHeight) + 1;\n let lines = 1;\n for (let index = text.indexOf(\"\\n\"); index !== -1 && lines < needed; index = text.indexOf(\"\\n\", index + 1))\n lines += 1;\n return lines >= needed;\n}\n\n/** Grows a textarea to fit its text, up to its CSS max-height, then scrolls. */\nexport function resizeTextArea(textArea: HTMLTextAreaElement): void {\n const maxHeight = Number.parseFloat(window.getComputedStyle(textArea).maxHeight);\n // Already past the cap: it stays at the cap and scrolls, with nothing to measure.\n if (Number.isFinite(maxHeight) && surelyOverflows(textArea, maxHeight)) {\n textArea.style.height = `${maxHeight.toString()}px`;\n textArea.style.overflowY = \"auto\";\n return;\n }\n\n textArea.style.height = \"auto\";\n\n const shouldScroll = Number.isFinite(maxHeight) && textArea.scrollHeight > maxHeight;\n\n textArea.style.height = `${textArea.scrollHeight}px`;\n textArea.style.overflowY = shouldScroll ? \"auto\" : \"hidden\";\n}\n", "import { useCallback, useEffect, useId, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { CheckIcon, ChevronDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface SelectOption {\n value: string;\n label: ReactNode;\n /** Plain text for type-to-find and the trigger's tooltip, when `label` isn't a string. */\n textValue?: string;\n /** A muted line under the label. */\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface SelectGroup {\n label: string;\n options: SelectOption[];\n}\n\nexport type SelectItem = SelectOption | SelectGroup;\n\nexport interface SelectProps {\n value: string;\n options: SelectItem[];\n onChange(value: string): void;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n disabled?: boolean;\n /** Shown when no option matches `value`. Default \"Select\u2026\". */\n placeholder?: string;\n size?: \"sm\" | \"md\";\n isInvalid?: boolean;\n /** Classes for the trigger, e.g. a width. */\n className?: string;\n /** Classes for the trigger's and options' text, e.g. a monospace class. */\n valueClassName?: string;\n}\n\nconst menuGap = 4;\nconst menuMaxHeight = 288;\nconst typeaheadResetMs = 600;\n\nfunction isGroup(item: SelectItem): item is SelectGroup {\n return \"options\" in item;\n}\n\nfunction textOf(option: SelectOption): string {\n return option.textValue ?? (typeof option.label === \"string\" ? option.label : option.value);\n}\n\n/**\n * A dropdown: a button that opens a listbox of options, in place of a native <select>.\n * It works with the keyboard like a select (arrows, Home/End, type to find, Enter/Space to pick,\n * Escape/Tab to close), keeps focus on the trigger, and its menu sits in the top layer so it\n * isn't clipped by dialogs or scroll areas.\n */\nexport function Select({\n value,\n options,\n onChange,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n disabled = false,\n placeholder = \"Select\u2026\",\n size = \"md\",\n isInvalid = false,\n className,\n valueClassName,\n}: SelectProps) {\n const listboxId = useId();\n const optionIdPrefix = useId();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const typeahead = useRef({ text: \"\", timer: 0 });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n\n const flat = useMemo(() => options.flatMap((item) => (isGroup(item) ? item.options : [item])), [options]);\n const selectedIndex = flat.findIndex((option) => option.value === value);\n const selected = flat[selectedIndex];\n const optionId = (index: number) => `${optionIdPrefix}-${index}`;\n\n const enabledFrom = useCallback(\n (start: number, step: 1 | -1): number => {\n for (let index = start; index >= 0 && index < flat.length; index += step) {\n if (!flat[index]!.disabled) return index;\n }\n return -1;\n },\n [flat],\n );\n\n const { mounted, state } = usePresence(isOpen);\n const floatingStyle = useFloating({\n open: mounted,\n anchorRef: triggerRef,\n floatingRef: menuRef,\n offset: menuGap,\n matchWidth: true,\n maxHeight: menuMaxHeight,\n });\n\n function open(startAt?: \"first\" | \"last\") {\n if (disabled || isOpen) return;\n setActiveIndex(\n startAt === \"first\"\n ? enabledFrom(0, 1)\n : startAt === \"last\"\n ? enabledFrom(flat.length - 1, -1)\n : selectedIndex >= 0 && !flat[selectedIndex]!.disabled\n ? selectedIndex\n : enabledFrom(0, 1),\n );\n setIsOpen(true);\n }\n\n function close() {\n setIsOpen(false);\n }\n\n function choose(index: number) {\n const option = flat[index];\n if (!option || option.disabled) return;\n close();\n triggerRef.current?.focus();\n if (option.value !== value) onChange(option.value);\n }\n\n // Keep the active option in view while moving with the keyboard.\n useEffect(() => {\n if (!isOpen || activeIndex < 0) return;\n document.getElementById(optionId(activeIndex))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable for this component.\n }, [isOpen, activeIndex]);\n\n // Close on a click elsewhere. (useFloating follows the trigger when the page scrolls or resizes.)\n useEffect(() => {\n if (!isOpen) return;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (!menuRef.current?.contains(target) && !triggerRef.current?.contains(target)) close();\n };\n document.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => document.removeEventListener(\"pointerdown\", onPointerDown, true);\n }, [isOpen]);\n\n useEffect(() => {\n if (disabled) setIsOpen(false);\n }, [disabled]);\n\n useEffect(() => () => window.clearTimeout(typeahead.current.timer), []);\n\n function findByTyping(key: string) {\n const state = typeahead.current;\n window.clearTimeout(state.timer);\n state.text += key.toLowerCase();\n state.timer = window.setTimeout(() => {\n state.text = \"\";\n }, typeaheadResetMs);\n const from = isOpen ? activeIndex : selectedIndex;\n // A repeated single letter cycles through the matches.\n const repeated = state.text.length > 1 && [...state.text].every((letter) => letter === state.text[0]);\n const search = repeated ? state.text[0]! : state.text;\n const start = repeated || state.text.length === 1 ? from + 1 : from;\n for (let offset = 0; offset < flat.length; offset += 1) {\n const index = (Math.max(start, 0) + offset) % flat.length;\n const option = flat[index]!;\n if (!option.disabled && textOf(option).toLowerCase().startsWith(search)) {\n if (isOpen) setActiveIndex(index);\n else if (option.value !== value) onChange(option.value);\n return;\n }\n }\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n if (disabled) return;\n const { key } = event;\n\n if (!isOpen) {\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Enter\" || key === \" \") {\n event.preventDefault();\n open(key === \"ArrowUp\" && selectedIndex < 0 ? \"last\" : undefined);\n } else if (key.length === 1 && !event.metaKey && !event.ctrlKey) {\n findByTyping(key);\n }\n return;\n }\n\n switch (key) {\n case \"ArrowDown\": {\n event.preventDefault();\n const next = enabledFrom(activeIndex + 1, 1);\n if (next >= 0) setActiveIndex(next);\n return;\n }\n case \"ArrowUp\": {\n event.preventDefault();\n const previous = enabledFrom(activeIndex - 1, -1);\n if (previous >= 0) setActiveIndex(previous);\n return;\n }\n case \"Home\":\n case \"PageUp\":\n event.preventDefault();\n setActiveIndex(enabledFrom(0, 1));\n return;\n case \"End\":\n case \"PageDown\":\n event.preventDefault();\n setActiveIndex(enabledFrom(flat.length - 1, -1));\n return;\n case \"Enter\":\n event.preventDefault();\n choose(activeIndex);\n return;\n case \" \":\n event.preventDefault();\n if (typeahead.current.text) findByTyping(\" \");\n else choose(activeIndex);\n return;\n case \"Escape\":\n // Close the menu, not the dialog around it.\n event.preventDefault();\n event.stopPropagation();\n close();\n return;\n case \"Tab\":\n close();\n return;\n default:\n if (key.length === 1 && !event.metaKey && !event.ctrlKey) findByTyping(key);\n }\n }\n\n let flatIndex = -1;\n\n const renderOption = (option: SelectOption) => {\n flatIndex += 1;\n const index = flatIndex;\n const isSelected = index === selectedIndex;\n const isActive = index === activeIndex;\n return (\n <div\n key={`${option.value}-${index}`}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": isActive && !option.disabled,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerMove={() => {\n if (!option.disabled && activeIndex !== index) setActiveIndex(index);\n }}\n // Keep focus on the trigger.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => choose(index)}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n <span className=\"ow-option__text\">\n <span className={cx(\"ow-option__label\", valueClassName)}>{option.label}</span>\n {option.description ? <span className=\"ow-option__description\">{option.description}</span> : null}\n </span>\n </div>\n );\n };\n\n return (\n <>\n <button\n ref={triggerRef}\n id={id}\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listboxId : undefined}\n aria-activedescendant={isOpen && activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n title={selected ? textOf(selected) : undefined}\n className={cx(\"ow-select\", `ow-select--${size}`, { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen }, className)}\n onClick={() => (isOpen ? close() : open())}\n onKeyDown={onKeyDown}\n onBlur={(event) => {\n if (!menuRef.current?.contains(event.relatedTarget as Node)) close();\n }}\n >\n <span className={cx(\"ow-select__value\", !selected && \"ow-select__value--placeholder\", valueClassName)}>\n {selected ? selected.label : placeholder}\n </span>\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className=\"ow-select__chevron\" />\n </button>\n {mounted ? (\n <div\n ref={menuRef}\n {...manualPopover}\n data-state={state}\n id={listboxId}\n role=\"listbox\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabIndex={-1}\n className={cx(\"ow-listbox\", \"ow-floating\", `ow-listbox--${size}`)}\n style={floatingStyle}\n >\n {options.map((item, groupIndex) =>\n isGroup(item) ? (\n <div key={`group-${item.label}-${groupIndex}`} role=\"group\" aria-label={item.label} className=\"ow-listbox__group\">\n <div className=\"ow-listbox__group-label\" aria-hidden=\"true\">\n {item.label}\n </div>\n {item.options.map(renderOption)}\n </div>\n ) : (\n renderOption(item)\n ),\n )}\n {flat.length === 0 ? <div className=\"ow-listbox__empty\">No options</div> : null}\n </div>\n ) : null}\n </>\n );\n}\n", "import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { CheckIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport type { SelectOption } from \"@/components/Select/Select\";\nimport type { ListBoxGroup, ListBoxItem, ListBoxModeProps, ListBoxOption, ListBoxProps, ListBoxSelectionMode } from \"./ListBox.types\";\nexport type { ListBoxGroup, ListBoxItem, ListBoxModeProps, ListBoxOption, ListBoxProps, ListBoxSelectionMode } from \"./ListBox.types\";\n\nconst typeaheadResetMs = 600;\n\nfunction isGroup(item: ListBoxItem): item is ListBoxGroup {\n return \"options\" in item;\n}\n\nfunction textOf(option: ListBoxOption): string {\n return option.textValue ?? (typeof option.label === \"string\" ? option.label : option.value);\n}\n\nfunction sameValues(a: Set<string>, b: Set<string>) {\n return a.size === b.size && [...a].every((value) => b.has(value));\n}\n\n/**\n * Select's list of options, standing on the page in a bordered surface: a choice in a settings panel, a picker beside\n * other content. One option or any number; arrows, Home/End and type-to-find move, Space or Enter selects, and in\n * multiple mode Shift extends the selection and Ctrl/\u2318+A selects everything.\n */\nfunction ListBoxWithRef<Mode extends ListBoxSelectionMode = \"single\">(\n {\n options,\n selectionMode,\n value,\n defaultValue,\n onChange,\n disallowEmptySelection = false,\n emptyMessage = \"No options\",\n maxHeight,\n size = \"md\",\n isInvalid = false,\n isReadOnly = false,\n disabled = false,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n }: ListBoxModeProps<Mode>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const multiple = selectionMode === \"multiple\";\n const [current, setCurrent] = useControllableState<string | string[]>(\n value as string | string[] | undefined,\n (defaultValue as string | string[] | undefined) ?? (multiple ? [] : \"\"),\n onChange as ((next: string | string[]) => void) | undefined,\n );\n const listRef = useRef<HTMLDivElement | null>(null);\n const optionIdPrefix = useId();\n const emptyId = useId();\n const optionId = (index: number) => `${optionIdPrefix}-${index}`;\n const typeahead = useRef({ text: \"\", timer: 0 });\n // Where a Shift selection grows from, and what was selected before it started.\n const anchor = useRef<{ index: number; base: Set<string> } | null>(null);\n const pointerDown = useRef(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const [focus, setFocus] = useState<\"none\" | \"pointer\" | \"keyboard\">(\"none\");\n const [fieldLabelId, setFieldLabelId] = useState<string>();\n\n const flat = useMemo(() => options.flatMap((item) => (isGroup(item) ? item.options : [item])), [options]);\n const selected = useMemo(() => new Set(Array.isArray(current) ? current : current ? [current] : []), [current]);\n const canSelect = !disabled && !isReadOnly;\n\n function enabledFrom(start: number, step: 1 | -1): number {\n for (let index = start; index >= 0 && index < flat.length; index += step) {\n if (!flat[index]!.disabled) return index;\n }\n return -1;\n }\n\n // Until something is highlighted, focus lands on the first selected option, or else the first option.\n const active = useMemo(() => {\n if (activeIndex >= 0 && activeIndex < flat.length && !flat[activeIndex]!.disabled) return activeIndex;\n const firstSelected = flat.findIndex((option) => !option.disabled && selected.has(option.value));\n return firstSelected >= 0 ? firstSelected : flat.findIndex((option) => !option.disabled);\n }, [activeIndex, flat, selected]);\n\n const setRefs = useCallback(\n (element: HTMLDivElement | null) => {\n listRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n [ref],\n );\n\n // Field labels its control with <label for>, which only names native form controls, so name the list by the label's\n // id instead, and let a click on the label focus the list as it would an input.\n useEffect(() => {\n const list = listRef.current;\n if (!id || ariaLabel || ariaLabelledBy || !list) return;\n const root = list.getRootNode() as Document | ShadowRoot;\n const label = [...(root.querySelectorAll?.(\"label\") ?? [])].find((element) => element.htmlFor === id);\n if (!label) return;\n if (!label.id) label.id = `${id}-label`;\n setFieldLabelId(label.id);\n const focusList = () => listRef.current?.focus();\n label.addEventListener(\"click\", focusList);\n return () => label.removeEventListener(\"click\", focusList);\n }, [id, ariaLabel, ariaLabelledBy]);\n\n // Keep the highlighted option in view while moving with the keyboard (not on a click, which would scroll under the pointer).\n useEffect(() => {\n if (focus !== \"keyboard\" || active < 0) return;\n document.getElementById(optionId(active))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable for this component.\n }, [focus, active]);\n\n useEffect(() => () => window.clearTimeout(typeahead.current.timer), []);\n\n function commit(next: Set<string>) {\n if (!canSelect || sameValues(next, selected) || (disallowEmptySelection && next.size === 0)) return;\n if (!multiple) {\n setCurrent([...next][0] ?? \"\");\n return;\n }\n // Report values in the options' order, keeping any the options don't list.\n const listed = new Set(flat.map((option) => option.value));\n setCurrent([\n ...new Set([...flat.filter((option) => next.has(option.value)).map((option) => option.value), ...[...next].filter((v) => !listed.has(v))]),\n ]);\n }\n\n function toggle(index: number) {\n const option = flat[index];\n if (!option || option.disabled) return;\n const isSelected = selected.has(option.value);\n if (!multiple) {\n commit(new Set(isSelected ? [] : [option.value]));\n return;\n }\n const next = new Set(selected);\n if (isSelected) next.delete(option.value);\n else next.add(option.value);\n commit(next);\n anchor.current = { index, base: next };\n }\n\n /** Selects from the anchor to `index`, on top of what was selected before the anchor was set. */\n function extendTo(index: number, anchorIfNone: number) {\n if (!anchor.current) anchor.current = { index: anchorIfNone, base: new Set(selected) };\n const { index: from, base } = anchor.current;\n const next = new Set(base);\n for (let i = Math.min(from, index); i <= Math.max(from, index); i += 1) {\n const option = flat[i];\n if (option && !option.disabled) next.add(option.value);\n }\n commit(next);\n }\n\n function toggleAll() {\n const enabled = flat.filter((option) => !option.disabled).map((option) => option.value);\n const next = new Set(selected);\n const allSelected = enabled.every((v) => selected.has(v));\n for (const v of enabled) {\n if (allSelected) next.delete(v);\n else next.add(v);\n }\n commit(next);\n anchor.current = null;\n }\n\n function findByTyping(key: string) {\n const state = typeahead.current;\n window.clearTimeout(state.timer);\n state.text += key.toLowerCase();\n state.timer = window.setTimeout(() => {\n state.text = \"\";\n }, typeaheadResetMs);\n // A repeated single letter cycles through the matches.\n const repeated = state.text.length > 1 && [...state.text].every((letter) => letter === state.text[0]);\n const search = repeated ? state.text[0]! : state.text;\n const start = repeated || state.text.length === 1 ? active + 1 : active;\n for (let offset = 0; offset < flat.length; offset += 1) {\n const index = (Math.max(start, 0) + offset) % flat.length;\n const option = flat[index]!;\n if (!option.disabled && textOf(option).toLowerCase().startsWith(search)) {\n setActiveIndex(index);\n return;\n }\n }\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n if (disabled || event.altKey) return;\n const { key, shiftKey } = event;\n const extending = multiple && shiftKey && canSelect;\n const modifier = event.metaKey || event.ctrlKey;\n let target = -1;\n let anchorIfNone = -1;\n\n switch (key) {\n case \"ArrowDown\":\n target = enabledFrom(active + 1, 1);\n anchorIfNone = target;\n break;\n case \"ArrowUp\":\n target = active < 0 ? enabledFrom(flat.length - 1, -1) : enabledFrom(active - 1, -1);\n anchorIfNone = target;\n break;\n case \"Home\":\n case \"PageUp\":\n target = enabledFrom(0, 1);\n anchorIfNone = active;\n break;\n case \"End\":\n case \"PageDown\":\n target = enabledFrom(flat.length - 1, -1);\n anchorIfNone = active;\n break;\n case \" \":\n case \"Enter\":\n event.preventDefault();\n setFocus(\"keyboard\");\n if (key === \" \" && typeahead.current.text) findByTyping(\" \");\n else if (active < 0) return;\n else if (extending) extendTo(active, active);\n else toggle(active);\n return;\n default:\n if (modifier && key.toLowerCase() === \"a\" && multiple) {\n event.preventDefault();\n toggleAll();\n } else if (key.length === 1 && !modifier) {\n setFocus(\"keyboard\");\n findByTyping(key);\n }\n return;\n }\n\n // An arrow, Home or End.\n event.preventDefault();\n setFocus(\"keyboard\");\n if (target < 0) return;\n setActiveIndex(target);\n if (extending) extendTo(target, anchorIfNone < 0 ? target : anchorIfNone);\n }\n\n function onFocus(event: FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n setFocus(pointerDown.current ? \"pointer\" : \"keyboard\");\n pointerDown.current = false;\n // Pin where focus landed, so it doesn't follow the selection as that changes.\n setActiveIndex((previous) => (previous >= 0 && previous < flat.length && !flat[previous]!.disabled ? previous : active));\n }\n\n function onBlur(event: FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n setFocus(\"none\");\n setActiveIndex(-1);\n pointerDown.current = false;\n typeahead.current.text = \"\";\n }\n\n let flatIndex = -1;\n\n const renderOption = (option: ListBoxOption) => {\n flatIndex += 1;\n const index = flatIndex;\n const isSelected = selected.has(option.value);\n return (\n <div\n key={`${option.value}-${index}`}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": focus === \"keyboard\" && index === active,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerDown={() => {\n if (!disabled && !option.disabled) setActiveIndex(index);\n }}\n onClick={(event) => {\n if (disabled || option.disabled) return;\n setActiveIndex(index);\n if (multiple && event.shiftKey && canSelect) extendTo(index, index);\n else toggle(index);\n }}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n {option.icon ? (\n <span className=\"ow-option__icon\" aria-hidden=\"true\">\n {option.icon}\n </span>\n ) : null}\n <span className=\"ow-option__text\">\n <span className=\"ow-option__label\">{option.label}</span>\n {option.description ? <span className=\"ow-option__description\">{option.description}</span> : null}\n </span>\n </div>\n );\n };\n\n const isEmpty = flat.length === 0;\n const describedBy = ariaDescribedBy;\n\n return (\n <div\n ref={setRefs}\n id={id}\n role=\"listbox\"\n tabIndex={disabled ? undefined : 0}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ?? (ariaLabel ? undefined : fieldLabelId)}\n aria-describedby={describedBy}\n aria-multiselectable={multiple || undefined}\n aria-activedescendant={!disabled && active >= 0 ? optionId(active) : undefined}\n aria-invalid={isInvalid || undefined}\n aria-readonly={isReadOnly || undefined}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-listbox\",\n \"ow-listbox--standalone\",\n `ow-listbox--${size}`,\n {\n \"ow-listbox--focus-visible\": focus === \"keyboard\",\n \"ow-listbox--invalid\": isInvalid,\n \"ow-listbox--readonly\": isReadOnly,\n \"ow-listbox--disabled\": disabled,\n },\n className,\n )}\n style={maxHeight === undefined ? undefined : { maxHeight }}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n onPointerDown={() => {\n pointerDown.current = true;\n if (focus === \"keyboard\") setFocus(\"pointer\");\n }}\n >\n {options.map((item, groupIndex) =>\n isGroup(item) ? (\n <div key={`group-${item.label}-${groupIndex}`} role=\"group\" aria-label={item.label} className=\"ow-listbox__group\">\n <div className=\"ow-listbox__group-label\" aria-hidden=\"true\">\n {item.label}\n </div>\n {item.options.map(renderOption)}\n </div>\n ) : (\n renderOption(item)\n ),\n )}\n {isEmpty ? (\n // A listbox holds options, so an empty one says so with one that can't be chosen.\n <div id={emptyId} className=\"ow-listbox__empty\" role=\"option\" aria-disabled=\"true\" aria-selected=\"false\">\n {emptyMessage}\n </div>\n ) : null}\n </div>\n );\n}\n\nconst ForwardedListBox = /* @__PURE__ */ Object.assign(/* @__PURE__ */ forwardRef(ListBoxWithRef), { displayName: \"ListBox\" });\n\n// forwardRef drops the generic that ties `value` and `onChange` to `selectionMode`, so the cast puts it back.\n/**\n * Select's list of options on its own: a choice that stays on the page. `selectionMode=\"multiple\"` makes `value` an array.\n */\nexport const ListBox = ForwardedListBox as <Mode extends ListBoxSelectionMode = \"single\">(\n props: ListBoxModeProps<Mode> & RefAttributes<HTMLDivElement>,\n) => ReactElement | null;\n", "import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { CheckIcon, ChevronDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface ComboboxOption {\n value: string;\n /** The text shown and matched. */\n label: string;\n /** A muted line under the label; also matched. */\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface ComboboxProps {\n options: ComboboxOption[];\n /** The chosen option's value, or \"\" for none. */\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called as the person types, to load options from a server. */\n onInputChange?(text: string): void;\n /** @default \"Search\u2026\" */\n placeholder?: string;\n /** Shown when nothing matches.\n * @default \"No matches\" */\n emptyMessage?: ReactNode;\n /** Keep what was typed even if it isn't an option; onChange gets the text.\n * @default false */\n allowCustomValue?: boolean;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default false */\n isInvalid?: boolean;\n disabled?: boolean;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n className?: string;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A text field that suggests options as you type: pick a country, a repository, a person.\n * Down opens the list, Up and Down move, Enter picks, Escape closes then clears.\n */\nexport const Combobox = /* @__PURE__ */ forwardRef<HTMLInputElement, ComboboxProps>(function Combobox(\n {\n options,\n value,\n defaultValue = \"\",\n onChange,\n onInputChange,\n placeholder = \"Search\u2026\",\n emptyMessage = \"No matches\",\n allowCustomValue = false,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n ...aria\n },\n ref,\n) {\n const [selected, setSelected] = useControllableState(value, defaultValue, onChange);\n const labelOf = (v: string) => options.find((option) => option.value === v)?.label ?? (allowCustomValue ? v : \"\");\n const [text, setText] = useState(() => labelOf(selected));\n const [isOpen, setOpen] = useState(false);\n const [typed, setTyped] = useState(false);\n const [active, setActive] = useState(-1);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const fieldRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const listId = useId();\n const optionId = (index: number) => `${listId}-${index}`;\n\n const results = useMemo(() => {\n const query = text.trim().toLowerCase();\n if (!typed || !query) return options;\n return options.filter(\n (option) =>\n option.label.toLowerCase().includes(query) ||\n (typeof option.description === \"string\" && option.description.toLowerCase().includes(query)),\n );\n }, [options, text, typed]);\n\n // Show the chosen option's label when the value changes from outside.\n useEffect(() => {\n if (!isOpen) setText(labelOf(selected));\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only when the value or options change.\n }, [selected, options]);\n\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: fieldRef, floatingRef: listRef, matchWidth: true, maxHeight: 288 });\n\n function open() {\n if (disabled || isOpen) return;\n setOpen(true);\n const index = results.findIndex((option) => option.value === selected);\n setActive(index >= 0 ? index : results.findIndex((option) => !option.disabled));\n }\n\n function close(restore = true) {\n setOpen(false);\n setTyped(false);\n if (!restore) return;\n if (allowCustomValue) {\n if (text !== labelOf(selected)) {\n const match = options.find((option) => option.label.toLowerCase() === text.trim().toLowerCase());\n setSelected(match ? match.value : text);\n }\n } else if (text.trim() === \"\") setSelected(\"\");\n else setText(labelOf(selected));\n }\n\n useDismiss(isOpen, [fieldRef, listRef], () => close());\n\n function choose(option: ComboboxOption | undefined) {\n if (!option || option.disabled) return;\n setSelected(option.value);\n setText(option.label);\n setOpen(false);\n setTyped(false);\n }\n\n function move(step: 1 | -1) {\n if (!results.length) return;\n let next = active;\n for (let tries = 0; tries < results.length; tries += 1) {\n next = (next + step + results.length) % results.length;\n if (!results[next]!.disabled) break;\n }\n setActive(next);\n }\n\n useEffect(() => {\n if (isOpen && active >= 0) document.getElementById(optionId(active))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable.\n }, [active, isOpen]);\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!isOpen) open();\n else move(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!isOpen) open();\n else move(-1);\n break;\n case \"Enter\":\n if (isOpen && active >= 0) {\n event.preventDefault();\n choose(results[active]);\n } else if (isOpen) close();\n break;\n case \"Escape\":\n if (isOpen) return; // useDismiss closes it.\n if (text) {\n event.preventDefault();\n setText(\"\");\n setSelected(\"\");\n }\n break;\n case \"Tab\":\n if (isOpen) close();\n break;\n }\n }\n\n return (\n <>\n <div\n ref={fieldRef}\n className={cx(\n \"ow-input-group\",\n \"ow-combobox\",\n size === \"sm\" && \"ow-input-group--sm\",\n isInvalid && \"ow-input-group--invalid\",\n disabled && \"ow-input-group--disabled\",\n className,\n )}\n >\n <input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n className=\"ow-input-group__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && active >= 0 ? optionId(active) : undefined}\n aria-invalid={isInvalid || undefined}\n autoComplete=\"off\"\n disabled={disabled}\n placeholder={placeholder}\n value={text}\n onChange={(event) => {\n setText(event.target.value);\n setTyped(true);\n onInputChange?.(event.target.value);\n if (!isOpen) setOpen(true);\n setActive(0);\n }}\n onClick={open}\n onKeyDown={onKeyDown}\n {...aria}\n />\n <button\n type=\"button\"\n className=\"ow-combobox__toggle\"\n tabIndex={-1}\n aria-label={isOpen ? \"Hide options\" : \"Show options\"}\n disabled={disabled}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n if (isOpen) close();\n else {\n open();\n inputRef.current?.focus();\n }\n }}\n >\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className={cx(\"ow-select__chevron\", isOpen && \"ow-combobox__chevron--open\")} />\n </button>\n </div>\n {mounted ? (\n <div\n ref={listRef}\n {...manualPopover}\n data-state={state}\n id={listId}\n role=\"listbox\"\n aria-label={aria[\"aria-label\"]}\n aria-labelledby={aria[\"aria-labelledby\"]}\n className={cx(\"ow-listbox\", \"ow-floating\", `ow-listbox--${size}`)}\n style={style}\n >\n {results.map((option, index) => {\n const isSelected = option.value === selected;\n return (\n <div\n key={option.value}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": index === active && !option.disabled,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerMove={() => !option.disabled && setActive(index)}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => choose(option)}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n <span className=\"ow-option__text\">\n <span className=\"ow-option__label\">{option.label}</span>\n {option.description ? (\n <span className=\"ow-option__description\">{option.description}</span>\n ) : null}\n </span>\n </div>\n );\n })}\n {results.length === 0 ? (\n <div className=\"ow-listbox__empty\" role=\"presentation\">\n {emptyMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </>\n );\n});\n", "import { createContext, useContext, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { Fieldset } from \"../Checkbox/Checkbox\";\n\ninterface RadioGroupContextValue {\n name: string;\n value: string;\n select(value: string): void;\n disabled: boolean;\n}\n\nconst RadioGroupContext = /* @__PURE__ */ createContext<RadioGroupContextValue | null>(null);\n\nexport interface RadioGroupProps {\n /** The question, shown as the group's legend. */\n label: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n value?: string;\n /** The starting choice when uncontrolled.\n * @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** `default` is a dot and a label; `cards` turns each option into a bordered card, for choices that need a description.\n * @default \"default\" */\n variant?: \"default\" | \"cards\";\n /** An error under the options. */\n error?: ReactNode;\n disabled?: boolean;\n /** The form field name. Generated when left out. */\n name?: string;\n /** Radio options. */\n children: ReactNode;\n className?: string;\n}\n\n/** One choice from a few visible options. The arrow keys move between them, as with any radio group. */\nexport function RadioGroup({\n label,\n description,\n value,\n defaultValue = \"\",\n onChange,\n orientation = \"vertical\",\n variant = \"default\",\n error,\n disabled = false,\n name,\n children,\n className,\n}: RadioGroupProps) {\n const [current, select] = useControllableState(value, defaultValue, onChange);\n const generatedName = useId();\n return (\n <RadioGroupContext.Provider value={{ name: name ?? generatedName, value: current, select, disabled }}>\n <Fieldset\n legend={label}\n description={description}\n error={error}\n className={cx(\n \"ow-radio-group\",\n orientation === \"horizontal\" && \"ow-fieldset--horizontal\",\n variant === \"cards\" && \"ow-radio-group--cards\",\n className,\n )}\n >\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"value\" | \"size\"> {\n value: string;\n /** The label. */\n children: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n}\n\n/** One option in a RadioGroup. */\nexport function Radio({ value, children, description, disabled, className, ...inputProps }: RadioProps) {\n const group = useContext(RadioGroupContext);\n const descriptionId = useId();\n if (!group) throw new Error(\"Radio must be inside <RadioGroup>.\");\n const isDisabled = disabled || group.disabled;\n return (\n <label className={cx(\"ow-check-label\", \"ow-radio-label\", isDisabled && \"ow-check-label--disabled\", className)}>\n <span className=\"ow-radio\">\n <input\n type=\"radio\"\n className=\"ow-radio__input\"\n name={group.name}\n value={value}\n checked={group.value === value}\n disabled={isDisabled}\n aria-describedby={description ? descriptionId : undefined}\n onChange={() => group.select(value)}\n {...inputProps}\n />\n </span>\n <span className=\"ow-check-label__text\">\n <span>{children}</span>\n {description ? (\n <span id={descriptionId} className=\"ow-check-label__description\">\n {description}\n </span>\n ) : null}\n </span>\n </label>\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onChange\" | \"value\" | \"type\" | \"role\"> {\n checked: boolean;\n onChange(checked: boolean): void;\n /** What it turns on, for screen readers. Leave it out only when aria-labelledby names it. */\n label?: string;\n}\n\n/** A small on/off switch for settings rows; it takes effect at once, with no save button. */\nexport const Switch = /* @__PURE__ */ forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n { checked, onChange, label, className, disabled, ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={label}\n disabled={disabled}\n className={cx(\"ow-switch\", checked && \"ow-switch--on\", className)}\n onClick={() => onChange(!checked)}\n {...buttonProps}\n >\n <span className=\"ow-switch__knob\" />\n </button>\n );\n});\n", "import { useId, type CSSProperties, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\n\ntype SliderValue = number | [number, number];\n\nexport interface SliderProps<V extends SliderValue = number> {\n /** A number, or a [low, high] pair for a range with two handles. */\n value?: V;\n defaultValue?: V;\n onChange?(value: NoInfer<V>): void;\n /** Called when the person lets go, for work too slow to do on every move. */\n onChangeEnd?(value: NoInfer<V>): void;\n /** @default 0 */\n min?: number;\n /** @default 100 */\n max?: number;\n /** @default 1 */\n step?: number;\n /** Shown above the track, and names the slider for screen readers. */\n label?: ReactNode;\n /** Shows the current value at the right of the label.\n * @default true */\n showValue?: boolean;\n /** Turns a number into the text shown and read out, e.g. (v) => `${v}%`. */\n formatValue?(value: number): string;\n /** Names the slider when there's no visible label. */\n \"aria-label\"?: string;\n /** Names the slider by another element's id, such as a Field's label. */\n \"aria-labelledby\"?: string;\n /** Ids of the hint or error that describe it; Field sets this. */\n \"aria-describedby\"?: string;\n /** The id of the (first) handle's input, so a Field's label points at it; Field sets this. */\n id?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Picks a number, or a range, by dragging. It's built on native range inputs, so the arrow keys,\n * PageUp, PageDown, Home and End work as people expect.\n */\nexport function Slider<V extends SliderValue = number>({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n min = 0,\n max = 100,\n step = 1,\n label,\n showValue = true,\n formatValue = String,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n disabled,\n className,\n}: SliderProps<V>) {\n const [current, setCurrent] = useControllableState<V>(value, (defaultValue ?? min) as V, onChange);\n const labelId = useId();\n const isRange = Array.isArray(current);\n const [low, high] = isRange ? (current as [number, number]) : [min, current as number];\n const pct = (n: number) => ((n - min) / (max - min || 1)) * 100;\n const style = { \"--ow-slider-from\": `${isRange ? pct(low) : 0}%`, \"--ow-slider-to\": `${pct(high)}%` } as CSSProperties;\n const display = isRange ? `${formatValue(low)} \u2013 ${formatValue(high)}` : formatValue(high);\n const end = () => onChangeEnd?.(current);\n\n const input = (which: \"low\" | \"high\") => {\n const own = which === \"low\" ? low : high;\n return (\n <input\n type=\"range\"\n className={cx(\"ow-slider__input\", isRange && `ow-slider__input--${which}`)}\n // When the handles meet near the top, the low one must be on top to be draggable back down.\n style={which === \"low\" && low === high && pct(low) > 50 ? { zIndex: 3 } : undefined}\n min={min}\n max={max}\n step={step}\n value={own}\n disabled={disabled}\n id={which === (isRange ? \"low\" : \"high\") ? id : undefined}\n aria-describedby={ariaDescribedBy}\n aria-labelledby={label ? labelId : ariaLabelledBy}\n aria-label={label ? undefined : isRange ? `${ariaLabel ?? \"Range\"}, ${which === \"low\" ? \"minimum\" : \"maximum\"}` : ariaLabel}\n aria-valuetext={formatValue(own)}\n onChange={(event) => {\n const n = Number(event.target.value);\n if (!isRange) setCurrent(n as V);\n else if (which === \"low\") setCurrent([Math.min(n, high), high] as V);\n else setCurrent([low, Math.max(n, low)] as V);\n }}\n onPointerUp={end}\n onKeyUp={end}\n />\n );\n };\n\n return (\n <div className={cx(\"ow-slider\", disabled && \"ow-slider--disabled\", className)}>\n {label || showValue ? (\n <div className=\"ow-slider__header\">\n {label ? (\n <span id={labelId} className=\"ow-slider__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? (\n <output className=\"ow-slider__value\" aria-hidden=\"true\">\n {display}\n </output>\n ) : null}\n </div>\n ) : null}\n <div className=\"ow-slider__control\" style={style}>\n <span className=\"ow-slider__track\" aria-hidden=\"true\">\n <span className=\"ow-slider__fill\" />\n </span>\n {isRange ? input(\"low\") : null}\n {input(\"high\")}\n </div>\n </div>\n );\n}\n", "import { useEffect, useId, useRef, useState, type DragEvent, type ReactNode } from \"react\";\n\nimport { UploadIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface FileDropZoneProps {\n /** Called with the accepted files, whether dropped or picked. */\n onFiles(files: File[]): void;\n /** File types to accept, as for <input accept>: \".png,.jpg\", \"image/*\". */\n accept?: string;\n /** @default false */\n multiple?: boolean;\n /** The largest file accepted, in bytes. */\n maxSize?: number;\n /** @default \"Drop files here, or browse\" */\n label?: ReactNode;\n /** A muted line under the label: what's accepted, how big. */\n hint?: ReactNode;\n /** An error to show in place of the hint, such as a failed upload. */\n error?: ReactNode;\n /** A 20px icon on the tile.\n * @default <UploadIcon /> */\n icon?: ReactNode;\n disabled?: boolean;\n /** The form field name for the file input. A form submits the files from the last accepted pick or drop. */\n name?: string;\n className?: string;\n}\n\nfunction matches(file: File, accept: string | undefined) {\n if (!accept) return true;\n return accept.split(\",\").some((rule) => {\n const pattern = rule.trim().toLowerCase();\n if (!pattern) return false;\n if (pattern.startsWith(\".\")) return file.name.toLowerCase().endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return file.type.toLowerCase().startsWith(pattern.slice(0, -1));\n return file.type.toLowerCase() === pattern;\n });\n}\n\nconst formatSize = (bytes: number) =>\n bytes >= 1_048_576 ? `${Math.round(bytes / 104_857.6) / 10} MB` : `${Math.round(bytes / 1024)} KB`;\n\n/**\n * A drop zone for files: drop them on it, or press it to pick them.\n * It checks the type and size and says what was wrong.\n */\nexport function FileDropZone({\n onFiles,\n accept,\n multiple = false,\n maxSize,\n label = \"Drop files here, or browse\",\n hint,\n error,\n icon,\n disabled = false,\n name,\n className,\n}: FileDropZoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const depth = useRef(0);\n const [isDragging, setIsDragging] = useState(false);\n const [problem, setProblem] = useState<string>();\n const hintId = useId();\n // The files a form will submit: the last accepted pick or drop, put back in the input after each change.\n const kept = useRef<File[]>([]);\n\n function keep(files: File[]) {\n kept.current = files;\n const input = inputRef.current;\n if (!input) return;\n try {\n const transfer = new DataTransfer();\n files.forEach((file) => transfer.items.add(file));\n input.files = transfer.files;\n } catch {\n // Browsers without a DataTransfer constructor: the files still reach onFiles, just not a plain form post.\n }\n }\n\n // The input is emptied as the picker opens, so choosing the same file again still counts as a change;\n // closing the picker without choosing puts the kept files back.\n useEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n const restore = () => keep(kept.current);\n input.addEventListener(\"cancel\", restore);\n return () => input.removeEventListener(\"cancel\", restore);\n }, []);\n\n function take(list: FileList | null) {\n if (!list || disabled) return;\n const files = [...list].slice(0, multiple ? undefined : 1);\n const wrongType = files.find((file) => !matches(file, accept));\n const tooBig = maxSize ? files.find((file) => file.size > maxSize) : undefined;\n if (!multiple && list.length > 1) setProblem(\"Drop one file at a time.\");\n else if (wrongType) setProblem(`\u201C${wrongType.name}\u201D isn't a file this accepts.`);\n else if (tooBig && maxSize) setProblem(`\u201C${tooBig.name}\u201D is over ${formatSize(maxSize)}.`);\n else {\n setProblem(undefined);\n if (files.length) {\n keep(files);\n onFiles(files);\n return;\n }\n }\n keep(kept.current);\n }\n\n const hasFiles = (event: DragEvent) => event.dataTransfer.types.includes(\"Files\");\n\n return (\n <label\n className={cx(\n \"ow-dropzone\",\n isDragging && \"ow-dropzone--dragging\",\n Boolean(error || problem) && \"ow-dropzone--invalid\",\n disabled && \"ow-dropzone--disabled\",\n className,\n )}\n onDragEnter={(event) => {\n if (!hasFiles(event) || disabled) return;\n event.preventDefault();\n depth.current += 1;\n setIsDragging(true);\n }}\n onDragOver={(event) => {\n if (!hasFiles(event) || disabled) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }}\n onDragLeave={() => {\n depth.current = Math.max(0, depth.current - 1);\n if (depth.current === 0) setIsDragging(false);\n }}\n onDrop={(event) => {\n if (!hasFiles(event)) return;\n event.preventDefault();\n depth.current = 0;\n setIsDragging(false);\n take(event.dataTransfer.files);\n }}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className=\"ow-visually-hidden\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n name={name}\n aria-describedby={hintId}\n onClick={(event) => {\n event.currentTarget.value = \"\";\n }}\n onChange={(event) => take(event.target.files)}\n />\n <span className=\"ow-dropzone__icon\">{icon ?? <UploadIcon size={20} />}</span>\n <span className=\"ow-dropzone__label\">{isDragging ? \"Drop to add\" : label}</span>\n <span id={hintId} className=\"ow-dropzone__hint\" aria-live=\"polite\">\n {error ?? problem ?? hint}\n </span>\n </label>\n );\n}\n", "import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, type KeyboardEvent, type Ref } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { addDays, addMonths, clampDate, formatDate, monthIndex, monthWeeks, parseISO, startOfMonth, todayISO, toISO, weekday, type ISODate } from \"./dates\";\n\nexport interface CalendarProps {\n /** The chosen date as \"YYYY-MM-DD\", or \"\" for none. */\n value?: ISODate;\n /** @default \"\" */\n defaultValue?: ISODate;\n onChange?(value: ISODate): void;\n /** The earliest date that can be chosen, \"YYYY-MM-DD\". */\n min?: ISODate;\n /** The latest date that can be chosen. */\n max?: ISODate;\n /** Return true for dates that can't be chosen, such as weekends. */\n isDateDisabled?(date: ISODate): boolean;\n /** Month and day names follow this locale, e.g. \"en-IE\", \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** 1 starts weeks on Monday, 0 on Sunday.\n * @default 1 */\n weekStartsOn?: 0 | 1;\n /** Focus the chosen (or today's) date on mount, for use in a popover.\n * @default false */\n autoFocus?: boolean;\n className?: string;\n}\n\nexport interface CalendarHandle {\n focus(): void;\n}\n\n/**\n * A month grid for picking a date. Arrow keys move by day and week, PageUp and PageDown by month\n * (with Shift, by year), Home and End to the week's ends. Today is marked with a brass dot.\n */\nexport const Calendar = /* @__PURE__ */ forwardRef<CalendarHandle, CalendarProps>(function Calendar(\n { value, defaultValue = \"\", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className },\n ref,\n) {\n const [selected, setSelected] = useControllableState(value, defaultValue, onChange);\n const today = todayISO();\n const [focused, setFocused] = useState<ISODate>(() => selected || clampDate(today, min, max));\n const [shouldFocus, setShouldFocus] = useState(autoFocus);\n const gridRef = useRef<HTMLTableElement>(null);\n\n useImperativeHandle(ref, () => ({ focus: () => setShouldFocus(true) }), []);\n\n useEffect(() => {\n if (selected) setFocused(selected);\n }, [selected]);\n\n const focusFrame = useRef(0);\n useEffect(() => {\n if (!shouldFocus) return;\n setShouldFocus(false);\n const focusDay = () => gridRef.current?.querySelector<HTMLButtonElement>('button[tabindex=\"0\"]')?.focus();\n focusDay();\n // A popover (DatePicker's) is hidden for its first frame while it's placed, and can't take focus until it shows.\n if (!gridRef.current?.contains(document.activeElement)) focusFrame.current = requestAnimationFrame(focusDay);\n }, [shouldFocus, focused]);\n useEffect(() => () => cancelAnimationFrame(focusFrame.current), []);\n\n const { year, month } = parseISO(focused);\n const first = toISO(year, month, 1);\n const slide = useSlide(monthIndex(first));\n\n const isDisabled = (date: ISODate) => (min !== undefined && date < min) || (max !== undefined && date > max) || Boolean(isDateDisabled?.(date));\n\n function moveTo(date: ISODate) {\n setFocused(clampDate(date, min, max));\n setShouldFocus(true);\n }\n\n function choose(date: ISODate) {\n if (isDisabled(date)) return;\n setSelected(date);\n setFocused(date);\n }\n\n return (\n <div className={cx(\"ow-calendar\", className)}>\n <MonthHeader\n month={first}\n locale={locale}\n slide={slide}\n previous={{ disabled: !canShowBefore(first, min), onClick: () => setFocused(clampDate(addMonths(focused, -1), min, max)) }}\n next={{ disabled: !canShowAfter(first, max), onClick: () => setFocused(clampDate(addMonths(focused, 1), min, max)) }}\n />\n <MonthGrid\n gridRef={gridRef}\n month={first}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n slide={slide}\n isDisabled={isDisabled}\n isSelected={(date) => date === selected}\n isFilled={(date) => date === selected}\n onChoose={choose}\n onDayKeyDown={(event, date) => {\n const target = dateForKey(event, date, weekStartsOn);\n if (target === undefined) return;\n event.preventDefault();\n moveTo(target);\n }}\n onDayFocus={(date) => date !== focused && setFocused(date)}\n />\n </div>\n );\n});\n\n// The pieces below are shared with RangeCalendar, which shows the same month grid.\n\n/** Whether the month before `first` has a day on or after `min`. */\nexport function canShowBefore(first: ISODate, min: ISODate | undefined): boolean {\n return !min || addDays(first, -1) >= min;\n}\n\n/** Whether the month after `last` (the first of the last month shown) has a day on or before `max`. */\nexport function canShowAfter(last: ISODate, max: ISODate | undefined): boolean {\n return !max || addMonths(last, 1) <= max;\n}\n\n/** Where a key moves the focus from `date`: a day, a week, the week's ends, a month (with Shift, a year). */\nexport function dateForKey(event: KeyboardEvent<HTMLElement>, date: ISODate, weekStartsOn: 0 | 1): ISODate | undefined {\n const day = (weekday(date) - weekStartsOn + 7) % 7;\n const moves: Record<string, () => ISODate> = {\n ArrowLeft: () => addDays(date, -1),\n ArrowRight: () => addDays(date, 1),\n ArrowUp: () => addDays(date, -7),\n ArrowDown: () => addDays(date, 7),\n Home: () => addDays(date, -day),\n End: () => addDays(date, 6 - day),\n PageUp: () => addMonths(date, event.shiftKey ? -12 : -1),\n PageDown: () => addMonths(date, event.shiftKey ? 12 : 1),\n };\n return moves[event.key]?.();\n}\n\n/** Which way the month changed since the last render, so the new one slides in from that side. */\nexport function useSlide(month: number): \"next\" | \"previous\" | undefined {\n const slide = useRef<{ month: number; direction?: \"next\" | \"previous\" }>({ month });\n if (slide.current.month !== month) {\n slide.current = { month, direction: month > slide.current.month ? \"next\" : \"previous\" };\n }\n return slide.current.direction;\n}\n\ninterface MonthNavButton {\n disabled: boolean;\n onClick(): void;\n}\n\nexport interface MonthHeaderProps {\n /** The first day of the month shown. */\n month: ISODate;\n locale?: string;\n slide?: \"next\" | \"previous\";\n /** The previous-month button, or null for an empty space of the same size. */\n previous: MonthNavButton | null;\n /** The next-month button, or null for an empty space of the same size. */\n next: MonthNavButton | null;\n}\n\n/** The month's name between the previous- and next-month buttons. */\nexport function MonthHeader({ month, locale, slide, previous, next }: MonthHeaderProps) {\n const monthLabel = (date: ISODate) => formatDate(date, locale, { month: \"long\", year: \"numeric\" });\n return (\n <div className=\"ow-calendar__header\">\n {previous ? (\n <button\n type=\"button\"\n className=\"ow-calendar__nav\"\n aria-label={`Previous month, ${monthLabel(addMonths(month, -1))}`}\n disabled={previous.disabled}\n onClick={previous.onClick}\n >\n <ChevronLeftIcon size={16} />\n </button>\n ) : (\n <span className=\"ow-calendar__nav-space\" />\n )}\n <h2 className=\"ow-calendar__title\" aria-live=\"polite\">\n <span key={monthIndex(month)} className={cx(\"ow-calendar__title-text\", slide && `ow-calendar__slide--${slide}`)}>\n {monthLabel(month)}\n </span>\n </h2>\n {next ? (\n <button\n type=\"button\"\n className=\"ow-calendar__nav\"\n aria-label={`Next month, ${monthLabel(addMonths(month, 1))}`}\n disabled={next.disabled}\n onClick={next.onClick}\n >\n <ChevronRightIcon size={16} />\n </button>\n ) : (\n <span className=\"ow-calendar__nav-space\" />\n )}\n </div>\n );\n}\n\nexport interface MonthGridProps {\n /** The first day of the month shown. */\n month: ISODate;\n /** The day that takes Tab focus (roving tabindex). */\n focused: ISODate;\n today: ISODate;\n locale?: string;\n weekStartsOn: 0 | 1;\n slide?: \"next\" | \"previous\";\n /** Leaves the days of the months either side empty, for months shown side by side. */\n hideOutsideDays?: boolean;\n isDisabled(date: ISODate): boolean;\n /** aria-selected on the day's cell. */\n isSelected(date: ISODate): boolean;\n /** Fills the day with the primary colour. */\n isFilled(date: ISODate): boolean;\n /** Extra classes for a day's cell; `column` is 0 to 6 across the week. */\n cellClassName?(date: ISODate, column: number): string | undefined;\n /** Extra classes for a day's button. */\n dayClassName?(date: ISODate): string | undefined;\n /** Extra attributes for a day's button. */\n dayProps?(date: ISODate): { \"aria-describedby\"?: string };\n onChoose(date: ISODate): void;\n onDayKeyDown(event: KeyboardEvent<HTMLButtonElement>, date: ISODate): void;\n onDayFocus(date: ISODate): void;\n onDayPointerEnter?(date: ISODate): void;\n gridRef?: Ref<HTMLTableElement>;\n}\n\n/** One month as a grid of day buttons: six weeks, weekday names above, each day read out in full. */\nexport function MonthGrid({\n month,\n focused,\n today,\n locale,\n weekStartsOn,\n slide,\n hideOutsideDays = false,\n isDisabled,\n isSelected,\n isFilled,\n cellClassName,\n dayClassName,\n dayProps,\n onChoose,\n onDayKeyDown,\n onDayFocus,\n onDayPointerEnter,\n gridRef,\n}: MonthGridProps) {\n const first = startOfMonth(month);\n const { month: monthNumber } = parseISO(first);\n const weeks = useMemo(() => monthWeeks(first, weekStartsOn), [first, weekStartsOn]);\n const weekdayNames = weeks[0]!.map((date) => ({\n short: formatDate(date, locale, { weekday: \"short\" }),\n long: formatDate(date, locale, { weekday: \"long\" }),\n }));\n\n return (\n <table ref={gridRef} role=\"grid\" className=\"ow-calendar__grid\" aria-label={formatDate(first, locale, { month: \"long\", year: \"numeric\" })}>\n <thead>\n <tr>\n {weekdayNames.map((name) => (\n <th key={name.long} scope=\"col\" abbr={name.long} className=\"ow-calendar__weekday\">\n {name.short.slice(0, 2)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody key={monthIndex(first)} className={cx(slide && `ow-calendar__slide--${slide}`)}>\n {weeks.map((week) => (\n <tr key={week[0]}>\n {week.map((date, column) => {\n const inMonth = parseISO(date).month === monthNumber;\n if (!inMonth && hideOutsideDays) return <td key={date} role=\"gridcell\" className=\"ow-calendar__cell\" />;\n const selected = isSelected(date);\n const disabled = isDisabled(date);\n return (\n <td key={date} role=\"gridcell\" aria-selected={selected} className={cx(\"ow-calendar__cell\", cellClassName?.(date, column))}>\n <button\n type=\"button\"\n tabIndex={date === focused ? 0 : -1}\n aria-label={formatDate(date, locale, { dateStyle: \"full\" })}\n aria-current={date === today ? \"date\" : undefined}\n aria-disabled={disabled || undefined}\n {...dayProps?.(date)}\n className={cx(\n \"ow-calendar__day\",\n {\n \"ow-calendar__day--outside\": !inMonth,\n \"ow-calendar__day--selected\": isFilled(date),\n \"ow-calendar__day--today\": date === today,\n \"ow-calendar__day--disabled\": disabled,\n },\n dayClassName?.(date),\n )}\n onClick={() => onChoose(date)}\n onKeyDown={(event) => onDayKeyDown(event, date)}\n // A day from the next or previous month doesn't turn the page when it takes focus from a click,\n // or the button would move out from under the pointer and the click would be lost; choosing it does.\n onFocus={() => inMonth && onDayFocus(date)}\n onPointerEnter={onDayPointerEnter ? () => onDayPointerEnter(date) : undefined}\n >\n {parseISO(date).day}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n", "import { forwardRef, useCallback, useId, useRef, useState, type ForwardedRef } from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { CalendarIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { Calendar, type CalendarProps } from \"./Calendar\";\nimport { formatDate, type ISODate } from \"./dates\";\nimport type { DatePickerProps } from \"./DatePicker.types\";\nexport type { DatePickerProps } from \"./DatePicker.types\";\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A field that opens a Calendar. Choosing a date closes it; Escape closes it without changing anything. */\nexport const DatePicker = /* @__PURE__ */ forwardRef<HTMLButtonElement, DatePickerProps>(function DatePicker(\n {\n value,\n defaultValue = \"\",\n onChange,\n placeholder = \"Pick a date\",\n formatOptions = { dateStyle: \"medium\" },\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n locale,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...calendarProps\n },\n ref,\n) {\n const [date, setDate] = useControllableState<ISODate>(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement: \"bottom-start\", offset: 6 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, triggerRef], close);\n\n const label = date ? formatDate(date, locale, formatOptions) : placeholder;\n\n return (\n <>\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\n \"ow-select\",\n \"ow-date-picker\",\n `ow-select--${size}`,\n { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen },\n className,\n )}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <CalendarIcon size={size === \"sm\" ? 14 : 16} className=\"ow-date-picker__icon\" />\n <span id={`${panelId}-value`} className={cx(\"ow-select__value\", !date && \"ow-select__value--placeholder\")}>\n {label}\n </span>\n </button>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a date\"\n className=\"ow-popover ow-floating ow-date-picker__panel\"\n style={style}\n >\n <Calendar\n {...calendarProps}\n locale={locale}\n value={date}\n autoFocus\n onChange={(next) => {\n setDate(next);\n close();\n }}\n />\n </div>\n ) : null}\n </>\n );\n});\n", "import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { canShowAfter, canShowBefore, dateForKey, MonthGrid, MonthHeader, useSlide, type CalendarHandle } from \"./Calendar\";\nimport { addDays, addMonths, clampDate, formatDate, formatDateRange, monthIndex, parseISO, startOfMonth, todayISO, type ISODate } from \"./dates\";\n\n/** A range of days, both ends included, as \"YYYY-MM-DD\". */\nexport interface DateRange {\n start: ISODate;\n end: ISODate;\n}\n\nexport interface RangeCalendarProps {\n /** The chosen range, or null for none. */\n value?: DateRange | null;\n /** @default null */\n defaultValue?: DateRange | null;\n /** Called once both ends are picked, with the earlier day as the start. */\n onChange?(range: DateRange | null): void;\n /** The earliest day either end can be, \"YYYY-MM-DD\". */\n min?: ISODate;\n /** The latest day either end can be. */\n max?: ISODate;\n /** Return true for days that can't be an end of the range, such as weekends. A range can still run across them. */\n isDateDisabled?(date: ISODate): boolean;\n /** Month and day names follow this locale, e.g. \"en-IE\", \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** 1 starts weeks on Monday, 0 on Sunday.\n * @default 1 */\n weekStartsOn?: 0 | 1;\n /** How many months show side by side. Two stack when there isn't room for both.\n * @default 1 */\n visibleMonths?: 1 | 2;\n /** Focus the range's start (or today) on mount, for use in a popover.\n * @default false */\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * Month grids for picking a range of days. The first pick sets the start and the range follows the pointer or the\n * focus until the second pick sets the end; Escape drops a half-picked range. The keys move as in Calendar.\n */\nexport const RangeCalendar = /* @__PURE__ */ forwardRef<CalendarHandle, RangeCalendarProps>(function RangeCalendar(\n { value, defaultValue = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className },\n ref,\n) {\n const months = visibleMonths;\n const [range, setRange] = useControllableState<DateRange | null>(value, defaultValue, onChange);\n const today = todayISO();\n const [focused, setFocused] = useState<ISODate>(() => (range ? ordered(range.start, range.end).start : clampDate(today, min, max)));\n const [firstMonth, setFirstMonth] = useState<ISODate>(() => fitMonths(startOfMonth(focused), months, min, max));\n // The first pick, while the second is still to come.\n const [anchor, setAnchor] = useState<ISODate | null>(null);\n const [hovered, setHovered] = useState<ISODate | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n const [shouldFocus, setShouldFocus] = useState(autoFocus);\n const rootRef = useRef<HTMLDivElement>(null);\n // The range this calendar last picked, so picking it doesn't move the view as a new value from outside does.\n const picked = useRef<DateRange | null>(null);\n const rangeId = useId();\n\n useImperativeHandle(ref, () => ({ focus: () => setShouldFocus(true) }), []);\n\n const start = range?.start;\n const end = range?.end;\n useEffect(() => {\n if (!start || !end || (picked.current?.start === start && picked.current.end === end)) return;\n picked.current = null;\n const first = ordered(start, end).start;\n setAnchor(null);\n setFocused(first);\n setFirstMonth((current) => monthsShowing(first, current, months, min, max));\n // Only a new range from outside moves the view; min and max don't.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [start, end]);\n\n // Going from two months to one (a phone turned upright) keeps the focused day in view.\n useEffect(() => {\n setFirstMonth((current) => monthsShowing(focused, current, months, min, max));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [months]);\n\n const focusFrame = useRef(0);\n useEffect(() => {\n if (!shouldFocus) return;\n setShouldFocus(false);\n const focusDay = () => rootRef.current?.querySelector<HTMLButtonElement>('.ow-calendar__day[tabindex=\"0\"]')?.focus();\n focusDay();\n // A popover is hidden for its first frame while it's placed, and can't take focus until it shows.\n if (!rootRef.current?.contains(document.activeElement)) focusFrame.current = requestAnimationFrame(focusDay);\n }, [shouldFocus, focused, firstMonth]);\n useEffect(() => () => cancelAnimationFrame(focusFrame.current), []);\n\n const isDisabled = (date: ISODate) => (min !== undefined && date < min) || (max !== undefined && date > max) || Boolean(isDateDisabled?.(date));\n\n const shown = anchor ? ordered(anchor, hovered ?? focused) : range ? ordered(range.start, range.end) : null;\n const inShown = (date: ISODate) => Boolean(shown && date >= shown.start && date <= shown.end);\n const slide = useSlide(monthIndex(firstMonth));\n const fullDate = (date: ISODate) => formatDate(date, locale, { dateStyle: \"full\" });\n const fullRange = (dates: DateRange) => formatDateRange(dates.start, dates.end, locale, { dateStyle: \"full\" });\n\n function moveTo(date: ISODate) {\n const next = clampDate(date, min, max);\n setFocused(next);\n setFirstMonth((current) => monthsShowing(next, current, months, min, max));\n setHovered(null);\n setShouldFocus(true);\n }\n\n function showMonths(delta: 1 | -1) {\n const first = addMonths(firstMonth, delta);\n let next = clampDate(addMonths(focused, delta), min, max);\n const offset = monthIndex(next) - monthIndex(first);\n if (offset < 0 || offset >= months) next = clampDate(offset < 0 ? first : addMonths(first, months - 1), min, max);\n setFirstMonth(first);\n setFocused(next);\n }\n\n function choose(date: ISODate) {\n if (isDisabled(date)) return;\n setFocused(date);\n setHovered(null);\n if (!anchor) {\n setAnchor(date);\n setAnnouncement(`Start: ${fullDate(date)}. Pick the end date.`);\n return;\n }\n const next = ordered(anchor, date);\n setAnchor(null);\n picked.current = next;\n setRange(next);\n setAnnouncement(`Selected ${fullRange(next)}`);\n }\n\n function cellClassName(date: ISODate, column: number) {\n if (!shown || shown.start === shown.end || !inShown(date)) return undefined;\n const { day } = parseISO(date);\n // Side by side, a month's first and last days end the band too: the days beyond them are blank.\n const monthStart = months > 1 && day === 1;\n const monthEnd = months > 1 && parseISO(addDays(date, 1)).day === 1;\n return cx(\"ow-range-calendar__cell--in-range\", {\n \"ow-range-calendar__cell--start\": date === shown.start,\n \"ow-range-calendar__cell--end\": date === shown.end,\n \"ow-range-calendar__cell--row-start\": column === 0 || monthStart,\n \"ow-range-calendar__cell--row-end\": column === 6 || monthEnd,\n });\n }\n\n return (\n <div\n ref={rootRef}\n className={cx(\"ow-range-calendar\", className)}\n onPointerLeave={() => setHovered(null)}\n onKeyDown={(event) => {\n if (event.key !== \"Escape\" || !anchor) return;\n // Drop the half-picked range, not the popover or dialog around it.\n event.preventDefault();\n event.stopPropagation();\n setAnchor(null);\n setHovered(null);\n setAnnouncement(range ? `Start date cleared. Selected ${fullRange(ordered(range.start, range.end))}` : \"Start date cleared\");\n }}\n >\n {Array.from({ length: months }, (_, index) => {\n const month = addMonths(firstMonth, index);\n return (\n <div key={index} className=\"ow-calendar ow-range-calendar__month\">\n <MonthHeader\n month={month}\n locale={locale}\n slide={slide}\n previous={index === 0 ? { disabled: !canShowBefore(firstMonth, min), onClick: () => showMonths(-1) } : null}\n next={index === months - 1 ? { disabled: !canShowAfter(month, max), onClick: () => showMonths(1) } : null}\n />\n <MonthGrid\n month={month}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n slide={slide}\n hideOutsideDays={months > 1}\n isDisabled={isDisabled}\n isSelected={inShown}\n isFilled={(date) => date === shown?.start || date === shown?.end}\n cellClassName={cellClassName}\n dayClassName={(date) =>\n inShown(date) && date !== shown?.start && date !== shown?.end ? \"ow-range-calendar__day--in-range\" : undefined\n }\n dayProps={(date) => (!anchor && range && (date === shown?.start || date === shown?.end) ? { \"aria-describedby\": rangeId } : {})}\n onChoose={choose}\n onDayKeyDown={(event, date) => {\n const target = dateForKey(event, date, weekStartsOn);\n if (target === undefined) return;\n event.preventDefault();\n moveTo(target);\n }}\n onDayFocus={(date) => date !== focused && setFocused(date)}\n onDayPointerEnter={(date) => anchor && !isDisabled(date) && setHovered(date)}\n />\n </div>\n );\n })}\n {range ? (\n <span id={rangeId} hidden>\n {`Selected range: ${fullRange(ordered(range.start, range.end))}`}\n </span>\n ) : null}\n <div className=\"ow-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </div>\n </div>\n );\n});\n\nfunction ordered(a: ISODate, b: ISODate): DateRange {\n return a <= b ? { start: a, end: b } : { start: b, end: a };\n}\n\n/** Moves the first month shown back so no month wholly after max shows, and forward so none wholly before min does. */\nfunction fitMonths(first: ISODate, months: number, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n let result = first;\n if (max && result > addMonths(startOfMonth(max), 1 - months)) result = addMonths(startOfMonth(max), 1 - months);\n if (min && result < startOfMonth(min)) result = startOfMonth(min);\n return result;\n}\n\n/** The first month to show so that `date` is in view, moving as little as it can from `current`. */\nfunction monthsShowing(date: ISODate, current: ISODate, months: number, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n const offset = monthIndex(date) - monthIndex(current);\n if (offset < 0) return fitMonths(startOfMonth(date), months, min, max);\n if (offset >= months) return fitMonths(addMonths(startOfMonth(date), 1 - months), months, min, max);\n return current;\n}\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { CalendarIcon, CheckIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { CloseButton } from \"@/components/Button/ButtonGroup\";\nimport { formatDateRange } from \"./dates\";\nimport { RangeCalendar, type DateRange, type RangeCalendarProps } from \"./RangeCalendar\";\nimport type { DateRangePickerProps, DateRangePreset } from \"./DateRangePicker.types\";\nexport type { DateRangePickerProps, DateRangePreset } from \"./DateRangePicker.types\";\n\n// Two months and the presets need about 740px; below this, the calendar shows one month.\nconst twoMonthsQuery = \"(min-width: 768px)\";\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\nfunction useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(() => typeof window !== \"undefined\" && Boolean(window.matchMedia?.(query).matches));\n useEffect(() => {\n const list = window.matchMedia?.(query);\n if (!list) return undefined;\n const update = () => setMatches(list.matches);\n update();\n list.addEventListener(\"change\", update);\n return () => list.removeEventListener(\"change\", update);\n }, [query]);\n return matches;\n}\n\n/**\n * A field that opens a two-month RangeCalendar, with optional presets beside it. Picking the second day, or a preset,\n * closes it; Escape closes it without changing anything. Once there's a range, a clear button empties it.\n */\nexport const DateRangePicker = /* @__PURE__ */ forwardRef<HTMLButtonElement, DateRangePickerProps>(function DateRangePicker(\n {\n value,\n defaultValue = null,\n onChange,\n presets,\n visibleMonths = 2,\n placeholder = \"Pick dates\",\n formatOptions = { dateStyle: \"medium\" },\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n locale,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...calendarProps\n },\n ref,\n) {\n const [range, setRange] = useControllableState<DateRange | null>(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const fieldRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const roomForTwo = useMediaQuery(twoMonthsQuery);\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement: \"bottom-start\", offset: 6, maxHeight: 640 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, fieldRef], close);\n\n useEffect(() => {\n if (disabled) setOpen(false);\n }, [disabled]);\n\n const label = range ? formatDateRange(range.start, range.end, locale, formatOptions) : placeholder;\n\n function onPresetKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n const buttons = Array.from(event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\"button\") ?? []);\n const index = buttons.indexOf(event.currentTarget);\n const moves: Record<string, number> = { ArrowDown: index + 1, ArrowUp: index - 1, Home: 0, End: buttons.length - 1 };\n const target = moves[event.key];\n if (target === undefined) return;\n event.preventDefault();\n buttons[(target + buttons.length) % buttons.length]?.focus();\n }\n\n return (\n <>\n <div\n ref={fieldRef}\n className={cx(\"ow-date-range-picker\", `ow-date-range-picker--${size}`, range && !disabled && \"ow-date-range-picker--clearable\", className)}\n >\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\"ow-select\", \"ow-date-range-picker__trigger\", `ow-select--${size}`, {\n \"ow-select--open\": isOpen,\n \"ow-select--invalid\": isInvalid && !isOpen,\n })}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <CalendarIcon size={size === \"sm\" ? 14 : 16} className=\"ow-date-range-picker__icon\" />\n <span id={`${panelId}-value`} className={cx(\"ow-select__value\", !range && \"ow-select__value--placeholder\")}>\n {label}\n </span>\n </button>\n {range && !disabled ? (\n <CloseButton\n size=\"sm\"\n label=\"Clear dates\"\n className=\"ow-date-range-picker__clear\"\n onClick={() => {\n setRange(null);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n ) : null}\n </div>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose dates\"\n className={cx(\"ow-popover\", \"ow-floating\", \"ow-date-range-picker__panel\")}\n style={style}\n onBlur={(event) => {\n // Tabbing out of the panel closes it, as a click outside does.\n const next = event.relatedTarget as Node | null;\n if (isOpen && next && !panelRef.current?.contains(next)) setOpen(false);\n }}\n >\n {presets?.length ? (\n <div role=\"group\" aria-label=\"Presets\" className=\"ow-date-range-picker__presets\">\n {presets.map((preset) => {\n const isCurrent = range?.start === preset.range.start && range.end === preset.range.end;\n return (\n <button\n key={preset.label}\n type=\"button\"\n aria-current={isCurrent || undefined}\n className={cx(\"ow-date-range-picker__preset\", isCurrent && \"ow-date-range-picker__preset--current\")}\n onKeyDown={onPresetKeyDown}\n onClick={() => {\n setRange(preset.range);\n close();\n }}\n >\n <span className=\"ow-date-range-picker__preset-label\">{preset.label}</span>\n {isCurrent ? <CheckIcon size={14} className=\"ow-date-range-picker__preset-check\" /> : null}\n </button>\n );\n })}\n </div>\n ) : null}\n <RangeCalendar\n {...calendarProps}\n locale={locale}\n value={range}\n visibleMonths={roomForTwo ? visibleMonths : 1}\n autoFocus\n onChange={(next) => {\n setRange(next);\n close();\n }}\n />\n </div>\n ) : null}\n </>\n );\n});\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** `active` is for work in progress, so it isn't confused with `warning` (something needs you). */\nexport type BadgeVariant = \"neutral\" | \"active\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** A 12px icon before the text. */\n icon?: ReactNode;\n /** @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"neutral\" */\n variant?: BadgeVariant;\n}\n\n/** A pill-shaped status label: one or two words, with an optional icon. */\nexport function Badge({ children, className, icon, size = \"md\", variant = \"neutral\", ...spanProps }: BadgeProps) {\n return (\n <span className={cx(\"ow-badge\", `ow-badge--${size}`, `ow-badge--${variant}`, className)} {...spanProps}>\n {icon ? <span className=\"ow-badge__icon\">{icon}</span> : null}\n <span>{children}</span>\n </span>\n );\n}\n", "import { useId, type CSSProperties, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport type ProgressTone = \"primary\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ProgressBarProps {\n /** How far along, from 0 to max. Leave out for work of unknown length. */\n value?: number;\n /** @default 100 */\n max?: number;\n /** Shown above the bar, and names it for screen readers. */\n label?: ReactNode;\n /** Shows the value at the right of the label.\n * @default true */\n showValue?: boolean;\n /** The text shown and read out for the value, e.g. \"3 of 8 stages\". Defaults to a percentage. */\n valueLabel?: string;\n /** sm is 4px, for a pipeline bar; md is 8px.\n * @default \"sm\" */\n size?: \"sm\" | \"md\";\n /** @default \"primary\" */\n tone?: ProgressTone;\n \"aria-label\"?: string;\n className?: string;\n}\n\n/** How far a task has got: a thin bar, or a sliding segment when the length isn't known. */\nexport function ProgressBar({\n value,\n max = 100,\n label,\n showValue = true,\n valueLabel,\n size = \"sm\",\n tone = \"primary\",\n \"aria-label\": ariaLabel,\n className,\n}: ProgressBarProps) {\n const labelId = useId();\n const indeterminate = value === undefined;\n const pct = indeterminate ? 0 : Math.min(100, Math.max(0, (value / max) * 100));\n const text = valueLabel ?? `${Math.round(pct)}%`;\n return (\n <div className={cx(\"ow-progress\", `ow-progress--${size}`, `ow-progress--${tone}`, className)}>\n {label || (showValue && !indeterminate) ? (\n <div className=\"ow-progress__header\">\n {label ? (\n <span id={labelId} className=\"ow-progress__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue && !indeterminate ? <span className=\"ow-progress__value\">{text}</span> : null}\n </div>\n ) : null}\n <div\n role=\"progressbar\"\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : ariaLabel}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={indeterminate ? undefined : value}\n aria-valuetext={indeterminate ? undefined : text}\n className={cx(\"ow-progress__track\", indeterminate && \"ow-progress__track--indeterminate\")}\n >\n <div className=\"ow-progress__fill\" style={indeterminate ? undefined : { width: `${pct}%` }} />\n </div>\n </div>\n );\n}\n\nexport interface ProgressCircleProps {\n /** From 0 to max. Leave out to spin, for work of unknown length. */\n value?: number;\n /** @default 100 */\n max?: number;\n /** sm 16px, md 24px, lg 48px (lg shows the percentage inside).\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"primary\" */\n tone?: ProgressTone;\n /** Names it for screen readers.\n * @default \"Progress\" */\n \"aria-label\"?: string;\n className?: string;\n}\n\nconst circleSizes = { sm: { box: 16, stroke: 2.5 }, md: { box: 24, stroke: 3 }, lg: { box: 48, stroke: 4 } };\n\n/** Progress as a ring, for tight spaces: a row in a list, a file being uploaded. */\nexport function ProgressCircle({\n value,\n max = 100,\n size = \"md\",\n tone = \"primary\",\n \"aria-label\": ariaLabel = \"Progress\",\n className,\n}: ProgressCircleProps) {\n const { box, stroke } = circleSizes[size];\n const radius = (box - stroke) / 2;\n const circumference = 2 * Math.PI * radius;\n const indeterminate = value === undefined;\n const pct = indeterminate ? 25 : Math.min(100, Math.max(0, (value / max) * 100));\n return (\n <span\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={indeterminate ? undefined : value}\n className={cx(\n \"ow-progress-circle\",\n `ow-progress--${tone}`,\n indeterminate && \"ow-progress-circle--indeterminate\",\n className,\n )}\n style={{ width: box, height: box } as CSSProperties}\n >\n <svg width={box} height={box} viewBox={`0 0 ${box} ${box}`} aria-hidden=\"true\">\n <circle className=\"ow-progress-circle__track\" cx={box / 2} cy={box / 2} r={radius} strokeWidth={stroke} fill=\"none\" />\n <circle\n className=\"ow-progress-circle__fill\"\n cx={box / 2}\n cy={box / 2}\n r={radius}\n strokeWidth={stroke}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={circumference * (1 - pct / 100)}\n transform={`rotate(-90 ${box / 2} ${box / 2})`}\n />\n </svg>\n {size === \"lg\" && !indeterminate ? <span className=\"ow-progress-circle__value\">{Math.round(pct)}%</span> : null}\n </span>\n );\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport type { ProgressTone } from \"../Progress/Progress\";\n\nexport interface MeterProps {\n /** The amount measured, from min to max. */\n value: number;\n /** @default 0 */\n min?: number;\n /** @default 100 */\n max?: number;\n /** Shown above the bar, and names it for screen readers. */\n label?: ReactNode;\n /** Shows the value label at the right of the label.\n * @default true */\n showValue?: boolean;\n /**\n * The text shown and read out for the value: a string (\"Strong\"), or a function given the value, min and max\n * formatted with `formatOptions`, such as `({ value, max }) => \\`${value} of ${max}\\``. Defaults to the formatted value.\n */\n valueLabel?: string | ((formatted: { value: string; min: string; max: string }) => string);\n /**\n * How the value is written, as Intl.NumberFormat options. The percent style shows where the value sits in the range;\n * any other formats the value itself, such as `{ style: \"unit\", unit: \"gigabyte\" }`.\n * @default { style: \"percent\" }\n */\n formatOptions?: Intl.NumberFormatOptions;\n /** The locale numbers are written in, such as \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** The fill's colour. Leave it out to work it out from `low`, `high` and `optimum`; with none of those, it's primary. */\n tone?: ProgressTone;\n /** Values below this are in the low range, as on the meter element.\n * @default min */\n low?: number;\n /** Values above this are in the high range.\n * @default max */\n high?: number;\n /**\n * The best value. The range it's in is good (success), the middle range otherwise middling (warning), and the range\n * at the far end bad (danger). With optimum between low and high, both outer ranges are middling.\n * @default halfway between min and max\n */\n optimum?: number;\n /** sm is 4px; md is 8px.\n * @default \"sm\" */\n size?: \"sm\" | \"md\";\n /** Draws the bar as this many separate blocks, such as 4 for a password's strength. */\n segments?: number;\n id?: string;\n /** Names the meter for screen readers when there's no `label`. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n className?: string;\n}\n\nconst clamp = (value: number, low: number, high: number) => Math.min(high, Math.max(low, value));\n\n/** The meter element's gauge regions: the optimum's region is good, its neighbour middling, the far one bad. */\nfunction toneOf(value: number, min: number, max: number, low = min, high = max, optimum = (min + max) / 2): ProgressTone {\n const lowEdge = clamp(low, min, max);\n const highEdge = clamp(high, lowEdge, max);\n const best = clamp(optimum, min, max);\n const region = value < lowEdge ? 0 : value > highEdge ? 2 : 1;\n const bestRegion = best < lowEdge ? 0 : best > highEdge ? 2 : 1;\n const distance = Math.abs(region - bestRegion);\n return distance === 0 ? \"success\" : distance === 1 ? \"warning\" : \"danger\";\n}\n\n/**\n * An amount within a known range: storage used, runs against a plan's limit, a password's strength. Unlike ProgressBar,\n * it doesn't mean something will finish.\n */\nexport function Meter({\n value,\n min = 0,\n max = 100,\n label,\n showValue = true,\n valueLabel,\n formatOptions = { style: \"percent\" },\n locale,\n tone,\n low,\n high,\n optimum,\n size = \"sm\",\n segments,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n}: MeterProps) {\n const labelId = useId();\n const current = clamp(value, min, Math.max(min, max));\n const fraction = max > min ? (current - min) / (max - min) : 0;\n\n const formatter = new Intl.NumberFormat(locale, formatOptions);\n const asPercent = formatOptions.style === \"percent\";\n const formatted = {\n value: formatter.format(asPercent ? fraction : current),\n min: formatter.format(asPercent ? 0 : min),\n max: formatter.format(asPercent ? 1 : max),\n };\n const text = typeof valueLabel === \"function\" ? valueLabel(formatted) : (valueLabel ?? formatted.value);\n\n const hasThresholds = low !== undefined || high !== undefined || optimum !== undefined;\n const resolvedTone = tone ?? (hasThresholds ? toneOf(current, min, max, low, high, optimum) : \"primary\");\n const blocks = segments && segments > 1 ? Math.round(segments) : 0;\n\n return (\n <div className={cx(\"ow-meter\", `ow-meter--${size}`, `ow-meter--${resolvedTone}`, className)}>\n {label || showValue ? (\n <div className=\"ow-meter__header\">\n {label ? (\n <span id={labelId} className=\"ow-meter__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? <span className=\"ow-meter__value\">{text}</span> : null}\n </div>\n ) : null}\n <div\n id={id}\n role=\"meter\"\n aria-labelledby={ariaLabelledBy ?? (label ? labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : ariaLabel}\n aria-describedby={ariaDescribedBy}\n aria-valuenow={current}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={text}\n className={cx(\"ow-meter__track\", blocks > 0 && \"ow-meter__track--segmented\")}\n >\n {blocks > 0 ? (\n Array.from({ length: blocks }, (_, index) => (\n <span key={index} className=\"ow-meter__segment\">\n <span className=\"ow-meter__fill\" style={{ width: `${clamp(fraction * blocks - index, 0, 1) * 100}%` }} />\n </span>\n ))\n ) : (\n <span className=\"ow-meter__fill\" style={{ width: `${fraction * 100}%` }} />\n )}\n </div>\n </div>\n );\n}\n", "import { useEffect, useState, type CSSProperties } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface SkeletonProps {\n /** CSS width, e.g. \"40%\" or 120. Default 100%. */\n width?: CSSProperties[\"width\"];\n /** CSS height. Default 14px. */\n height?: CSSProperties[\"height\"];\n /** The lighter grey, for second lines and control shapes. */\n soft?: boolean;\n /** `bar` has round ends; `block` has the field corners, for control placeholders. */\n shape?: \"bar\" | \"block\";\n className?: string;\n}\n\n/** One grey placeholder bar. Wrap a group of them in something with role=\"status\" and a label. */\nexport function Skeleton({ width = \"100%\", height = 14, soft = false, shape = \"bar\", className }: SkeletonProps) {\n return (\n <span\n className={cx(\"ow-skeleton\", soft && \"ow-skeleton--soft\", shape === \"block\" && \"ow-skeleton--block\", className)}\n style={{ width, height }}\n aria-hidden=\"true\"\n />\n );\n}\n\nexport interface SkeletonRowsProps {\n /** Read out by screen readers while it's showing. Default \"Loading\". */\n label?: string;\n rows?: number;\n /** Waits this long before appearing, so content that loads quickly never flashes it. Default 150. */\n delayMs?: number;\n}\n\n/**\n * A placeholder in the shape of settings rows (a label and description on the left, a control on the right),\n * so a panel keeps its layout while it loads.\n */\nexport function SkeletonRows({ label = \"Loading\", rows = 4, delayMs = 150 }: SkeletonRowsProps) {\n const [isVisible, setIsVisible] = useState(delayMs === 0);\n\n useEffect(() => {\n if (delayMs === 0) return;\n const timer = window.setTimeout(() => setIsVisible(true), delayMs);\n return () => window.clearTimeout(timer);\n }, [delayMs]);\n\n return (\n <div role=\"status\" aria-label={label} aria-busy=\"true\">\n {isVisible ? (\n <div className=\"ow-skeleton-rows\" aria-hidden=\"true\">\n {Array.from({ length: rows }, (_, index) => (\n <div key={index} className=\"ow-skeleton-rows__row\">\n <div className=\"ow-skeleton-rows__text\">\n <Skeleton width={`${28 + ((index * 17) % 22)}%`} height={14} />\n <Skeleton width={`${46 + ((index * 23) % 30)}%`} height={12} soft />\n </div>\n <Skeleton width={96} height={32} soft shape=\"block\" />\n </div>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n", "import { useEffect, useRef } from \"react\";\nimport { Toaster as SonnerToaster, toast, type ExternalToast, type ToasterProps as SonnerToasterProps } from \"sonner\";\n\nimport { manualPopover } from \"../../hooks/useFloating\";\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\n/**\n * Shows a toast; needs one <Toaster /> on the page. This is sonner's `toast`:\n * `toast(\"Copied\")`, `toast.success(\"Saved\", { description })`, `toast.error(\u2026)`, `toast.warning(\u2026)`, `toast.info(\u2026)`,\n * `toast.loading(\"Deploying\u2026\")`, `toast.promise(save(), { loading, success, error })`, `toast.dismiss(id)`.\n * Pass `action: { label: \"Undo\", onClick }` for a button, and reuse an `id` to replace a toast.\n */\nexport { toast };\n\n/** Everything a toast takes besides its message: description, action, cancel, id, duration, icon, onDismiss\u2026 */\nexport type ToastOptions = ExternalToast;\n\nexport interface ToasterProps {\n /** @default \"bottom-center\" */\n position?: SonnerToasterProps[\"position\"];\n /** Shows every toast in full, instead of a stack that fans out on hover.\n * @default false */\n expand?: boolean;\n /** How many show at once; the rest wait their turn.\n * @default 3 */\n visibleToasts?: number;\n /** Milliseconds before a toast goes. A toast's own `duration` wins; Infinity keeps it until closed.\n * @default 6000 */\n duration?: number;\n /** A \u2715 on each toast.\n * @default true */\n closeButton?: boolean;\n /** Distance from the edge of the window, in pixels.\n * @default 16 */\n offset?: number;\n /** Gap between toasts when the stack is open, in pixels.\n * @default 10 */\n gap?: number;\n /** For a second toaster that only shows toasts sent with the same `toasterId`. */\n id?: string;\n className?: string;\n}\n\nconst icons = {\n success: <CircleCheckIcon size={16} />,\n error: <CircleAlertIcon size={16} />,\n warning: <TriangleAlertIcon size={16} />,\n info: <InfoIcon size={16} />,\n loading: <Spinner size=\"sm\" label=\"\" />,\n close: <XIcon size={12} />,\n};\n\n/**\n * Where toasts appear: sonner's toaster in Openware's look. New toasts stack on top of each other; hovering\n * fans the stack out, a swipe dismisses one, and they pause while hovered or focused. Render one near the\n * root of the app. It keeps itself above modal dialogs, so a toast fired from a dialog shows over it.\n */\nexport function Toaster({\n position = \"bottom-center\",\n expand = false,\n visibleToasts = 3,\n duration = 6000,\n closeButton = true,\n offset = 16,\n gap = 10,\n id,\n className,\n}: ToasterProps) {\n const layerRef = useRef<HTMLDivElement>(null);\n\n // The toaster lives in the browser's top layer, and moves back to the top of it whenever a dialog opens,\n // so modal dialogs and their backdrop never cover it.\n useEffect(() => {\n const layer = layerRef.current;\n if (!layer || typeof layer.showPopover !== \"function\") return undefined;\n const raise = () => {\n try {\n if (layer.matches(\":popover-open\")) layer.hidePopover();\n layer.showPopover();\n } catch {\n // Not connected yet, or no popover support: it still shows as a fixed layer.\n }\n };\n raise();\n const observer = new MutationObserver((records) => {\n if (records.some((record) => record.target instanceof HTMLDialogElement && record.target.open)) raise();\n });\n observer.observe(document.body, { subtree: true, attributes: true, attributeFilter: [\"open\"] });\n return () => observer.disconnect();\n }, []);\n\n return (\n <div ref={layerRef} {...manualPopover} className=\"ow-toaster-layer\">\n <SonnerToaster\n id={id}\n position={position}\n expand={expand}\n visibleToasts={visibleToasts}\n duration={duration}\n closeButton={closeButton}\n offset={offset}\n mobileOffset={offset}\n gap={gap}\n icons={icons}\n className={cx(\"ow-toaster\", className)}\n containerAriaLabel=\"Notifications\"\n toastOptions={{ className: \"ow-toast\" }}\n />\n </div>\n );\n}\n", "import { useId, useState, type FormEvent, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { TrashIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface DialogProps {\n open: boolean;\n /** Called when the person dismisses it (Escape, the backdrop) unless `dismissible` is false. Set `open` to false here. */\n onClose(): void;\n title: ReactNode;\n /** A muted line or two under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Buttons at the bottom right, cancel first, the main action last. */\n actions?: ReactNode;\n /** Pixels. Default 420. */\n width?: number;\n /** False while saving, so Escape and the backdrop can't close it mid-way. Default true. */\n dismissible?: boolean;\n /** Makes the dialog a form; its submit button submits it. */\n onSubmit?(event: FormEvent<HTMLFormElement>): void;\n className?: string;\n}\n\n/**\n * A modal dialog on the native <dialog> element: it traps focus, sits above everything, closes with Escape\n * or a click on the backdrop, and fades and rises in.\n */\nexport function Dialog({\n open,\n onClose,\n title,\n description,\n children,\n actions,\n width = 420,\n dismissible = true,\n onSubmit,\n className,\n}: DialogProps) {\n const titleId = useId();\n const descriptionId = useId();\n const { dialogRef, mounted } = useModalDialog(open, () => {\n if (dismissible) onClose();\n });\n\n if (!mounted) return null;\n\n const body = (\n <>\n <div className=\"ow-dialog__header\">\n <h2 id={titleId} className=\"ow-dialog__title\">\n {title}\n </h2>\n {description ? (\n <div id={descriptionId} className=\"ow-dialog__description\">\n {description}\n </div>\n ) : null}\n </div>\n {children}\n {actions ? <div className=\"ow-dialog__actions\">{actions}</div> : null}\n </>\n );\n\n return (\n <dialog\n ref={dialogRef}\n className={cx(\"ow-dialog\", className)}\n style={{ width: `min(${width}px, calc(100% - 32px))` }}\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n >\n {onSubmit ? (\n <form\n className=\"ow-dialog__body\"\n onSubmit={(event) => {\n event.preventDefault();\n onSubmit(event);\n }}\n >\n {body}\n </form>\n ) : (\n <div className=\"ow-dialog__body\">{body}</div>\n )}\n </dialog>\n );\n}\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onClose(): void;\n title: ReactNode;\n description: ReactNode;\n /** The verb on the confirm button: \"Delete project\", not \"OK\". */\n confirmLabel: string;\n /** Styles the confirm button and icon as a destructive action. */\n destructive?: boolean;\n /** Keeps the confirm button disabled, e.g. until a typed confirmation matches. */\n confirmDisabled?: boolean;\n /** Runs the action. The dialog closes when it resolves and shows the error's message when it throws. */\n onConfirm(): Promise<void> | void;\n /** Extra content between the description and the buttons, such as an option checkbox. */\n children?: ReactNode;\n}\n\n/** Asks before an action: a title, what will happen, Cancel and the action. Cancel has focus first. */\nexport function ConfirmDialog({\n open,\n onClose,\n title,\n description,\n confirmLabel,\n destructive = false,\n confirmDisabled = false,\n onConfirm,\n children,\n}: ConfirmDialogProps) {\n const [isWorking, setIsWorking] = useState(false);\n const [error, setError] = useState(\"\");\n\n async function confirm() {\n setIsWorking(true);\n setError(\"\");\n try {\n await onConfirm();\n onClose();\n } catch (confirmError) {\n setError(\n confirmError instanceof Error && confirmError.message\n ? confirmError.message\n : \"That didn't work. Try again.\",\n );\n } finally {\n setIsWorking(false);\n }\n }\n\n return (\n <Dialog\n open={open}\n onClose={onClose}\n dismissible={!isWorking}\n width={380}\n className=\"ow-dialog--confirm\"\n title={\n <>\n {destructive ? (\n <span className=\"ow-dialog__danger-icon\" aria-hidden=\"true\">\n <TrashIcon size={18} />\n </span>\n ) : null}\n {title}\n </>\n }\n description={description}\n onSubmit={() => {\n if (!confirmDisabled && !isWorking) void confirm();\n }}\n actions={\n <>\n <Button type=\"button\" disabled={isWorking} autoFocus onClick={onClose}>\n Cancel\n </Button>\n <Button\n type=\"submit\"\n variant={destructive ? \"danger\" : \"primary\"}\n disabled={isWorking || confirmDisabled}\n >\n {isWorking ? \"Working\u2026\" : confirmLabel}\n </Button>\n </>\n }\n >\n {children}\n {error ? (\n <span role=\"alert\" className=\"ow-dialog__error\">\n {error}\n </span>\n ) : null}\n </Dialog>\n );\n}\n", "import { useEffect, useRef, useState } from \"react\";\n\n/** Matches the dialog exit transition in dialog.css. */\nconst closeAnimationMs = 160;\n\n/**\n * Shows a <dialog> as a modal while `open` is true, and keeps it mounted long enough for its exit animation\n * once `open` turns false. Escape and a click on the backdrop fire the dialog's `cancel` event; the hook turns\n * that into `onCancel`, so a dialog that must stay open while it works can ignore it.\n */\nexport function useModalDialog(open: boolean, onCancel: () => void) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const onCancelRef = useRef(onCancel);\n const [mounted, setMounted] = useState(open);\n\n onCancelRef.current = onCancel;\n\n useEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open) {\n if (!dialog.open) dialog.showModal();\n return;\n }\n\n if (dialog.open) dialog.close();\n const reduceMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n const timer = window.setTimeout(() => setMounted(false), reduceMotion ? 0 : closeAnimationMs);\n return () => window.clearTimeout(timer);\n }, [open, mounted]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || !mounted) return;\n\n const onCancelEvent = (event: Event) => {\n event.preventDefault();\n onCancelRef.current();\n };\n\n // A click on the backdrop (outside the dialog's box) counts as Escape. Both the press and the release\n // must be outside, so selecting text and dragging out doesn't close it.\n const isOutside = (event: MouseEvent) => {\n const rect = dialog.getBoundingClientRect();\n return (\n event.clientX < rect.left ||\n event.clientX > rect.right ||\n event.clientY < rect.top ||\n event.clientY > rect.bottom\n );\n };\n let pressedOutside = false;\n const onPointerDown = (event: PointerEvent) => {\n pressedOutside = event.target === dialog && isOutside(event);\n };\n const onClick = (event: MouseEvent) => {\n if (\n pressedOutside &&\n event.target === dialog &&\n isOutside(event) &&\n // Clicks from the keyboard (Enter on a button) report 0,0.\n event.detail > 0\n )\n dialog.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\n pressedOutside = false;\n };\n\n dialog.addEventListener(\"cancel\", onCancelEvent);\n dialog.addEventListener(\"pointerdown\", onPointerDown);\n dialog.addEventListener(\"click\", onClick);\n return () => {\n dialog.removeEventListener(\"cancel\", onCancelEvent);\n dialog.removeEventListener(\"pointerdown\", onPointerDown);\n dialog.removeEventListener(\"click\", onClick);\n };\n }, [mounted]);\n\n return { dialogRef, mounted };\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { cx } from \"../../utils/cx\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\n\nexport interface DrawerProps {\n open: boolean;\n /** Called on Escape, the backdrop or the \u2715, unless `dismissible` is false. Set `open` to false here. */\n onClose(): void;\n title: ReactNode;\n /** A muted line under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Buttons pinned to the bottom: Cancel first, the main action last. */\n footer?: ReactNode;\n /** Which edge it slides in from.\n * @default \"right\" */\n side?: \"right\" | \"left\" | \"bottom\";\n /** Width (or height, from the bottom) in pixels.\n * @default 420 */\n size?: number;\n /** @default true */\n dismissible?: boolean;\n className?: string;\n}\n\n/** A panel that slides in from an edge over the page, for details or a form beside what the person was doing. */\nexport function Drawer({\n open,\n onClose,\n title,\n description,\n children,\n footer,\n side = \"right\",\n size = 420,\n dismissible = true,\n className,\n}: DrawerProps) {\n const titleId = useId();\n const descriptionId = useId();\n const { dialogRef, mounted } = useModalDialog(open, () => {\n if (dismissible) onClose();\n });\n\n if (!mounted) return null;\n\n const sizeStyle = side === \"bottom\" ? { height: `min(${size}px, 90dvh)` } : { width: `min(${size}px, 100vw - 24px)` };\n\n return (\n <dialog\n ref={dialogRef}\n className={cx(\"ow-drawer\", `ow-drawer--${side}`, className)}\n style={sizeStyle}\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n >\n <header className=\"ow-drawer__header\">\n <div className=\"ow-drawer__titles\">\n <h2 id={titleId} className=\"ow-drawer__title\">\n {title}\n </h2>\n {description ? (\n <p id={descriptionId} className=\"ow-drawer__description\">\n {description}\n </p>\n ) : null}\n </div>\n {dismissible ? <CloseButton onClick={onClose} /> : null}\n </header>\n <div className=\"ow-drawer__body\">{children}</div>\n {footer ? <footer className=\"ow-drawer__footer\">{footer}</footer> : null}\n </dialog>\n );\n}\n", "import {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useId,\n useRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating, type Placement } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface PopoverProps {\n /** The button that opens it. Popover adds the click handler and aria attributes. */\n trigger: ReactElement;\n children: ReactNode;\n open?: boolean;\n /** @default false */\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /** Where it opens relative to the trigger; it flips when there's no room.\n * @default \"bottom-start\" */\n placement?: Placement;\n /** A heading at the top that also names the popover for screen readers. */\n title?: ReactNode;\n /** Names the popover when there's no title. */\n \"aria-label\"?: string;\n /** Pixels, or any CSS width.\n * @default 280 */\n width?: number | string;\n /** Moves focus into the popover when it opens.\n * @default true */\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A small panel attached to a button, for a few controls or details that don't need a dialog.\n * Escape, a click outside or the trigger closes it, and focus goes back to the trigger.\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen = false,\n onOpenChange,\n placement = \"bottom-start\",\n title,\n \"aria-label\": ariaLabel,\n width = 280,\n autoFocus = true,\n className,\n}: PopoverProps) {\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const triggerRef = useRef<HTMLElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const anchorRef = useRef<HTMLSpanElement>(null);\n const id = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef, floatingRef: panelRef, placement, offset: 8, maxHeight: 640 });\n\n const close = useCallback(\n (reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n },\n [setOpen],\n );\n useDismiss(isOpen, [panelRef, anchorRef], close);\n\n useEffect(() => {\n triggerRef.current = anchorRef.current?.firstElementChild as HTMLElement | null;\n });\n\n useEffect(() => {\n if (!isOpen || !autoFocus) return;\n const frame = requestAnimationFrame(() => {\n const panel = panelRef.current;\n // The first control Tab would reach: not one taken out of the tab order (a radio group's other options), a\n // hidden input or anything disabled, so a group lands on its chosen option.\n const first = panel?.querySelector<HTMLElement>(\n [\n 'input:not([type=\"hidden\"]):not([disabled]):not([tabindex=\"-1\"])',\n 'select:not([disabled]):not([tabindex=\"-1\"])',\n 'textarea:not([disabled]):not([tabindex=\"-1\"])',\n 'button:not([disabled]):not([tabindex=\"-1\"])',\n '[href]:not([tabindex=\"-1\"])',\n '[tabindex]:not([tabindex=\"-1\"])',\n ].join(\", \"),\n );\n (first ?? panel)?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [isOpen, autoFocus]);\n\n const triggerElement = isValidElement<HTMLAttributes<HTMLElement>>(trigger)\n ? cloneElement(trigger, {\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? id : undefined,\n onClick: (event: MouseEvent<HTMLElement>) => {\n trigger.props.onClick?.(event);\n if (!event.defaultPrevented) setOpen(!isOpen);\n },\n })\n : trigger;\n\n return (\n <>\n <span ref={anchorRef} className=\"ow-popover-anchor\">\n {triggerElement}\n </span>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={id}\n role=\"dialog\"\n aria-label={title ? undefined : ariaLabel}\n aria-labelledby={title ? `${id}-title` : undefined}\n tabIndex={-1}\n className={cx(\"ow-popover\", \"ow-floating\", className)}\n style={{ ...style, width }}\n // Focus leaving for anything but the trigger (Tab past the last control) closes it.\n onBlur={(event) => {\n const next = event.relatedTarget as Node | null;\n if (next && !panelRef.current?.contains(next) && !anchorRef.current?.contains(next)) setOpen(false);\n }}\n >\n {title ? (\n <div id={`${id}-title`} className=\"ow-popover__title\">\n {title}\n </div>\n ) : null}\n {children}\n </div>\n ) : null}\n </>\n );\n}\n", "import {\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { useMenuKeyboard } from \"../../hooks/useMenuKeyboard\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { cx } from \"../../utils/cx\";\n\nconst MenuContext = /* @__PURE__ */ createContext<{ close(): void } | null>(null);\n\nexport interface MenuProps {\n /** The button that opens it, usually a Button. Menu adds the click handler and the aria attributes. */\n trigger: ReactElement;\n /** MenuItem, MenuLabel and MenuSeparator. */\n children: ReactNode;\n /** Names the menu for screen readers. */\n label: string;\n /** Which edge of the trigger it lines up with.\n * @default \"start\" */\n align?: \"start\" | \"end\";\n /** Prefers opening upward. Either way it flips when there's no room.\n * @default false */\n above?: boolean;\n /** CSS width; default fits the items, at least 200px. */\n width?: number | string;\n /** Starts open, for documentation and tests. */\n defaultOpen?: boolean;\n className?: string;\n}\n\n/**\n * A dropdown menu of actions under a button. Opening it focuses the first item; the arrow keys, Home and End\n * move; Escape closes it and returns focus to the button; a click outside or Tab closes it.\n */\nexport function Menu({ trigger, children, label, align = \"start\", above = false, width, defaultOpen = false, className }: MenuProps) {\n const [open, setOpen] = useState(defaultOpen);\n const rootRef = useRef<HTMLSpanElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const menuId = useId();\n const close = () => setOpen(false);\n const onMenuKeyDown = useMenuKeyboard({ open, menuRef, triggerRef, onClose: close });\n const { mounted, state } = usePresence(open);\n const floatingStyle = useFloating({\n open: mounted,\n anchorRef: rootRef,\n floatingRef: menuRef,\n placement: `${above ? \"top\" : \"bottom\"}-${align}`,\n offset: 8,\n });\n\n useEffect(() => {\n triggerRef.current = rootRef.current?.firstElementChild as HTMLElement | null;\n });\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n if (!rootRef.current?.contains(event.target as Node)) setOpen(false);\n };\n document.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => document.removeEventListener(\"pointerdown\", onPointerDown, true);\n }, [open]);\n\n const triggerElement = isValidElement<ButtonHTMLAttributes<HTMLElement>>(trigger)\n ? cloneElement(trigger, {\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": open,\n \"aria-controls\": open ? menuId : undefined,\n onClick: (event: MouseEvent<HTMLElement>) => {\n trigger.props.onClick?.(event);\n if (!event.defaultPrevented) setOpen((current) => !current);\n },\n })\n : trigger;\n\n return (\n <span ref={rootRef} className=\"ow-menu\">\n {triggerElement}\n {mounted ? (\n <MenuContext.Provider\n value={{\n close() {\n setOpen(false);\n triggerRef.current?.focus();\n },\n }}\n >\n <div\n ref={menuRef}\n {...manualPopover}\n data-state={state}\n id={menuId}\n role=\"menu\"\n aria-label={label}\n className={cx(\"ow-menu__panel\", \"ow-floating\", className)}\n style={width === undefined ? floatingStyle : { ...floatingStyle, width }}\n onKeyDown={onMenuKeyDown}\n >\n {children}\n </div>\n </MenuContext.Provider>\n ) : null}\n </span>\n );\n}\n\nexport interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onSelect\"> {\n /** A 15px lucide-react icon before the label. */\n icon?: ReactNode;\n /** Runs the action; the menu then closes. */\n onSelect?(): void;\n /** Red, for actions that delete or can't be undone. */\n destructive?: boolean;\n /** Shown on the right, e.g. \"\u2318,\". Only a shortcut that actually works. */\n shortcut?: string;\n}\n\n/** One action in a Menu. */\nexport const MenuItem = /* @__PURE__ */ forwardRef<HTMLButtonElement, MenuItemProps>(function MenuItem(\n { icon, onSelect, destructive = false, shortcut, className, children, onClick, ...buttonProps },\n ref,\n) {\n const menu = useContext(MenuContext);\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n className={cx(\"ow-menu__item\", destructive && \"ow-menu__item--destructive\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n menu?.close();\n onSelect?.();\n }}\n {...buttonProps}\n >\n {icon ? <span className=\"ow-menu__icon\">{icon}</span> : null}\n <span className=\"ow-menu__label\">{children}</span>\n {shortcut ? <kbd className=\"ow-menu__shortcut\">{shortcut}</kbd> : null}\n </button>\n );\n});\n\n/** A small uppercase heading for a group of items. */\nexport function MenuLabel({ children }: { children: ReactNode }) {\n return (\n <div className=\"ow-menu__group-label\" role=\"presentation\">\n {children}\n </div>\n );\n}\n\n/** A hairline between groups of items. */\nexport function MenuSeparator() {\n return <div className=\"ow-menu__separator\" role=\"separator\" />;\n}\n", "import { useEffect, type KeyboardEvent, type RefObject } from \"react\";\n\nconst itemSelector =\n '[role=\"menuitem\"]:not([disabled]):not([aria-disabled=\"true\"]), [role=\"menuitemradio\"]:not([disabled]), [role=\"menuitemcheckbox\"]:not([disabled])';\n\nfunction items(menu: HTMLElement | null): HTMLElement[] {\n return menu ? [...menu.querySelectorAll<HTMLElement>(itemSelector)] : [];\n}\n\n/**\n * Keyboard use for a `role=\"menu\"` popup, as people expect from menus: opening it moves focus to its first item,\n * the arrow keys (and Home and End) move between items, wrapping round, and Escape closes it and puts focus\n * back on the button that opened it. Attach the returned handler to the menu's `onKeyDown`.\n */\nexport function useMenuKeyboard({\n open,\n menuRef,\n triggerRef,\n onClose,\n}: {\n open: boolean;\n menuRef: RefObject<HTMLElement | null>;\n triggerRef?: RefObject<HTMLElement | null> | undefined;\n onClose(): void;\n}): (event: KeyboardEvent<HTMLElement>) => void {\n useEffect(() => {\n if (!open) return;\n const frame = window.requestAnimationFrame(() => {\n const menu = menuRef.current;\n // Something inside already has focus (e.g. a field at the top of the menu): leave it there.\n if (menu?.contains(document.activeElement)) return;\n items(menu)[0]?.focus();\n });\n return () => window.cancelAnimationFrame(frame);\n }, [open, menuRef]);\n\n return (event) => {\n const list = items(menuRef.current);\n const index = list.indexOf(document.activeElement as HTMLElement);\n const move = (next: number) => {\n event.preventDefault();\n list[(next + list.length) % list.length]?.focus();\n };\n switch (event.key) {\n case \"ArrowDown\":\n move(index + 1);\n break;\n case \"ArrowUp\":\n move(index < 0 ? list.length - 1 : index - 1);\n break;\n case \"Home\":\n move(0);\n break;\n case \"End\":\n move(list.length - 1);\n break;\n case \"Escape\":\n event.preventDefault();\n event.stopPropagation();\n onClose();\n triggerRef?.current?.focus();\n break;\n case \"Tab\":\n // Leaving the menu closes it; focus moves on as usual.\n onClose();\n break;\n }\n };\n}\n", "import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { CornerDownLeftIcon, SearchIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { filterCommands } from \"./filterCommands\";\n\nexport interface Command {\n /** Unique in the list, e.g. \"project.new\". */\n id: string;\n title: string;\n /** Commands with the same group are listed together under its name (when nothing is typed). */\n group?: string;\n icon?: ReactNode;\n /** Extra words that should find this command, e.g. \"start go\" for Run. */\n keywords?: string;\n /** Shown on the right, e.g. a folder or \"Running\". */\n hint?: string;\n /** Shortcut shown on the right, e.g. \"\u2318,\". */\n shortcut?: string;\n /** Why it can't run right now; the command still shows, greyed out, with this as its hint. */\n disabled?: string;\n run(): void;\n}\n\nexport interface CommandPaletteProps {\n open: boolean;\n onClose(): void;\n commands: Command[];\n /** Default \"Search commands\u2026\". */\n placeholder?: string;\n}\n\n/** \u2318K: search every action and run it from the keyboard. Arrow keys (or Ctrl+N and Ctrl+P) move, Enter runs. */\nexport function CommandPalette({ open, onClose, commands, placeholder = \"Search commands\u2026\" }: CommandPaletteProps) {\n const { dialogRef, mounted } = useModalDialog(open, onClose);\n const [query, setQuery] = useState(\"\");\n const [activeIndex, setActiveIndex] = useState(0);\n const listRef = useRef<HTMLUListElement>(null);\n const listId = useId();\n const results = useMemo(() => filterCommands(commands, query), [commands, query]);\n const active = results[Math.min(activeIndex, results.length - 1)];\n\n useEffect(() => setActiveIndex(0), [query]);\n useEffect(() => {\n if (open) setQuery(\"\");\n }, [open]);\n useEffect(() => {\n listRef.current?.querySelector(\"[aria-selected=true]\")?.scrollIntoView({ block: \"nearest\" });\n }, [activeIndex, results]);\n\n if (!mounted) return null;\n\n function run(command: Command | undefined) {\n if (!command || command.disabled) return;\n onClose();\n // After the palette has closed, so dialogs the command opens get focus.\n window.setTimeout(() => command.run(), 0);\n }\n\n function move(step: number) {\n if (!results.length) return;\n setActiveIndex((index) => (Math.min(index, results.length - 1) + step + results.length) % results.length);\n }\n\n return (\n <dialog ref={dialogRef} className=\"ow-dialog ow-palette\" aria-label=\"Command palette\">\n <div className=\"ow-palette__search\">\n <SearchIcon size={16} className=\"ow-palette__search-icon\" />\n <input\n autoFocus\n className=\"ow-palette__input\"\n placeholder={placeholder}\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-activedescendant={active ? `${listId}-${active.id}` : undefined}\n aria-autocomplete=\"list\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" || (event.ctrlKey && event.key === \"n\")) {\n event.preventDefault();\n move(1);\n } else if (event.key === \"ArrowUp\" || (event.ctrlKey && event.key === \"p\")) {\n event.preventDefault();\n move(-1);\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n run(active);\n }\n }}\n />\n <kbd className=\"ow-palette__esc\">esc</kbd>\n </div>\n <ul ref={listRef} id={listId} role=\"listbox\" aria-label=\"Commands\" className=\"ow-palette__list\">\n {results.length ? (\n results.map((command, index) => {\n const showGroup =\n !query.trim() && command.group && command.group !== results[index - 1]?.group;\n const isActive = command === active;\n return (\n <li key={command.id} role=\"presentation\">\n {showGroup ? <div className=\"ow-palette__group\">{command.group}</div> : null}\n <div\n id={`${listId}-${command.id}`}\n role=\"option\"\n aria-selected={isActive}\n aria-disabled={Boolean(command.disabled)}\n title={command.disabled}\n className={cx(\"ow-palette__option\", {\n \"ow-palette__option--active\": isActive,\n \"ow-palette__option--disabled\": Boolean(command.disabled),\n })}\n onMouseMove={() => setActiveIndex(index)}\n onClick={() => run(command)}\n >\n <span className=\"ow-palette__icon\" aria-hidden=\"true\">\n {command.icon}\n </span>\n <span className=\"ow-palette__title\">{command.title}</span>\n {command.disabled && isActive ? (\n <span className=\"ow-palette__hint\">{command.disabled}</span>\n ) : command.hint ? (\n <span className=\"ow-palette__hint\">{command.hint}</span>\n ) : null}\n {command.shortcut ? (\n <kbd className=\"ow-palette__shortcut\">{command.shortcut}</kbd>\n ) : null}\n {isActive && !command.disabled ? (\n <CornerDownLeftIcon size={13} className=\"ow-palette__enter\" />\n ) : null}\n </div>\n </li>\n );\n })\n ) : (\n <li className=\"ow-palette__empty\">No commands match “{query}”.</li>\n )}\n </ul>\n </dialog>\n );\n}\n", "import type { Command } from \"./CommandPalette\";\n\n/** How well a query matches some text: prefix and word-start matches beat letters in order; 0 = no match. */\nfunction score(query: string, text: string, loose = true): number {\n const haystack = text.toLowerCase();\n if (haystack.startsWith(query)) return 100 - Math.min(haystack.length, 50) / 10;\n const wordStart = haystack.indexOf(` ${query}`);\n if (wordStart >= 0) return 80 - wordStart / 10;\n const anywhere = haystack.indexOf(query);\n if (anywhere >= 0) return 60 - anywhere / 10;\n if (!loose) return 0;\n // Letters in order (\"rnp\" \u2192 \"Run pipeline\"), only against titles: in long keyword text almost anything matches.\n let position = 0;\n let gaps = 0;\n for (const letter of query) {\n const found = haystack.indexOf(letter, position);\n if (found < 0) return 0;\n gaps += found - position;\n position = found + 1;\n }\n return Math.max(1, 40 - gaps);\n}\n\n/** Commands matching every word of the query, best first; with no query, the list as given. */\nexport function filterCommands(commands: Command[], query: string): Command[] {\n const words = query.trim().toLowerCase().split(/\\s+/).filter(Boolean);\n if (!words.length) return commands;\n return commands\n .map((command, index) => {\n const extra = `${command.group ?? \"\"} ${command.keywords ?? \"\"} ${command.hint ?? \"\"}`;\n let total = 0;\n for (const word of words) {\n const best = Math.max(score(word, command.title) * 1.5, score(word, extra, false));\n if (!best) return undefined;\n total += best;\n }\n // Runnable commands first, then the original order among equals.\n return { command, rank: total - (command.disabled ? 50 : 0) - index / 1000 };\n })\n .filter((entry): entry is { command: Command; rank: number } => Boolean(entry))\n .sort((a, b) => b.rank - a.rank)\n .map((entry) => entry.command);\n}\n", "import {\n createContext,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { useIndicator } from \"../../hooks/useIndicator\";\nimport { cx } from \"../../utils/cx\";\n\ninterface TabsContextValue {\n value: string;\n select(value: string): void;\n baseId: string;\n variant: \"segmented\" | \"line\";\n}\n\nconst TabsContext = /* @__PURE__ */ createContext<TabsContextValue | null>(null);\n\nfunction useTabs(component: string) {\n const context = useContext(TabsContext);\n if (!context) throw new Error(`${component} must be inside <Tabs>.`);\n return context;\n}\n\nconst idPart = (value: string) => value.replace(/[^\\w-]/g, \"_\");\n\nexport interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /** The selected tab's value. Leave out to let Tabs keep its own state. */\n value?: string;\n /** The tab selected first when uncontrolled. */\n defaultValue?: string;\n onValueChange?(value: string): void;\n /** `segmented` raises the chosen tab in a well; `line` underlines it.\n * @default \"segmented\" */\n variant?: \"segmented\" | \"line\";\n children: ReactNode;\n}\n\n/** Views of the same thing, one at a time: TabList with Tabs, then a TabPanel for each. */\nexport function Tabs({ value, defaultValue = \"\", onValueChange, variant = \"segmented\", className, children, ...props }: TabsProps) {\n const [current, select] = useControllableState(value, defaultValue, onValueChange);\n const baseId = useId();\n return (\n <TabsContext.Provider value={{ value: current, select, baseId, variant }}>\n <div className={cx(\"ow-tabs\", `ow-tabs--${variant}`, className)} {...props}>\n {children}\n </div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the set of tabs for screen readers. */\n \"aria-label\"?: string;\n}\n\n/** The row of tabs. The arrow keys, Home and End move between them and select. */\nexport function TabList({ className, onKeyDown, children, ...props }: TabListProps) {\n const { value, select } = useTabs(\"TabList\");\n const listRef = useRef<HTMLDivElement>(null);\n useIndicator(listRef, '[role=\"tab\"][aria-selected=\"true\"]', value);\n\n // No tab matches the value (no defaultValue given): select the first one.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!list || list.querySelector('[role=\"tab\"][aria-selected=\"true\"]')) return;\n const first = list.querySelector<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)');\n if (first?.dataset.value) select(first.dataset.value);\n }, [value, select]);\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index < 0) return;\n const moves: Record<string, number> = { ArrowRight: index + 1, ArrowLeft: index - 1, Home: 0, End: tabs.length - 1 };\n if (!(event.key in moves)) return;\n event.preventDefault();\n const next = tabs[(moves[event.key]! + tabs.length) % tabs.length]!;\n next.focus();\n if (next.dataset.value) select(next.dataset.value);\n }\n\n return (\n <div ref={listRef} role=\"tablist\" className={cx(\"ow-tabs__list\", className)} onKeyDown={handleKeyDown} {...props}>\n {children}\n <span className=\"ow-indicator\" aria-hidden=\"true\" />\n </div>\n );\n}\n\nexport interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"value\"> {\n value: string;\n /** A 16px icon before the label. */\n icon?: ReactNode;\n}\n\n/** One tab. Its `value` matches a TabPanel's. */\nexport function Tab({ value, icon, className, children, onClick, ...props }: TabProps) {\n const { value: current, select, baseId } = useTabs(\"Tab\");\n const selected = current === value;\n return (\n <button\n type=\"button\"\n role=\"tab\"\n id={`${baseId}-tab-${idPart(value)}`}\n aria-selected={selected}\n aria-controls={`${baseId}-panel-${idPart(value)}`}\n tabIndex={selected ? 0 : -1}\n data-value={value}\n className={cx(\"ow-tab\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) select(value);\n }}\n {...props}\n >\n {icon ? <span className=\"ow-tab__icon\">{icon}</span> : null}\n {children}\n </button>\n );\n}\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n value: string;\n /** Keep the panel in the page while hidden, so its state survives switching tabs.\n * @default false */\n keepMounted?: boolean;\n}\n\n/** The content for one tab. */\nexport function TabPanel({ value, keepMounted = false, className, children, ...props }: TabPanelProps) {\n const { value: current, baseId } = useTabs(\"TabPanel\");\n const selected = current === value;\n if (!selected && !keepMounted) return null;\n return (\n <div\n role=\"tabpanel\"\n id={`${baseId}-panel-${idPart(value)}`}\n aria-labelledby={`${baseId}-tab-${idPart(value)}`}\n tabIndex={0}\n hidden={!selected}\n className={cx(\"ow-tabs__panel\", className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n", "import {\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\ninterface DisclosureViewProps {\n open: boolean;\n onToggle(): void;\n title: ReactNode;\n subtitle?: ReactNode;\n icon?: ReactNode;\n actions?: ReactNode;\n headingLevel: 2 | 3 | 4 | 5 | 6;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n item?: boolean;\n}\n\nfunction DisclosureView({\n open,\n onToggle,\n title,\n subtitle,\n icon,\n actions,\n headingLevel,\n disabled,\n children,\n className,\n item,\n}: DisclosureViewProps) {\n const id = useId();\n const panelRef = useRef<HTMLDivElement>(null);\n const Heading = `h${headingLevel}` as \"h3\";\n\n // Closed content can't be tabbed into or read out.\n useEffect(() => {\n if (panelRef.current) panelRef.current.inert = !open;\n }, [open]);\n\n return (\n <div className={cx(item ? \"ow-accordion__item\" : \"ow-disclosure\", className)} data-open={open}>\n <div className=\"ow-disclosure__header\">\n <Heading className=\"ow-disclosure__heading\">\n <button\n type=\"button\"\n id={`${id}-trigger`}\n className=\"ow-disclosure__trigger\"\n aria-expanded={open}\n aria-controls={`${id}-panel`}\n disabled={disabled}\n data-accordion-trigger={item ? \"\" : undefined}\n onClick={onToggle}\n >\n <ChevronRightIcon size={14} className=\"ow-disclosure__chevron\" />\n {icon ? <span className=\"ow-disclosure__icon\">{icon}</span> : null}\n <span className=\"ow-disclosure__titles\">\n <span className=\"ow-disclosure__title\">{title}</span>\n {subtitle ? <span className=\"ow-disclosure__subtitle\">{subtitle}</span> : null}\n </span>\n </button>\n </Heading>\n {actions ? <div className=\"ow-disclosure__actions\">{actions}</div> : null}\n </div>\n <div\n ref={panelRef}\n id={`${id}-panel`}\n role=\"region\"\n aria-labelledby={`${id}-trigger`}\n className=\"ow-disclosure__panel\"\n >\n <div className=\"ow-disclosure__clip\">\n <div className=\"ow-disclosure__content\">{children}</div>\n </div>\n </div>\n </div>\n );\n}\n\nexport interface DisclosureProps {\n title: ReactNode;\n /** A muted line under the title. */\n subtitle?: ReactNode;\n /** A 15px icon between the chevron and the title. */\n icon?: ReactNode;\n /** Controls on the right of the header, outside the toggle (a ghost Button). */\n actions?: ReactNode;\n open?: boolean;\n /** @default false */\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /** `card` is a bordered surface; `plain` is just the toggle and its content, for \"Show details\".\n * @default \"card\" */\n variant?: \"card\" | \"plain\";\n /** The heading level of the title, to fit the page's outline.\n * @default 3 */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** A section that opens and closes under its title, like \"3 files changed\" in a code review. */\nexport function Disclosure({\n open,\n defaultOpen = false,\n onOpenChange,\n variant = \"card\",\n headingLevel = 3,\n className,\n ...props\n}: DisclosureProps) {\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n return (\n <DisclosureView\n {...props}\n open={isOpen}\n onToggle={() => setOpen(!isOpen)}\n headingLevel={headingLevel}\n className={cx(variant === \"plain\" && \"ow-disclosure--plain\", className)}\n />\n );\n}\n\ninterface AccordionContextValue {\n isOpen(value: string): boolean;\n toggle(value: string): void;\n headingLevel: 2 | 3 | 4 | 5 | 6;\n}\n\nconst AccordionContext = /* @__PURE__ */ createContext<AccordionContextValue | null>(null);\n\nexport interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\"> {\n /** `single` keeps one item open at a time; `multiple` lets any number be open.\n * @default \"single\" */\n type?: \"single\" | \"multiple\";\n /** The open items' values. */\n value?: string[];\n /** @default [] */\n defaultValue?: string[];\n onValueChange?(value: string[]): void;\n /** `bordered` puts the items in one card with hairlines between; `separated` gives each its own card.\n * @default \"bordered\" */\n variant?: \"bordered\" | \"separated\";\n /** @default 3 */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n children: ReactNode;\n}\n\n/** A stack of Disclosures, such as an FAQ. Up and Down move between the headers. */\nexport function Accordion({\n type = \"single\",\n value,\n defaultValue = [],\n onValueChange,\n variant = \"bordered\",\n headingLevel = 3,\n className,\n children,\n onKeyDown,\n ...props\n}: AccordionProps) {\n const [openValues, setOpenValues] = useControllableState(value, defaultValue, onValueChange);\n\n function toggle(item: string) {\n const isOpen = openValues.includes(item);\n if (type === \"single\") setOpenValues(isOpen ? [] : [item]);\n else setOpenValues(isOpen ? openValues.filter((open) => open !== item) : [...openValues, item]);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const triggers = [\n ...event.currentTarget.querySelectorAll<HTMLButtonElement>(\"[data-accordion-trigger]:not(:disabled)\"),\n ];\n const index = triggers.indexOf(document.activeElement as HTMLButtonElement);\n if (index < 0) return;\n const moves: Record<string, number> = { ArrowDown: index + 1, ArrowUp: index - 1, Home: 0, End: triggers.length - 1 };\n if (!(event.key in moves)) return;\n event.preventDefault();\n triggers[(moves[event.key]! + triggers.length) % triggers.length]?.focus();\n }\n\n return (\n <AccordionContext.Provider value={{ isOpen: (item) => openValues.includes(item), toggle, headingLevel }}>\n <div className={cx(\"ow-accordion\", `ow-accordion--${variant}`, className)} onKeyDown={handleKeyDown} {...props}>\n {children}\n </div>\n </AccordionContext.Provider>\n );\n}\n\nexport interface AccordionItemProps {\n value: string;\n title: ReactNode;\n subtitle?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** One section of an Accordion. */\nexport function AccordionItem({ value, ...props }: AccordionItemProps) {\n const context = useContext(AccordionContext);\n if (!context) throw new Error(\"AccordionItem must be inside <Accordion>.\");\n return (\n <DisclosureView\n {...props}\n item\n open={context.isOpen(value)}\n onToggle={() => context.toggle(value)}\n headingLevel={context.headingLevel}\n />\n );\n}\n", "import { forwardRef, type AnchorHTMLAttributes, type MouseEvent, type ReactNode } from \"react\";\n\nimport { ArrowUpRightIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Where it goes. The last item is the current page and isn't a link. */\n href?: string;\n onClick?(event: MouseEvent<HTMLElement>): void;\n}\n\nexport interface BreadcrumbsProps {\n items: BreadcrumbItem[];\n /** @default \"chevron\" */\n separator?: \"chevron\" | \"slash\";\n /** Names the trail for screen readers.\n * @default \"Breadcrumb\" */\n label?: string;\n className?: string;\n}\n\n/** Where the current page sits: a trail of links from the top level down. */\nexport function Breadcrumbs({ items, separator = \"chevron\", label = \"Breadcrumb\", className }: BreadcrumbsProps) {\n return (\n <nav aria-label={label} className={cx(\"ow-breadcrumbs\", className)}>\n <ol className=\"ow-breadcrumbs__list\">\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n return (\n <li key={index} className=\"ow-breadcrumbs__item\">\n {isLast ? (\n <span className=\"ow-breadcrumbs__current\" aria-current=\"page\">\n {item.label}\n </span>\n ) : item.href ? (\n <a className=\"ow-breadcrumbs__link\" href={item.href} onClick={item.onClick}>\n {item.label}\n </a>\n ) : (\n <button type=\"button\" className=\"ow-breadcrumbs__link\" onClick={item.onClick}>\n {item.label}\n </button>\n )}\n {isLast ? null : (\n <span className=\"ow-breadcrumbs__separator\" aria-hidden=\"true\">\n {separator === \"slash\" ? \"/\" : <ChevronRightIcon size={14} />}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n\nexport interface LinkStyleOptions {\n /** `default` underlines in a hairline and turns brass on hover; `muted` is quieter, for footnotes; `standalone` has no underline until hovered, for lists of links.\n * @default \"default\" */\n variant?: \"default\" | \"muted\" | \"standalone\";\n}\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>, LinkStyleOptions {\n /** Opens in a new tab with an \u2197 arrow, for links that leave your site.\n * @default false */\n external?: boolean;\n children?: ReactNode;\n}\n\n/** The class names of a link, for a router's own <Link>: `<RouterLink className={linkClassName()}>`. */\nexport function linkClassName({ variant = \"default\" }: LinkStyleOptions = {}): string {\n return cx(\"ow-link\", `ow-link--${variant}`);\n}\n\n/** A text link. Its hover turns brass, the one place brass is text on a light ground. */\nexport const Link = /* @__PURE__ */ forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { variant = \"default\", external = false, className, children, target, rel, ...props },\n ref,\n) {\n return (\n <a\n ref={ref}\n className={cx(linkClassName({ variant }), className)}\n target={external ? (target ?? \"_blank\") : target}\n rel={external ? (rel ?? \"noopener noreferrer\") : rel}\n {...props}\n >\n {children}\n {external ? (\n <>\n <ArrowUpRightIcon size={13} className=\"ow-link__external\" />\n <span className=\"ow-visually-hidden\"> (opens in a new tab)</span>\n </>\n ) : null}\n </a>\n );\n});\n", "import { ChevronLeftIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface PaginationProps {\n /** The current page, starting at 1. */\n page: number;\n pageCount: number;\n onPageChange(page: number): void;\n /** Pages shown either side of the current one.\n * @default 1 */\n siblingCount?: number;\n /** Pages always shown at each end.\n * @default 1 */\n boundaryCount?: number;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Names the control for screen readers.\n * @default \"Pagination\" */\n label?: string;\n className?: string;\n}\n\ntype Item = number | \"start-gap\" | \"end-gap\";\n\n/** The page numbers to show, with gaps where pages are skipped. */\nexport function paginationItems(page: number, pageCount: number, siblingCount = 1, boundaryCount = 1): Item[] {\n const range = (from: number, to: number) => Array.from({ length: Math.max(0, to - from + 1) }, (_, i) => from + i);\n const startPages = range(1, Math.min(boundaryCount, pageCount));\n const endPages = range(Math.max(pageCount - boundaryCount + 1, boundaryCount + 1), pageCount);\n const siblingsStart = Math.max(\n Math.min(page - siblingCount, pageCount - boundaryCount - siblingCount * 2 - 1),\n boundaryCount + 2,\n );\n const siblingsEnd = Math.min(\n Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2),\n endPages.length > 0 ? endPages[0]! - 2 : pageCount - 1,\n );\n return [\n ...startPages,\n ...(siblingsStart > boundaryCount + 2\n ? ([\"start-gap\"] as Item[])\n : boundaryCount + 1 < pageCount - boundaryCount\n ? [boundaryCount + 1]\n : []),\n ...range(siblingsStart, siblingsEnd),\n ...(siblingsEnd < pageCount - boundaryCount - 1\n ? ([\"end-gap\"] as Item[])\n : pageCount - boundaryCount > boundaryCount\n ? [pageCount - boundaryCount]\n : []),\n ...endPages,\n ];\n}\n\n/** Moves through pages of results: previous, numbered pages with gaps, next. */\nexport function Pagination({\n page,\n pageCount,\n onPageChange,\n siblingCount = 1,\n boundaryCount = 1,\n size = \"md\",\n label = \"Pagination\",\n className,\n}: PaginationProps) {\n const items = paginationItems(page, pageCount, siblingCount, boundaryCount);\n const go = (next: number) => onPageChange(Math.min(Math.max(1, next), pageCount));\n return (\n <nav aria-label={label} className={cx(\"ow-pagination\", `ow-pagination--${size}`, className)}>\n <ul className=\"ow-pagination__list\">\n <li>\n <button\n type=\"button\"\n className=\"ow-pagination__button ow-pagination__step\"\n aria-label=\"Previous page\"\n disabled={page <= 1}\n onClick={() => go(page - 1)}\n >\n <ChevronLeftIcon size={16} />\n </button>\n </li>\n {items.map((item) =>\n typeof item === \"number\" ? (\n <li key={item}>\n <button\n type=\"button\"\n className=\"ow-pagination__button\"\n aria-current={item === page ? \"page\" : undefined}\n aria-label={`Page ${item}`}\n onClick={() => go(item)}\n >\n {item}\n </button>\n </li>\n ) : (\n <li key={item} className=\"ow-pagination__gap\" aria-hidden=\"true\">\n \u2026\n </li>\n ),\n )}\n <li>\n <button\n type=\"button\"\n className=\"ow-pagination__button ow-pagination__step\"\n aria-label=\"Next page\"\n disabled={page >= pageCount}\n onClick={() => go(page + 1)}\n >\n <ChevronRightIcon size={16} />\n </button>\n </li>\n </ul>\n </nav>\n );\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { CheckIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface StepItem {\n title: ReactNode;\n /** A line under the title. Hidden once the step is done, in the vertical layout. */\n description?: ReactNode;\n /** A control on the right of the step while it's the current one, such as a small Button. Other steps don't show it. */\n action?: ReactNode;\n /** Overrides the status worked out from `current`. */\n status?: \"done\" | \"current\" | \"upcoming\";\n}\n\nexport interface StepsProps {\n items: StepItem[];\n /** The index of the step in progress. Steps before it are done. Use items.length when every step is done.\n * @default 0 */\n current?: number;\n /** `vertical` is a first-run checklist; `horizontal` is a compact progress strip.\n * @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** A heading above a vertical list, with a \"2 of 4 done\" count beside it. */\n title?: ReactNode;\n /** Names the list for screen readers when there's no title.\n * @default \"Steps\" */\n label?: string;\n className?: string;\n}\n\n/** Numbered steps toward a goal. The current one is raised; finished ones are checked off. */\nexport function Steps({ items, current = 0, orientation = \"vertical\", title, label = \"Steps\", className }: StepsProps) {\n const statuses = items.map((item, index) => item.status ?? (index < current ? \"done\" : index === current ? \"current\" : \"upcoming\"));\n const doneCount = statuses.filter((status) => status === \"done\").length;\n const headingId = useId();\n\n const list = (\n <ol className=\"ow-steps__list\">\n {items.map((item, index) => {\n const status = statuses[index]!;\n return (\n <li\n key={index}\n className={cx(\"ow-steps__item\", `ow-steps__item--${status}`)}\n aria-current={status === \"current\" ? \"step\" : undefined}\n >\n <span className=\"ow-steps__marker\">\n {status === \"done\" ? <CheckIcon size={14} strokeWidth={3} /> : index + 1}\n </span>\n <span className=\"ow-steps__text\">\n <span className=\"ow-steps__title\">\n {status === \"done\" ? <span className=\"ow-visually-hidden\">Done: </span> : null}\n {item.title}\n </span>\n {item.description && (orientation === \"horizontal\" || status !== \"done\") ? (\n <span className=\"ow-steps__description\">{item.description}</span>\n ) : null}\n </span>\n {item.action && status === \"current\" && orientation === \"vertical\" ? (\n <span className=\"ow-steps__action\">{item.action}</span>\n ) : null}\n </li>\n );\n })}\n </ol>\n );\n\n return (\n <section\n className={cx(\"ow-steps\", `ow-steps--${orientation}`, className)}\n aria-labelledby={title && orientation === \"vertical\" ? headingId : undefined}\n aria-label={title && orientation === \"vertical\" ? undefined : label}\n >\n {title && orientation === \"vertical\" ? (\n <div className=\"ow-steps__header\">\n <h3 id={headingId} className=\"ow-steps__heading\">\n {title}\n </h3>\n <span className=\"ow-steps__count\">\n {doneCount} of {items.length} done\n </span>\n </div>\n ) : null}\n {list}\n </section>\n );\n}\n", "import { forwardRef, type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ReactNode, type Ref } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface NavListProps {\n /** Names the navigation for screen readers, e.g. \"Settings\". */\n label: string;\n /** A muted heading above the items (vertical only). */\n heading?: ReactNode;\n /** `vertical` for a sidebar; `horizontal` scrolls sideways, for narrow screens.\n * @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n children: ReactNode;\n className?: string;\n}\n\n/** A list of places to go, the way a settings dialog's sidebar lists its sections. Place it on ow-canvas. */\nexport function NavList({ label, heading, orientation = \"vertical\", children, className }: NavListProps) {\n return (\n <nav aria-label={label} className={cx(\"ow-nav\", `ow-nav--${orientation}`, className)}>\n {heading && orientation === \"vertical\" ? <span className=\"ow-nav__heading\">{heading}</span> : null}\n {children}\n </nav>\n );\n}\n\nexport interface NavItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** A 15px lucide-react icon. */\n icon?: ReactNode;\n /** The current section: raised on a surface, its icon in the primary colour.\n * @default false */\n active?: boolean;\n /** Makes the item a link to this address instead of a button. */\n href?: string;\n /** Muted text at the right: a count, a badge. */\n end?: ReactNode;\n}\n\n/** One place in a NavList: a button, or a link when given an href. */\nexport const NavItem = /* @__PURE__ */ forwardRef<HTMLElement, NavItemProps>(function NavItem(\n { icon, active = false, className, children, type = \"button\", href, end, ...buttonProps },\n ref,\n) {\n const content = (\n <>\n {icon ? <span className=\"ow-nav__icon\">{icon}</span> : null}\n <span className=\"ow-nav__label\">{children}</span>\n {end !== undefined ? <span className=\"ow-nav__end\">{end}</span> : null}\n </>\n );\n const shared = {\n \"aria-current\": active ? (\"page\" as const) : undefined,\n className: cx(\"ow-nav__item\", active && \"ow-nav__item--active\", className),\n };\n if (href !== undefined) {\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n {...shared}\n {...(buttonProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {content}\n </a>\n );\n }\n return (\n <button ref={ref as Ref<HTMLButtonElement>} type={type} {...shared} {...buttonProps}>\n {content}\n </button>\n );\n});\n", "import { useMemo, type Key, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\n\nexport interface TableColumn<Row> {\n /** Unique; also the row field shown when there's no `render`. */\n key: string;\n header: ReactNode;\n /** Numbers and amounts go at the end, so their digits line up.\n * @default \"start\" */\n align?: \"start\" | \"center\" | \"end\";\n /** A CSS width, e.g. 120 or \"30%\". */\n width?: number | string;\n /** Lets the person sort by this column. */\n sortable?: boolean;\n /** What the cell shows. Defaults to the row's field named by `key`. */\n render?(row: Row): ReactNode;\n /** The value sorted by, when it isn't the field itself. */\n sortValue?(row: Row): string | number;\n}\n\nexport interface TableSort {\n key: string;\n direction: \"ascending\" | \"descending\";\n}\n\nexport interface TableProps<Row> {\n columns: Array<TableColumn<Row>>;\n rows: Row[];\n /** A field name or function giving each row a unique key.\n * @default \"id\" */\n rowKey?: keyof Row | ((row: Row) => Key);\n /** Describes the table for screen readers; shown above it unless `hideCaption`. */\n caption?: ReactNode;\n /** @default false */\n hideCaption?: boolean;\n sort?: TableSort;\n defaultSort?: TableSort;\n onSortChange?(sort: TableSort): void;\n /** Sort the rows yourself (e.g. on a server) and only show the arrows.\n * @default false */\n manualSort?: boolean;\n /** Adds a checkbox column.\n * @default \"none\" */\n selectionMode?: \"none\" | \"multiple\";\n selectedKeys?: Key[];\n defaultSelectedKeys?: Key[];\n onSelectionChange?(keys: Key[]): void;\n /**\n * Names a row for its checkbox, read out as \"Select \u2026\": the person, the file, the project. Defaults to the\n * first column's value when it's text or a number, else \"row 3\".\n */\n rowLabel?(row: Row): string;\n /** Shown in place of the rows when there are none, such as an EmptyState. */\n emptyContent?: ReactNode;\n /** `compact` rows are 36px; `comfortable` 44px.\n * @default \"comfortable\" */\n density?: \"compact\" | \"comfortable\";\n /** Keeps the header in view while the table scrolls; use with maxHeight. */\n stickyHeader?: boolean;\n maxHeight?: number | string;\n className?: string;\n}\n\nfunction compare(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\n/** Rows of records with sortable columns and optional selection, in a bordered card. */\nexport function Table<Row extends object>({\n columns,\n rows,\n rowKey = \"id\" as keyof Row,\n caption,\n hideCaption = false,\n sort,\n defaultSort,\n onSortChange,\n manualSort = false,\n selectionMode = \"none\",\n selectedKeys,\n defaultSelectedKeys = [],\n onSelectionChange,\n rowLabel,\n emptyContent = \"Nothing here yet.\",\n density = \"comfortable\",\n stickyHeader = false,\n maxHeight,\n className,\n}: TableProps<Row>) {\n const [currentSort, setSort] = useControllableState<TableSort | undefined>(sort, defaultSort, onSortChange as (sort: TableSort | undefined) => void);\n const [selected, setSelected] = useControllableState(selectedKeys, defaultSelectedKeys, onSelectionChange);\n const keyOf = (row: Row): Key => (typeof rowKey === \"function\" ? rowKey(row) : (row[rowKey] as Key));\n const labelOf = (row: Row, index: number): string => {\n if (rowLabel) return rowLabel(row);\n const first = columns[0] ? (row as Record<string, unknown>)[columns[0].key] : undefined;\n return typeof first === \"string\" || typeof first === \"number\" ? String(first) : `row ${index + 1}`;\n };\n const field = (row: Row, key: string) => (row as Record<string, unknown>)[key];\n\n const sorted = useMemo(() => {\n if (!currentSort || manualSort) return rows;\n const column = columns.find((c) => c.key === currentSort.key);\n if (!column) return rows;\n const value = (row: Row) => (column.sortValue ? column.sortValue(row) : (field(row, column.key) as string | number));\n const result = [...rows].sort((a, b) => compare(value(a), value(b)));\n return currentSort.direction === \"descending\" ? result.reverse() : result;\n }, [rows, columns, currentSort, manualSort]);\n\n const allKeys = sorted.map(keyOf);\n const selectedCount = allKeys.filter((key) => selected.includes(key)).length;\n\n function toggleSort(key: string) {\n setSort(\n currentSort?.key === key\n ? { key, direction: currentSort.direction === \"ascending\" ? \"descending\" : \"ascending\" }\n : { key, direction: \"ascending\" },\n );\n }\n\n const selectable = selectionMode === \"multiple\";\n\n return (\n <div\n className={cx(\"ow-table-wrap\", stickyHeader && \"ow-table-wrap--sticky\", className)}\n style={maxHeight ? { maxHeight } : undefined}\n tabIndex={maxHeight ? 0 : undefined}\n >\n <table className={cx(\"ow-table\", `ow-table--${density}`)}>\n {caption ? <caption className={cx(\"ow-table__caption\", hideCaption && \"ow-visually-hidden\")}>{caption}</caption> : null}\n <thead>\n <tr>\n {selectable ? (\n <th className=\"ow-table__select\" scope=\"col\">\n <Checkbox\n size=\"sm\"\n aria-label=\"Select all rows\"\n checked={sorted.length > 0 && selectedCount === sorted.length}\n indeterminate={selectedCount > 0 && selectedCount < sorted.length}\n onChange={(event) =>\n setSelected(\n event.target.checked\n ? [...new Set([...selected, ...allKeys])]\n : selected.filter((key) => !allKeys.includes(key)),\n )\n }\n />\n </th>\n ) : null}\n {columns.map((column) => {\n const direction = currentSort?.key === column.key ? currentSort.direction : undefined;\n return (\n <th\n key={column.key}\n scope=\"col\"\n aria-sort={direction ?? (column.sortable ? \"none\" : undefined)}\n className={cx(`ow-table__cell--${column.align ?? \"start\"}`)}\n style={column.width !== undefined ? { width: column.width } : undefined}\n >\n {column.sortable ? (\n <button type=\"button\" className=\"ow-table__sort\" onClick={() => toggleSort(column.key)}>\n {column.header}\n <span className={cx(\"ow-table__sort-icon\", direction && \"ow-table__sort-icon--active\")}>\n {direction === \"ascending\" ? (\n <ArrowUpIcon size={12} />\n ) : direction === \"descending\" ? (\n <ArrowDownIcon size={12} />\n ) : (\n <ChevronsUpDownIcon size={12} />\n )}\n </span>\n </button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {sorted.length === 0 ? (\n <tr>\n <td className=\"ow-table__empty\" colSpan={columns.length + (selectable ? 1 : 0)}>\n {emptyContent}\n </td>\n </tr>\n ) : (\n sorted.map((row, index) => {\n const key = keyOf(row);\n const isSelected = selected.includes(key);\n return (\n <tr key={key} className={cx(isSelected && \"ow-table__row--selected\")}>\n {selectable ? (\n <td className=\"ow-table__select\">\n <Checkbox\n size=\"sm\"\n aria-label={`Select ${labelOf(row, index)}`}\n checked={isSelected}\n onChange={(event) =>\n setSelected(\n event.target.checked ? [...selected, key] : selected.filter((k) => k !== key),\n )\n }\n />\n </td>\n ) : null}\n {columns.map((column) => (\n <td key={column.key} className={cx(`ow-table__cell--${column.align ?? \"start\"}`)}>\n {column.render ? column.render(row) : (field(row, column.key) as ReactNode)}\n </td>\n ))}\n </tr>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { ArrowDownIcon, ArrowUpIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface StatProps {\n /** What's measured, in a few words: \"Tokens this week\". */\n label: ReactNode;\n /** The number, formatted: \"1.2M\", \"\u20AC48.20\". */\n value: ReactNode;\n /** A 14px icon on a small tile beside the label. */\n icon?: ReactNode;\n /** The change since last time, as text: \"+12%\", \"\u22123\". */\n change?: string;\n /** Whether the change is good or bad. Worked out from a leading + or \u2212 when left out; costs going up are negative, so set it. */\n changeTone?: \"positive\" | \"negative\" | \"neutral\";\n /** A muted line under the value: \"vs last week\". */\n description?: ReactNode;\n /** Recent values for a small line chart under the number. */\n trend?: number[];\n className?: string;\n}\n\nfunction Sparkline({ values }: { values: number[] }) {\n const max = Math.max(...values);\n const min = Math.min(...values);\n const span = max - min || 1;\n const points = values.map((value, index) => {\n const x = (index / (values.length - 1)) * 100;\n const y = 36 - ((value - min) / span) * 32;\n return [x, y] as const;\n });\n const line = points.map(([x, y], index) => `${index ? \"L\" : \"M\"}${x.toFixed(2)} ${y.toFixed(2)}`).join(\" \");\n const [lastX, lastY] = points[points.length - 1]!;\n return (\n <div className=\"ow-stat__trend\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 100 40\" preserveAspectRatio=\"none\">\n <path d={`${line} L100 40 L0 40 Z`} className=\"ow-stat__trend-area\" />\n <path d={line} className=\"ow-stat__trend-line\" vectorEffect=\"non-scaling-stroke\" />\n </svg>\n {/* The end point is HTML, so the stretched chart doesn't stretch it into an oval. */}\n <span className=\"ow-stat__trend-end\" style={{ left: `${lastX}%`, top: `${(lastY / 40) * 100}%` }} />\n </div>\n );\n}\n\n/** One headline number with its label, change and trend, for overview cards. */\nexport function Stat({ label, value, icon, change, changeTone, description, trend, className }: StatProps) {\n const tone = changeTone ?? (change?.startsWith(\"+\") ? \"positive\" : /^[-\u2212]/.test(change ?? \"\") ? \"negative\" : \"neutral\");\n const rising = change ? !/^[-\u2212]/.test(change) : false;\n return (\n <div className={cx(\"ow-stat\", className)}>\n <div className=\"ow-stat__label\">\n {icon ? <span className=\"ow-stat__icon\">{icon}</span> : null}\n <span>{label}</span>\n </div>\n <div className=\"ow-stat__row\">\n <span className=\"ow-stat__value\">{value}</span>\n {change ? (\n <span className={cx(\"ow-stat__change\", `ow-stat__change--${tone}`)}>\n {tone === \"neutral\" ? null : rising ? <ArrowUpIcon size={12} /> : <ArrowDownIcon size={12} />}\n {change}\n </span>\n ) : null}\n </div>\n {description ? <div className=\"ow-stat__description\">{description}</div> : null}\n {trend && trend.length > 1 ? <Sparkline values={trend} /> : null}\n </div>\n );\n}\n", "import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronRightIcon, FileIcon, FolderIcon, FolderOpenIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface FileTreeNode {\n name: string;\n /** A folder's contents. Give folders an empty array if they're empty. */\n children?: FileTreeNode[];\n /** Replaces the file or folder icon. */\n icon?: ReactNode;\n /** Muted text at the right of the row, such as \"+12 \u22123\" or a size. */\n meta?: ReactNode;\n}\n\nexport interface FileTreeProps {\n items: FileTreeNode[];\n /** The selected file's path, \"src/app.tsx\". */\n selected?: string;\n defaultSelected?: string;\n onSelect?(path: string): void;\n /** Folder paths open at first, or \"all\".\n * @default \"all\" */\n defaultExpanded?: string[] | \"all\";\n /** Names the tree for screen readers.\n * @default \"Files\" */\n label?: string;\n className?: string;\n}\n\ninterface Row {\n node: FileTreeNode;\n path: string;\n level: number;\n parent?: string;\n isFolder: boolean;\n}\n\nfunction flatten(nodes: FileTreeNode[], expanded: Set<string>, parent?: string, level = 1): Row[] {\n return nodes.flatMap((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n const isFolder = node.children !== undefined;\n const row: Row = { node, path, level, parent, isFolder };\n return isFolder && expanded.has(path) ? [row, ...flatten(node.children!, expanded, path, level + 1)] : [row];\n });\n}\n\nfunction allFolders(nodes: FileTreeNode[], parent?: string): string[] {\n return nodes.flatMap((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n return node.children ? [path, ...allFolders(node.children, path)] : [];\n });\n}\n\n/**\n * A project structure explorer: folders open and close, files can be selected.\n * Up and Down move, Right opens a folder or goes into it, Left closes it or goes to its parent.\n */\nexport function FileTree({\n items,\n selected,\n defaultSelected = \"\",\n onSelect,\n defaultExpanded = \"all\",\n label = \"Files\",\n className,\n}: FileTreeProps) {\n const [current, setCurrent] = useControllableState(selected, defaultSelected, onSelect);\n const [expanded, setExpanded] = useState(() => new Set(defaultExpanded === \"all\" ? allFolders(items) : defaultExpanded));\n const rows = useMemo(() => flatten(items, expanded), [items, expanded]);\n const [focusPath, setFocusPath] = useState<string | undefined>();\n const refs = useRef(new Map<string, HTMLLIElement>());\n const tabStop = rows.some((row) => row.path === focusPath) ? focusPath : (rows.find((row) => row.path === current) ?? rows[0])?.path;\n\n function focus(path: string | undefined) {\n if (!path) return;\n setFocusPath(path);\n refs.current.get(path)?.focus();\n }\n\n function toggle(path: string, open?: boolean) {\n setExpanded((previous) => {\n const next = new Set(previous);\n if (open ?? !next.has(path)) next.add(path);\n else next.delete(path);\n return next;\n });\n }\n\n function activate(row: Row) {\n if (row.isFolder) toggle(row.path);\n else setCurrent(row.path);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLLIElement>, row: Row) {\n const index = rows.indexOf(row);\n const handlers: Record<string, () => void> = {\n ArrowDown: () => focus(rows[index + 1]?.path),\n ArrowUp: () => focus(rows[index - 1]?.path),\n Home: () => focus(rows[0]?.path),\n End: () => focus(rows[rows.length - 1]?.path),\n ArrowRight: () => {\n if (!row.isFolder) return;\n if (!expanded.has(row.path)) toggle(row.path, true);\n else focus(rows[index + 1]?.level === row.level + 1 ? rows[index + 1]!.path : undefined);\n },\n ArrowLeft: () => {\n if (row.isFolder && expanded.has(row.path)) toggle(row.path, false);\n else focus(row.parent);\n },\n Enter: () => activate(row),\n \" \": () => activate(row),\n };\n const handler = handlers[event.key];\n if (!handler) return;\n event.preventDefault();\n event.stopPropagation();\n handler();\n }\n\n function render(nodes: FileTreeNode[], parent?: string, level = 1): ReactNode {\n return nodes.map((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n const row = rows.find((entry) => entry.path === path);\n if (!row) return null;\n const isOpen = row.isFolder && expanded.has(path);\n const icon = node.icon ?? (row.isFolder ? isOpen ? <FolderOpenIcon size={16} /> : <FolderIcon size={16} /> : <FileIcon size={16} />);\n return (\n <li\n key={path}\n ref={(element) => {\n if (element) refs.current.set(path, element);\n else refs.current.delete(path);\n }}\n role=\"treeitem\"\n aria-level={level}\n aria-expanded={row.isFolder ? isOpen : undefined}\n aria-selected={row.isFolder ? undefined : current === path}\n tabIndex={tabStop === path ? 0 : -1}\n className=\"ow-tree__item\"\n onKeyDown={(event) => onKeyDown(event, row)}\n onFocus={(event) => {\n if (event.target === event.currentTarget) setFocusPath(path);\n }}\n >\n <div\n className={cx(\"ow-tree__row\", !row.isFolder && current === path && \"ow-tree__row--selected\")}\n title={path}\n onClick={() => {\n focus(path);\n activate(row);\n }}\n >\n {row.isFolder ? (\n <ChevronRightIcon size={14} className={cx(\"ow-tree__chevron\", isOpen && \"ow-tree__chevron--open\")} />\n ) : (\n <span className=\"ow-tree__spacer\" />\n )}\n <span className={cx(\"ow-tree__icon\", row.isFolder && \"ow-tree__icon--folder\")}>{icon}</span>\n <span className=\"ow-tree__name\">{node.name}</span>\n {node.meta ? <span className=\"ow-tree__meta\">{node.meta}</span> : null}\n </div>\n {isOpen && node.children!.length > 0 ? (\n <ul role=\"group\" className=\"ow-tree__group\">\n {render(node.children!, path, level + 1)}\n </ul>\n ) : null}\n </li>\n );\n });\n }\n\n return (\n <ul role=\"tree\" aria-label={label} className={cx(\"ow-tree\", className)}>\n {render(items)}\n </ul>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { InboxIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface EmptyStateProps {\n /** What's missing, as a plain statement: \"No projects yet\". */\n title: ReactNode;\n /** What to do about it, in a sentence. */\n description?: ReactNode;\n /** A 20px icon on a tile.\n * @default <InboxIcon /> */\n icon?: ReactNode;\n /** One primary Button, and maybe a secondary one. */\n actions?: ReactNode;\n /** Draws a dashed outline around it, for an empty area inside a page.\n * @default false */\n bordered?: boolean;\n className?: string;\n}\n\n/** What a list, table or panel shows when there's nothing in it yet, and the way to add the first thing. */\nexport function EmptyState({ title, description, icon, actions, bordered = false, className }: EmptyStateProps) {\n return (\n <div className={cx(\"ow-empty\", bordered && \"ow-empty--bordered\", className)}>\n <span className=\"ow-empty__icon\" aria-hidden=\"true\">\n {icon ?? <InboxIcon size={20} />}\n </span>\n <div className=\"ow-empty__text\">\n <p className=\"ow-empty__title\">{title}</p>\n {description ? <p className=\"ow-empty__description\">{description}</p> : null}\n </div>\n {actions ? <div className=\"ow-empty__actions\">{actions}</div> : null}\n </div>\n );\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n /** Shows a \u2715 that calls this. */\n onRemove?(): void;\n /** `neutral` for labels and filters; `active` for the ones currently applied.\n * @default \"neutral\" */\n variant?: \"neutral\" | \"active\";\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** A 14px icon or a ColorSwatch before the text. */\n icon?: ReactNode;\n /** What the \u2715 removes, read out as \"Remove \u2026\". Defaults to the text when it's a string. */\n removeLabel?: string;\n children: ReactNode;\n}\n\n/** A label on something (a topic, a filter, a recipient) that can be removed. */\nexport function Tag({ onRemove, variant = \"neutral\", size = \"md\", icon, removeLabel, className, children, ...props }: TagProps) {\n const name = removeLabel ?? (typeof children === \"string\" ? children : \"tag\");\n return (\n <span className={cx(\"ow-tag\", `ow-tag--${variant}`, `ow-tag--${size}`, onRemove && \"ow-tag--removable\", className)} {...props}>\n {icon ? <span className=\"ow-tag__icon\">{icon}</span> : null}\n <span className=\"ow-tag__label\">{children}</span>\n {onRemove ? (\n <button type=\"button\" className=\"ow-tag__remove\" aria-label={`Remove ${name}`} onClick={onRemove}>\n <XIcon size={12} />\n </button>\n ) : null}\n </span>\n );\n}\n\nexport interface TagGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the set for screen readers, e.g. \"Filters\". */\n label?: string;\n children: ReactNode;\n}\n\n/** Tags in a wrapping row. */\nexport function TagGroup({ label, className, children, ...props }: TagGroupProps) {\n return (\n <div role=\"group\" aria-label={label} className={cx(\"ow-tag-group\", className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface ColorSwatchProps {\n /** Any CSS colour: \"#312c7e\", \"var(--ow-brass)\". */\n color: string;\n /** The colour's name, read out and shown beside the swatch. */\n name?: string;\n /** The value shown under the name, e.g. the hex. */\n value?: string;\n /** sm 16px, md 24px, lg 40px.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"square\" */\n shape?: \"square\" | \"circle\";\n className?: string;\n}\n\n/** A colour sample, with its name and value if given. */\nexport function ColorSwatch({ color, name, value, size = \"md\", shape = \"square\", className }: ColorSwatchProps) {\n const swatch = (\n <span\n className={cx(\"ow-swatch\", `ow-swatch--${size}`, shape === \"circle\" && \"ow-swatch--circle\")}\n style={{ background: color }}\n {...(name && !value ? { role: \"img\", \"aria-label\": name } : { \"aria-hidden\": true })}\n />\n );\n if (!name && !value) return <span className={className}>{swatch}</span>;\n return (\n <span className={cx(\"ow-swatch-label\", className)}>\n {swatch}\n <span className=\"ow-swatch-label__text\">\n {name ? <span className=\"ow-swatch-label__name\">{name}</span> : null}\n <span className=\"ow-swatch-label__value\">{value}</span>\n </span>\n </span>\n );\n}\n", "import { useState, type CSSProperties } from \"react\";\n\nimport { UserIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { getInitials } from \"@/utils/text\";\nimport type { AvatarProps, AvatarSize } from \"./Avatar.types\";\nexport type { AvatarProps, AvatarSize } from \"./Avatar.types\";\n\nconst namedSizes = { sm: 24, md: 28, lg: 36, xl: 48 } as const;\n\n/**\n * The class and style that size an avatar: a named size's class, or a pixel size through --ow-avatar-size.\n * @internal\n */\nexport function avatarSize(size: AvatarSize): { className: string; style?: CSSProperties; pixels: number } {\n if (typeof size === \"number\") {\n return { className: \"ow-avatar--custom\", style: { \"--ow-avatar-size\": `${size}px` } as CSSProperties, pixels: size };\n }\n return { className: `ow-avatar--${size}`, pixels: namedSizes[size] };\n}\n\n/** A round picture of a person: their photo, else their initials on the brand colour, else a person icon. */\nexport function Avatar({ name, src, size = \"md\", label, className }: AvatarProps) {\n const initials = getInitials(name);\n const [failedImage, setFailedImage] = useState<string>();\n const showImage = src && src !== failedImage;\n const sizing = avatarSize(size);\n\n return (\n <span\n className={cx(\"ow-avatar\", sizing.className, !initials && !showImage && \"ow-avatar--empty\", className)}\n style={sizing.style}\n {...(label ? { role: \"img\", \"aria-label\": label } : { \"aria-hidden\": true })}\n // The initials are drawn by CSS, not written in the page: they're a picture of the name, so they don't\n // become the visible label of a button the avatar sits in (which its accessible name would have to match).\n data-initials={!showImage && initials ? initials : undefined}\n >\n {showImage ? (\n <img src={src} alt=\"\" className=\"ow-avatar__image\" onError={() => setFailedImage(src)} />\n ) : initials ? null : (\n <UserIcon size={Math.round(sizing.pixels * 0.52)} />\n )}\n </span>\n );\n}\n", "import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Avatar, avatarSize, type AvatarSize } from \"./Avatar\";\n\nexport interface AvatarGroupProps {\n /** Avatars. */\n children: ReactNode;\n /** Shows this many, then a \"+3\" count.\n * @default 4 */\n max?: number;\n /** Applied to every avatar in the group: a named size or pixels.\n * @default \"md\" */\n size?: AvatarSize;\n /** Names the group for screen readers, e.g. \"5 people on this project\". */\n label?: string;\n className?: string;\n}\n\n/** Overlapping avatars for the people on something, with a count for the rest. */\nexport function AvatarGroup({ children, max = 4, size = \"md\", label, className }: AvatarGroupProps) {\n const avatars = Children.toArray(children).filter(isValidElement) as Array<ReactElement<{ size?: AvatarSize }>>;\n const sizing = avatarSize(size);\n const shown = avatars.slice(0, max);\n const hidden = avatars.length - shown.length;\n return (\n <div role=\"group\" aria-label={label} className={cx(\"ow-avatar-group\", className)}>\n {shown.map((avatar) => cloneElement(avatar, { size }))}\n {hidden > 0 ? (\n <span className={cx(\"ow-avatar\", sizing.className, \"ow-avatar--count\")} style={sizing.style}>\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"ow-visually-hidden\">and {hidden} more</span>\n </span>\n ) : null}\n </div>\n );\n}\n\nexport interface UserProps {\n name: string;\n /** A second line: an email, a role. */\n description?: ReactNode;\n src?: string;\n /** The avatar's size; the name and gap grow with it from xl (48px) up.\n * @default \"md\" */\n size?: AvatarSize;\n className?: string;\n}\n\n/** The User's class for a size: its own for named sizes; a pixel size uses the nearest named one. */\nfunction userSize(size: AvatarSize) {\n if (typeof size !== \"number\") return `ow-user--${size}`;\n return size >= 48 ? \"ow-user--xl\" : size >= 36 ? \"ow-user--lg\" : size >= 28 ? \"ow-user--md\" : \"ow-user--sm\";\n}\n\n/** A person: avatar, name and a line about them, as in an account menu. */\nexport function User({ name, description, src, size = \"md\", className }: UserProps) {\n return (\n <div className={cx(\"ow-user\", userSize(size), className)}>\n <Avatar name={name} src={src} size={size} />\n <div className=\"ow-user__text\">\n <span className=\"ow-user__name\">{name}</span>\n {description ? <span className=\"ow-user__description\">{description}</span> : null}\n </div>\n </div>\n );\n}\n", "import type { HTMLAttributes } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** One keyboard key in running text, with a heavier bottom edge like a real key: <Kbd>\u2318</Kbd> <Kbd>K</Kbd>. */\nexport function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>) {\n return <kbd className={cx(\"ow-kbd\", className)} {...props} />;\n}\n\n/** Code, a path or a command inside a sentence. */\nexport function Code({ className, ...props }: HTMLAttributes<HTMLElement>) {\n return <code className={cx(\"ow-code\", className)} {...props} />;\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n /** `none` for a card that holds a list or table edge to edge; `md` is 16px, `lg` 24px.\n * @default \"md\" */\n padding?: \"none\" | \"md\" | \"lg\";\n}\n\n/** A surface with a hairline border and no shadow: borders before shadows. */\nexport function Card({ className, padding = \"md\", ...props }: CardProps) {\n return <div className={cx(\"ow-card\", `ow-card--pad-${padding}`, className)} {...props} />;\n}\n\nexport interface SettingsRowProps {\n label: ReactNode;\n /** A muted line or two under the label. */\n description?: ReactNode;\n /** The control: a Switch, a Select, a Button. */\n children: ReactNode;\n className?: string;\n}\n\n/** A label on the left and its control on the right, like macOS System Settings. Stack them in a Card. */\nexport function SettingsRow({ children, description, label, className }: SettingsRowProps) {\n return (\n <div className={cx(\"ow-settings-row\", className)}>\n <div className=\"ow-settings-row__text\">\n <span className=\"ow-settings-row__label\">{label}</span>\n {description ? <div className=\"ow-settings-row__description\">{description}</div> : null}\n </div>\n <div className=\"ow-settings-row__control\">{children}</div>\n </div>\n );\n}\n", "import {\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport type SpaceToken = \"none\" | \"3xs\" | \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n\nconst space = (token: SpaceToken) => (token === \"none\" ? \"0\" : `var(--ow-space-${token})`);\n\nexport interface StackProps extends HTMLAttributes<HTMLElement> {\n /** @default \"column\" */\n direction?: \"row\" | \"column\";\n /** The space between children, from the spacing scale.\n * @default \"md\" */\n gap?: SpaceToken;\n /** Cross-axis alignment. */\n align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\n /** Main-axis alignment. */\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n /** Lets a row wrap onto more lines.\n * @default false */\n wrap?: boolean;\n /** The element to render.\n * @default \"div\" */\n as?: keyof JSX.IntrinsicElements;\n children?: ReactNode;\n}\n\nconst alignments = { start: \"flex-start\", center: \"center\", end: \"flex-end\", stretch: \"stretch\", baseline: \"baseline\", between: \"space-between\" };\n\n/** Lays children out in a row or a column with a gap from the spacing scale. */\nexport function Stack({\n direction = \"column\",\n gap = \"md\",\n align,\n justify,\n wrap = false,\n as = \"div\",\n className,\n style,\n children,\n ...props\n}: StackProps) {\n const Element = as as \"div\";\n return (\n <Element\n className={cx(\"ow-stack\", className)}\n style={{\n flexDirection: direction,\n gap: space(gap),\n alignItems: align ? alignments[align] : undefined,\n justifyContent: justify ? alignments[justify] : undefined,\n flexWrap: wrap ? \"wrap\" : undefined,\n ...style,\n }}\n {...props}\n >\n {children}\n </Element>\n );\n}\n\nexport interface SeparatorProps {\n /** @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Text in the middle of a horizontal line, such as \"or\". */\n label?: ReactNode;\n /** Space before and after, from the spacing scale.\n * @default \"none\" */\n spacing?: SpaceToken;\n className?: string;\n}\n\n/** A hairline between groups of content. Prefer space; use a line when space alone doesn't separate. */\nexport function Separator({ orientation = \"horizontal\", label, spacing = \"none\", className }: SeparatorProps) {\n const margin = orientation === \"horizontal\" ? `${space(spacing)} 0` : `0 ${space(spacing)}`;\n if (label && orientation === \"horizontal\") {\n return (\n <div role=\"separator\" className={cx(\"ow-separator-label\", className)} style={{ margin }}>\n <span className=\"ow-separator-label__text\">{label}</span>\n </div>\n );\n }\n return (\n <div\n role=\"separator\"\n aria-orientation={orientation}\n className={cx(\"ow-separator\", `ow-separator--${orientation}`, className)}\n style={{ margin }}\n />\n );\n}\n\nexport interface ScrollShadowProps extends HTMLAttributes<HTMLDivElement> {\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** How far the fade reaches, in pixels.\n * @default 32 */\n size?: number;\n /** Its height (vertical) or width; it scrolls past this. */\n maxSize?: number | string;\n /** Names the area; with it, the area becomes a focusable region so keyboards can scroll it. */\n \"aria-label\"?: string;\n children: ReactNode;\n}\n\n/** A scrolling area whose edges fade out where there's more to scroll, so nothing looks cut off. */\nexport function ScrollShadow({\n orientation = \"vertical\",\n size = 32,\n maxSize,\n className,\n style,\n children,\n \"aria-label\": ariaLabel,\n ...props\n}: ScrollShadowProps) {\n const ref = useRef<HTMLDivElement>(null);\n const [edges, setEdges] = useState({ start: false, end: false });\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const update = () => {\n const position = orientation === \"vertical\" ? element.scrollTop : element.scrollLeft;\n const extent = orientation === \"vertical\" ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;\n setEdges({ start: position > 1, end: position < extent - 1 });\n };\n update();\n element.addEventListener(\"scroll\", update, { passive: true });\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(update);\n observer?.observe(element);\n if (element.firstElementChild) observer?.observe(element.firstElementChild);\n return () => {\n element.removeEventListener(\"scroll\", update);\n observer?.disconnect();\n };\n }, [orientation]);\n\n return (\n <div\n ref={ref}\n className={cx(\"ow-scroll-shadow\", `ow-scroll-shadow--${orientation}`, className)}\n data-start={edges.start || undefined}\n data-end={edges.end || undefined}\n tabIndex={ariaLabel ? 0 : undefined}\n role={ariaLabel ? \"region\" : undefined}\n aria-label={ariaLabel}\n style={\n {\n \"--ow-scroll-shadow\": `${size}px`,\n [orientation === \"vertical\" ? \"maxHeight\" : \"maxWidth\"]: maxSize,\n ...style,\n } as CSSProperties\n }\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** Hides content visually but keeps it for screen readers: extra context for an icon, a table caption. */\nexport function VisuallyHidden({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return <span className={cx(\"ow-visually-hidden\", className)} {...props} />;\n}\n", "import { cx } from \"@/utils/cx\";\nimport type { ContainerProps } from \"./Container.types\";\nexport type { ContainerProps, ContainerSize } from \"./Container.types\";\n\n/**\n * Centres content at a set width with the page's side margins: 32px, and the phone gutter under 760px. Every block\n * lines its content up the same way, so whatever sits in a Container lines up with the blocks above and below it.\n */\nexport function Container({ size = \"page\", as: Element = \"div\", className, ...props }: ContainerProps) {\n return <Element className={cx(\"ow-container\", `ow-container--${size}`, className)} {...props} />;\n}\n", "import { Container } from \"@/components/Container/Container\";\nimport { cx } from \"@/utils/cx\";\nimport type { SectionProps } from \"./Section.types\";\nexport type { SectionProps } from \"./Section.types\";\n\n/**\n * A full-width band of a page, with the blocks' space above and below and their width and side margins inside (a\n * Container). Your own sections then sit in line with the blocks around them.\n */\nexport function Section({ tone = \"paper\", spacing = \"md\", size = \"page\", as: Element = \"section\", className, children, ...props }: SectionProps) {\n return (\n <Element className={cx(\"ow-section\", `ow-section--${tone}`, `ow-section--space-${spacing}`, className)} {...props}>\n {size === false ? children : <Container size={size}>{children}</Container>}\n </Element>\n );\n}\n", "import { useRef, type HTMLAttributes, type PointerEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** A white pill with a brass dot that names a section, set just above its title. */\nexport function Chip({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return <span className={cx(\"ow-chip\", className)} {...props} />;\n}\n\nexport interface SectionHeadingProps {\n /** One to three words for the Chip above the title. */\n eyebrow?: ReactNode;\n title: ReactNode;\n /** One or two sentences under the title. */\n intro?: ReactNode;\n /** @default \"start\" */\n align?: \"start\" | \"center\";\n /** The heading level.\n * @default \"h2\" */\n as?: \"h1\" | \"h2\" | \"h3\";\n className?: string;\n}\n\n/** How a marketing section opens: a Chip, a big light title, then an intro in muted text. */\nexport function SectionHeading({\n eyebrow,\n title,\n intro,\n align = \"start\",\n as: Heading = \"h2\",\n className,\n}: SectionHeadingProps) {\n return (\n <div className={cx(\"ow-section-heading\", align === \"center\" && \"ow-section-heading--center\", className)}>\n {eyebrow ? <Chip>{eyebrow}</Chip> : null}\n <Heading className=\"ow-section-heading__title\">{title}</Heading>\n {intro ? <p className=\"ow-section-heading__intro\">{intro}</p> : null}\n </div>\n );\n}\n\nexport interface SiteHeaderProps {\n /** Your logo or name, usually a link home. */\n brand: ReactNode;\n /** Links in the middle; hidden under 760px wide. */\n nav?: ReactNode;\n /** On the right: one primary Button with shape=\"pill\". */\n actions?: ReactNode;\n className?: string;\n}\n\n/** The marketing site's header: a floating white pill over a blur, with a hairline border and a soft shadow. */\nexport function SiteHeader({ brand, nav, actions, className }: SiteHeaderProps) {\n return (\n <header className={cx(\"ow-site-header\", className)}>\n <div className=\"ow-site-header__brand\">{brand}</div>\n {nav ? <nav className=\"ow-site-header__nav\">{nav}</nav> : null}\n {actions ? <div className=\"ow-site-header__actions\">{actions}</div> : null}\n </header>\n );\n}\n\nexport interface DotGridProps extends HTMLAttributes<HTMLDivElement> {\n /** Fades the dots out toward the edges.\n * @default false */\n fade?: boolean;\n /** Turns the dots under the pointer brass.\n * @default false */\n interactive?: boolean;\n}\n\n/** A ground of 1px dots every 22px, like a sheet laid out for planning. Content goes inside. */\nexport function DotGrid({ fade = false, interactive = false, className, children, onPointerMove, ...props }: DotGridProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n function track(event: PointerEvent<HTMLDivElement>) {\n onPointerMove?.(event);\n const element = ref.current;\n if (!interactive || !element) return;\n const rect = element.getBoundingClientRect();\n element.style.setProperty(\"--ow-pointer-x\", `${event.clientX - rect.left}px`);\n element.style.setProperty(\"--ow-pointer-y\", `${event.clientY - rect.top}px`);\n }\n\n return (\n <div\n ref={ref}\n className={cx(\"ow-dot-grid\", fade && \"ow-dot-grid--fade\", interactive && \"ow-dot-grid--interactive\", className)}\n onPointerMove={track}\n {...props}\n >\n <span className=\"ow-dot-grid__dots\" aria-hidden=\"true\" />\n {interactive ? (\n <span className=\"ow-dot-grid__brass\" aria-hidden=\"true\" />\n ) : null}\n <div className=\"ow-dot-grid__content\">{children}</div>\n </div>\n );\n}\n", "import { forwardRef, useEffect, useRef } from \"react\";\n\nimport { cx } from \"@/utils/cx\";\nimport type { ProseProps } from \"./Prose.types\";\nexport type { ProseProps } from \"./Prose.types\";\n\n/**\n * Styles content you don't write element by element: Markdown rendered to HTML, a CMS body, an agent's answer. It sets\n * the plain elements inside it (headings, paragraphs, lists, quotes, code, tables, images, details) in Openware's type\n * and colours, and leaves Openware components inside it as they are.\n */\nexport const Prose = /* @__PURE__ */ forwardRef<HTMLElement, ProseProps>(function Prose({ size = \"md\", fullWidth = false, as = \"div\", className, children, ...props }, ref) {\n const Element = as as \"div\";\n const root = useRef<HTMLElement | null>(null);\n\n // Content Prose styles comes as plain HTML, so it fixes two things such HTML can't say for itself, after each render:\n // a code block or table that scrolls sideways can be reached by keyboard to scroll it, and a Markdown task-list\n // checkbox (an <input> at the start of a list item, with no label) is named by its item's text.\n useEffect(() => {\n const element = root.current;\n if (!element) return;\n for (const scroller of element.querySelectorAll<HTMLElement>(\"pre, .ow-table-wrap\")) {\n if (scroller.scrollWidth > scroller.clientWidth && !scroller.hasAttribute(\"tabindex\")) scroller.tabIndex = 0;\n }\n for (const box of element.querySelectorAll<HTMLInputElement>('li > input[type=\"checkbox\"], li > p > input[type=\"checkbox\"]')) {\n if (box.labels?.length || box.hasAttribute(\"aria-label\") || box.hasAttribute(\"aria-labelledby\")) continue;\n const text = box.closest(\"li\")?.textContent?.trim();\n if (text) box.setAttribute(\"aria-label\", text);\n }\n });\n\n return (\n <Element\n ref={(node: HTMLDivElement | null) => {\n root.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n className={cx(\"ow-prose\", `ow-prose--${size}`, size === \"md\" ? \"ow-type-prose\" : \"ow-type-copy\", fullWidth && \"ow-prose--full\", className)}\n {...props}\n >\n {children}\n </Element>\n );\n});\n", "import type { CSSProperties, JSX, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface TextShimmerProps {\n /** The words that shimmer, usually a status ending in an ellipsis: \"Thinking\u2026\", \"Running tests\u2026\". */\n children: ReactNode;\n /** The element, so it can sit in a heading or a paragraph.\n * @default \"span\" */\n as?: keyof JSX.IntrinsicElements;\n /** Seconds for the highlight to cross the text once.\n * @default 2 */\n duration?: number;\n /** Stops the shimmer and shows the text plainly, e.g. once the step has finished.\n * @default true */\n active?: boolean;\n className?: string;\n}\n\n/**\n * Text with a highlight sweeping across it, for work in progress: \"Thinking\u2026\", \"Searching the codebase\u2026\". It's plain\n * text to screen readers, and stands still when the person prefers reduced motion.\n */\nexport function TextShimmer({ children, as = \"span\", duration = 2, active = true, className }: TextShimmerProps) {\n const Element = as as \"span\";\n return (\n <Element\n className={cx(\"ow-shimmer\", active && \"ow-shimmer--active\", className)}\n style={active ? ({ \"--ow-shimmer-duration\": `${duration}s` } as CSSProperties) : undefined}\n >\n {children}\n </Element>\n );\n}\n", "import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type DragEvent,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ArrowUpIcon, FileIcon, UploadIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { resizeTextArea } from \"../../utils/resizeTextArea\";\nimport { Button } from \"../Button/Button\";\nimport { Textarea } from \"../Textarea/Textarea\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\n/** A file attached to the message, shown as a chip above the text. */\nexport interface PromptAttachment {\n /** Identifies it to onRemoveAttachment, and keys its chip. */\n id: string;\n /** The file name, shown on the chip (a long one is cut short before its extension) and read out by its remove button. */\n name: string;\n /** Bytes, shown under the name: \"48 kB\". */\n size?: number;\n /** The MIME type, such as \"image/png\". With the name, it picks the chip's icon when there's no preview. */\n type?: string;\n /** An image to show as the chip's thumbnail: an object URL from URL.createObjectURL, or any image URL. */\n previewUrl?: string;\n}\n\nexport interface PromptInputProps {\n /** The text, when controlled. Clear it yourself in onSubmit. */\n value?: string;\n /** The starting text when uncontrolled. The box clears itself after each send.\n * @default \"\" */\n defaultValue?: string;\n /** Called with the text on every change. */\n onChange?(value: string): void;\n /**\n * Called on Enter or the send button with the text (trimmed) and the attachments. It isn't called while there's\n * nothing to send (no text and no attachments), while streaming, or while disabled.\n */\n onSubmit?(value: string, attachments: PromptAttachment[]): void;\n /** The agent is replying: the send button becomes a Stop button and Escape in the box stops it. The next message can\n * be typed meanwhile, but not sent.\n * @default false */\n isStreaming?: boolean;\n /** Called by the Stop button, and by Escape in the box, while streaming. */\n onStop?(): void;\n /** The files attached so far, as chips above the text. You keep the list: add to it in onAttach and take from it in\n * onRemoveAttachment. */\n attachments?: PromptAttachment[];\n /** Called with the files picked with the paperclip, pasted, or dropped on the box. Giving it shows the paperclip. */\n onAttach?(files: File[]): void;\n /** Called with an attachment's id when its remove button is pressed. Giving it shows the remove buttons. */\n onRemoveAttachment?(id: string): void;\n /** File types to accept, as for <input accept>: \"image/*,.log,.txt\". Other files are turned away with a message. */\n accept?: string;\n /** Lets several files be attached at once.\n * @default true */\n multiple?: boolean;\n /** Controls at the start of the toolbar under the text, after the paperclip: a model Select, a toggle. Buttons here\n * should be size sm. */\n startActions?: ReactNode;\n /** Controls at the end of the toolbar, before the send button. */\n endActions?: ReactNode;\n /** A muted line under the box, such as how to send: \"Enter to send, Shift + Enter for a new line\". The text box\n * points to it with aria-describedby. */\n hint?: ReactNode;\n /** @default \"Message the agent\u2026\" */\n placeholder?: string;\n /** Names the text box for screen readers. It's \"Message\" unless something else labels it: aria-labelledby, or an id\n * that a <label> points to, as in a Field. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** The text box's id. Field sets it. */\n id?: string;\n /** Marks the box invalid: a danger border, and aria-invalid on the text box. Field sets it from its error.\n * @default false */\n isInvalid?: boolean;\n /** Turns off the text box, its buttons and the controls in the toolbar, and fades the box.\n * @default false */\n disabled?: boolean;\n /** Focuses the text box when it appears. Use it where typing is plainly the next step, such as a new chat.\n * @default false */\n autoFocus?: boolean;\n /** The most characters the text can have. A quiet count shows once it's 80% full. */\n maxLength?: number;\n /** The rows of text the box shows when it's empty.\n * @default 1 */\n minRows?: number;\n /** The most rows it grows to; past that, the text scrolls.\n * @default 8 */\n maxRows?: number;\n /** md for a chat page, sm for a side panel or a reply box.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** The locale for attachment sizes and the character count, such as \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** Called for each key in the text box before the box's own keys. Call event.preventDefault() to take a key over, for\n * example the Up arrow to edit the last message. */\n onKeyDown?(event: KeyboardEvent<HTMLTextAreaElement>): void;\n /** Classes for the outer element, which holds the box and the hint. */\n className?: string;\n}\n\nconst noAttachments: PromptAttachment[] = [];\n/** The count shows once the text is this full. */\nconst counterFrom = 0.8;\n/** How long typing has to pause before the count is read out. */\nconst announceDelay = 1000;\n\nfunction Glyph({ children }: { children: ReactNode }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={16}\n height={16}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\n// Lucide shapes (ISC licence), drawn here like the ones in icons.tsx.\nconst sheet = \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\";\nconst fold = \"M14 2v5a1 1 0 0 0 1 1h5\";\n\nconst PaperclipIcon = () => (\n <Glyph>\n <path d=\"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\" />\n </Glyph>\n);\n\nconst StopIcon = () => (\n <Glyph>\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\" stroke=\"none\" />\n </Glyph>\n);\n\nconst fileIcons = {\n image: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <circle cx=\"10\" cy=\"12\" r=\"2\" />\n <path d=\"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22\" />\n </Glyph>\n ),\n code: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </Glyph>\n ),\n text: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </Glyph>\n ),\n file: <FileIcon size={16} />,\n};\n\nfunction kindOf({ name, type = \"\" }: PromptAttachment): keyof typeof fileIcons {\n const lower = name.toLowerCase();\n if (type.startsWith(\"image/\") || /\\.(png|jpe?g|gif|webp|avif|heic|svg)$/.test(lower)) return \"image\";\n if (/\\.(tsx?|jsx?|mjs|cjs|py|go|rs|rb|java|kt|swift|c|cc|cpp|h|cs|php|css|scss|html|json|ya?ml|toml|sql|sh)$/.test(lower)) return \"code\";\n if (type.startsWith(\"text/\") || type === \"application/pdf\" || /\\.(txt|md|log|csv|pdf|docx?|rtf)$/.test(lower)) return \"text\";\n return \"file\";\n}\n\n/** \"screenshot.png\" \u2192 [\"screenshot\", \".png\"], so the name can be cut short before its extension. */\nfunction splitName(name: string): [string, string] {\n const dot = name.lastIndexOf(\".\");\n if (dot <= 0 || name.length - dot > 8) return [name, \"\"];\n return [name.slice(0, dot), name.slice(dot)];\n}\n\nfunction formatBytes(bytes: number, locale: string | undefined): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let unit = 0;\n while (value >= 1000 && unit < units.length - 1) {\n value /= 1000;\n unit += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[unit],\n unitDisplay: unit === 0 ? \"long\" : \"short\",\n maximumFractionDigits: unit > 0 && value < 10 ? 1 : 0,\n }).format(value);\n}\n\n/** Whether a file matches an <input accept> list. */\nfunction accepts(file: File, accept: string | undefined): boolean {\n if (!accept) return true;\n return accept.split(\",\").some((rule) => {\n const pattern = rule.trim().toLowerCase();\n if (!pattern) return false;\n if (pattern.startsWith(\".\")) return file.name.toLowerCase().endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return file.type.toLowerCase().startsWith(pattern.slice(0, -1));\n return file.type.toLowerCase() === pattern;\n });\n}\n\nconst hasFiles = (event: DragEvent) => Array.from(event.dataTransfer.types).includes(\"Files\");\n\n/**\n * The box you write to the agent in. Enter sends and Shift+Enter starts a new line; it grows with the text, takes files\n * from a picker, the clipboard or a drop, and turns its send button into Stop while the agent replies.\n */\nexport const PromptInput = /* @__PURE__ */ forwardRef<HTMLTextAreaElement, PromptInputProps>(function PromptInput(\n {\n value,\n defaultValue = \"\",\n onChange,\n onSubmit,\n isStreaming = false,\n onStop,\n attachments = noAttachments,\n onAttach,\n onRemoveAttachment,\n accept,\n multiple = true,\n startActions,\n endActions,\n hint,\n placeholder = \"Message the agent\u2026\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n isInvalid = false,\n disabled = false,\n autoFocus = false,\n maxLength,\n minRows = 1,\n maxRows = 8,\n size = \"md\",\n locale,\n onKeyDown,\n className,\n },\n ref,\n) {\n const [text, setText] = useControllableState(value, defaultValue, onChange);\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const actionRef = useRef<HTMLButtonElement>(null);\n const pickerRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const composing = useRef(false);\n const dragDepth = useRef(0);\n const pendingFocus = useRef<{ id: string; index: number } | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [notice, setNotice] = useState<string>();\n const [announcement, setAnnouncement] = useState(\"\");\n const hintId = useId();\n\n const rows = Math.max(1, Math.round(minRows));\n const maxRowCount = Math.max(rows, Math.round(maxRows));\n const canAttach = Boolean(onAttach) && !disabled;\n const hasContent = text.trim().length > 0 || attachments.length > 0;\n const canSend = hasContent && !disabled && !isStreaming;\n const toolbarStart = Boolean(onAttach || startActions);\n // With nothing in the toolbar but the send button, the button sits at the end of the text instead.\n const inline = !toolbarStart && !endActions;\n const showCounter = maxLength !== undefined && maxLength > 0 && text.length >= maxLength * counterFrom;\n const remaining = maxLength === undefined ? 0 : Math.max(0, maxLength - text.length);\n const number = (count: number) => new Intl.NumberFormat(locale).format(count);\n const shownHint = notice ?? hint;\n const describedBy = [ariaDescribedBy, hint && !notice ? hintId : undefined].filter(Boolean).join(\" \") || undefined;\n const name = ariaLabel ?? (ariaLabelledBy || id ? undefined : \"Message\");\n\n function setTextAreaRef(element: HTMLTextAreaElement | null) {\n textAreaRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }\n\n // The text rewraps when the box gets wider or narrower, so it's measured again.\n useEffect(() => {\n const textArea = textAreaRef.current;\n if (!textArea || typeof ResizeObserver === \"undefined\") return;\n let width = textArea.clientWidth;\n const observer = new ResizeObserver(() => {\n if (textArea.clientWidth === width) return;\n width = textArea.clientWidth;\n resizeTextArea(textArea);\n });\n observer.observe(textArea);\n return () => observer.disconnect();\n }, []);\n\n useLayoutEffect(() => {\n if (textAreaRef.current) resizeTextArea(textAreaRef.current);\n }, [size, rows]);\n\n // When a reply ends with focus on Stop and nothing to send, the button turns into a disabled Send: focus moves to\n // the text box rather than being dropped. Read before the change commits, since a disabled button loses focus.\n const wasStreaming = useRef(isStreaming);\n const actionHadFocus = useRef(false);\n if (wasStreaming.current !== isStreaming) {\n actionHadFocus.current = typeof document !== \"undefined\" && document.activeElement === actionRef.current;\n }\n useLayoutEffect(() => {\n if (wasStreaming.current && !isStreaming && actionHadFocus.current && !hasContent) textAreaRef.current?.focus();\n wasStreaming.current = isStreaming;\n actionHadFocus.current = false;\n }, [isStreaming, hasContent]);\n\n // After a chip is removed, focus goes to the next chip's remove button, or the previous one, or the text box.\n useLayoutEffect(() => {\n const pending = pendingFocus.current;\n if (!pending) return;\n pendingFocus.current = null;\n if (attachments.some((attachment) => attachment.id === pending.id)) return;\n const buttons = listRef.current?.querySelectorAll<HTMLButtonElement>(\".ow-prompt-input__remove\");\n const next = buttons?.length ? buttons[Math.min(pending.index, buttons.length - 1)] : undefined;\n (next ?? textAreaRef.current)?.focus();\n }, [attachments]);\n\n // Near the limit, the count is read out once typing pauses, not on every key.\n useEffect(() => {\n if (!showCounter || document.activeElement !== textAreaRef.current) return;\n const timer = window.setTimeout(() => {\n setAnnouncement(`${number(remaining)} ${remaining === 1 ? \"character\" : \"characters\"} left`);\n }, announceDelay);\n return () => window.clearTimeout(timer);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `number` only depends on locale.\n }, [showCounter, remaining, locale]);\n\n function submit() {\n if (!canSend) return;\n onSubmit?.(text.trim(), attachments);\n setNotice(undefined);\n if (value === undefined) setText(\"\");\n }\n\n function stop() {\n if (isStreaming && !disabled) onStop?.();\n }\n\n function take(list: File[]) {\n if (!canAttach || !list.length) return;\n const files = multiple ? list : list.slice(0, 1);\n const refused = files.find((file) => !accepts(file, accept));\n const taken = files.filter((file) => accepts(file, accept));\n let message: string | undefined;\n if (refused) message = `\u201C${refused.name}\u201D isn't a file this accepts.`;\n else if (!multiple && list.length > 1) message = \"Attach one file at a time.\";\n setNotice(message);\n if (message) setAnnouncement(message);\n if (taken.length) onAttach?.(taken);\n }\n\n function remove(attachment: PromptAttachment, index: number) {\n if (listRef.current?.contains(document.activeElement)) pendingFocus.current = { id: attachment.id, index };\n onRemoveAttachment?.(attachment.id);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLTextAreaElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Enter\" && !event.shiftKey) {\n // Enter also ends an IME composition (Japanese, Chinese, Korean input); that Enter isn't a send.\n if (composing.current || event.nativeEvent.isComposing || event.keyCode === 229) return;\n event.preventDefault();\n submit();\n } else if (event.key === \"Escape\" && isStreaming && onStop) {\n event.preventDefault();\n event.stopPropagation();\n stop();\n }\n }\n\n // Pasting a screenshot attaches it. Text that comes with an image (a range of spreadsheet cells) pastes as text.\n function handlePaste(event: ClipboardEvent<HTMLTextAreaElement>) {\n if (!canAttach) return;\n const files = Array.from(event.clipboardData.files);\n if (!files.length || event.clipboardData.getData(\"text/plain\")) return;\n event.preventDefault();\n take(files);\n }\n\n // A press on the box's padding or the toolbar's empty space puts the caret in the text.\n function handleMouseDown(event: MouseEvent<HTMLElement>) {\n const target = event.target as HTMLElement;\n if (disabled || (target !== event.currentTarget && !target.hasAttribute(\"data-prompt-blank\"))) return;\n event.preventDefault();\n textAreaRef.current?.focus();\n }\n\n const attachButton = onAttach ? (\n <Tooltip label=\"Attach files\">\n <Button\n className=\"ow-prompt-input__attach\"\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={multiple ? \"Attach files\" : \"Attach a file\"}\n disabled={disabled}\n onClick={() => pickerRef.current?.click()}\n >\n <PaperclipIcon />\n </Button>\n </Tooltip>\n ) : null;\n\n const actionLabel = isStreaming ? \"Stop\" : \"Send\";\n const actionButton = (\n <Tooltip label={actionLabel}>\n <Button\n ref={actionRef}\n className=\"ow-prompt-input__action\"\n variant=\"primary\"\n size=\"sm\"\n iconOnly\n aria-label={actionLabel}\n disabled={disabled || (isStreaming ? !onStop : !hasContent)}\n onClick={() => {\n if (isStreaming) stop();\n else submit();\n textAreaRef.current?.focus();\n }}\n >\n {isStreaming ? <StopIcon /> : <ArrowUpIcon size={16} />}\n </Button>\n </Tooltip>\n );\n\n return (\n <div\n className={cx(\n \"ow-prompt-input\",\n `ow-prompt-input--${size}`,\n inline && \"ow-prompt-input--inline\",\n isInvalid && \"ow-prompt-input--invalid\",\n disabled && \"ow-prompt-input--disabled\",\n isDragging && \"ow-prompt-input--dragging\",\n className,\n )}\n style={{ \"--ow-prompt-min-rows\": rows, \"--ow-prompt-max-rows\": maxRowCount } as CSSProperties}\n >\n <fieldset\n role=\"presentation\"\n className=\"ow-prompt-input__box\"\n disabled={disabled}\n onMouseDown={handleMouseDown}\n onDragEnter={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n dragDepth.current += 1;\n setIsDragging(true);\n }}\n onDragOver={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }}\n onDragLeave={() => {\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) setIsDragging(false);\n }}\n onDrop={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n dragDepth.current = 0;\n setIsDragging(false);\n take(Array.from(event.dataTransfer.files));\n }}\n >\n {attachments.length ? (\n <ul ref={listRef} className=\"ow-prompt-input__attachments\" aria-label=\"Attachments\">\n {attachments.map((attachment, index) => {\n const [base, extension] = splitName(attachment.name);\n return (\n <li key={attachment.id} className=\"ow-prompt-input__attachment\">\n <span className=\"ow-prompt-input__thumb\" aria-hidden=\"true\">\n {fileIcons[kindOf(attachment)]}\n {attachment.previewUrl ? (\n <img\n src={attachment.previewUrl}\n alt=\"\"\n onError={(event) => {\n event.currentTarget.hidden = true;\n }}\n />\n ) : null}\n </span>\n <span className=\"ow-prompt-input__file\">\n <span className=\"ow-prompt-input__file-name\" title={attachment.name}>\n <span className=\"ow-prompt-input__file-base\">{base}</span>\n {extension}\n </span>\n {attachment.size !== undefined ? (\n <span className=\"ow-prompt-input__file-size\">{formatBytes(attachment.size, locale)}</span>\n ) : null}\n </span>\n {onRemoveAttachment ? (\n <button\n type=\"button\"\n className=\"ow-prompt-input__remove\"\n aria-label={`Remove ${attachment.name}`}\n onClick={() => remove(attachment, index)}\n >\n <XIcon size={14} />\n </button>\n ) : null}\n </li>\n );\n })}\n </ul>\n ) : null}\n\n <Textarea\n ref={setTextAreaRef}\n className=\"ow-prompt-input__textarea\"\n bare\n autoGrow\n autoGrowMaxHeight={`calc(var(--ow-prompt-line) * ${maxRowCount} + 2 * var(--ow-prompt-pad))`}\n rows={rows}\n id={id}\n value={text}\n placeholder={placeholder}\n aria-label={name}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n isInvalid={isInvalid}\n disabled={disabled}\n autoFocus={autoFocus}\n maxLength={maxLength}\n enterKeyHint=\"send\"\n onChange={(event) => setText(event.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onCompositionStart={() => {\n composing.current = true;\n }}\n onCompositionEnd={() => {\n composing.current = false;\n }}\n />\n\n <div className=\"ow-prompt-input__toolbar\" data-prompt-blank=\"\">\n {toolbarStart ? (\n <div className=\"ow-prompt-input__start\" data-prompt-blank=\"\">\n {attachButton}\n {startActions}\n </div>\n ) : null}\n <div className=\"ow-prompt-input__end\" data-prompt-blank=\"\">\n {showCounter ? (\n <span className={cx(\"ow-prompt-input__counter\", remaining === 0 && \"ow-prompt-input__counter--full\")} aria-hidden=\"true\">\n {number(text.length)} / {number(maxLength!)}\n </span>\n ) : null}\n {endActions}\n {actionButton}\n </div>\n </div>\n\n {onAttach ? (\n <input\n ref={pickerRef}\n type=\"file\"\n hidden\n tabIndex={-1}\n accept={accept}\n multiple={multiple}\n onChange={(event) => {\n take(Array.from(event.target.files ?? []));\n event.target.value = \"\";\n textAreaRef.current?.focus();\n }}\n />\n ) : null}\n\n {isDragging ? (\n <div className=\"ow-prompt-input__drop\" aria-hidden=\"true\">\n <UploadIcon size={16} />\n Drop to attach\n </div>\n ) : null}\n </fieldset>\n\n {shownHint ? (\n <div\n className={cx(\"ow-prompt-input__hint\", notice && \"ow-prompt-input__hint--notice\")}\n id={notice ? undefined : hintId}\n aria-hidden={notice ? true : undefined}\n >\n {shownHint}\n </div>\n ) : null}\n <span className=\"ow-visually-hidden\" role=\"status\">\n {announcement}\n </span>\n </div>\n );\n});\n", "import { forwardRef, type ButtonHTMLAttributes, type CSSProperties, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { buttonClassName } from \"../Button/Button\";\n\nexport interface PromptSuggestionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** The suggested prompt, or a short title for it. Keep it to a few words on a pill. */\n children: ReactNode;\n /** A 16px lucide-react icon before the text. */\n icon?: ReactNode;\n /** A muted second line under the text, saying what the agent will do. Shown on cards. */\n description?: ReactNode;\n /** `pill` for a row of short prompts; `card` for a few larger starting points, each with a description.\n * @default \"card\" with a description, otherwise \"pill\" */\n variant?: \"pill\" | \"card\";\n}\n\n/**\n * A suggested prompt to start from: a quiet pill, or a card with a second line. It's a button: what it does on click,\n * filling the prompt box or sending at once, is up to you.\n */\nexport const PromptSuggestion = /* @__PURE__ */ forwardRef<HTMLButtonElement, PromptSuggestionProps>(function PromptSuggestion(\n { children, icon, description, variant = description ? \"card\" : \"pill\", type = \"button\", className, ...buttonProps },\n ref,\n) {\n if (variant === \"card\") {\n return (\n <button ref={ref} type={type} className={cx(\"ow-prompt-suggestion\", \"ow-prompt-suggestion--card\", className)} {...buttonProps}>\n {icon ? <span className=\"ow-prompt-suggestion__icon\">{icon}</span> : null}\n <span className=\"ow-prompt-suggestion__text\">\n <span className=\"ow-prompt-suggestion__title\">{children}</span>\n {description ? <span className=\"ow-prompt-suggestion__description\">{description}</span> : null}\n </span>\n </button>\n );\n }\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n buttonClassName({ variant: \"secondary\", size: \"sm\", shape: \"pill\" }),\n \"ow-prompt-suggestion\",\n \"ow-prompt-suggestion--pill\",\n className,\n )}\n {...buttonProps}\n >\n {icon ? <span className=\"ow-prompt-suggestion__icon\">{icon}</span> : null}\n <span className=\"ow-prompt-suggestion__label\">{children}</span>\n </button>\n );\n});\n\nexport interface PromptSuggestionsProps extends HTMLAttributes<HTMLDivElement> {\n /** PromptSuggestion buttons. */\n children: ReactNode;\n /** `wrap` runs pills along a line and onto the next; `grid` sets cards in equal columns that fold to one when\n * there's no room.\n * @default \"wrap\" */\n layout?: \"wrap\" | \"grid\";\n /** The most columns in a grid. Columns are at least 200px wide, so a narrow grid has fewer.\n * @default 2 */\n columns?: number;\n /** Where wrapped pills line up.\n * @default \"start\" */\n align?: \"start\" | \"center\";\n /** Names the set for screen readers.\n * @default \"Suggested prompts\" */\n \"aria-label\"?: string;\n}\n\n/** Suggested prompts, as a labelled group: pills that wrap, or cards in a grid. */\nexport function PromptSuggestions({\n children,\n layout = \"wrap\",\n columns = 2,\n align = \"start\",\n \"aria-label\": ariaLabel = \"Suggested prompts\",\n className,\n style,\n ...props\n}: PromptSuggestionsProps) {\n return (\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className={cx(\"ow-prompt-suggestions\", `ow-prompt-suggestions--${layout}`, align === \"center\" && \"ow-prompt-suggestions--center\", className)}\n style={layout === \"grid\" ? ({ \"--ow-suggestion-columns\": Math.max(1, Math.round(columns)), ...style } as CSSProperties) : style}\n {...props}\n >\n {children}\n </div>\n );\n}\n", "import {\n Children,\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from \"react\";\n\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { ArrowDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface ChatConversationProps extends HTMLAttributes<HTMLDivElement> {\n /** The messages: ChatMessages, a ChatLoader, anything else in the column. */\n children?: ReactNode;\n /** Shown in place of the messages while there are none: a greeting, suggestions, an EmptyState. */\n empty?: ReactNode;\n /** Docked under the messages and lined up with them, outside the log: usually a PromptInput. It stays in view while\n * the messages scroll, and Jump to latest floats above it. */\n footer?: ReactNode;\n /** Names the conversation for screen readers.\n * @default \"Conversation\" */\n \"aria-label\"?: string;\n /** The id of a visible heading that names the conversation, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** `comfortable` keeps the messages in a 720px column in the middle, for reading; `full` lets them use the whole\n * width, for a narrow side panel.\n * @default \"comfortable\" */\n width?: \"comfortable\" | \"full\";\n /** The words on the button that appears once the reader scrolls up.\n * @default \"Jump to latest\" */\n jumpLabel?: string;\n /** How that button counts the messages that arrived while the reader was scrolled up.\n * @default (count) => `${count} new` */\n formatNewCount?(count: number): string;\n}\n\nexport interface ChatConversationHandle {\n /** Scrolls to the newest message and follows new content again: smoothly, or at once under reduced motion. Call it\n * when the person sends a message, so they see their own words and the answer. */\n scrollToBottom(options?: { behavior?: ScrollBehavior }): void;\n}\n\n/** What messages inside a conversation need from it. */\ninterface ChatConversationContextValue {\n /** True once the first messages have painted: messages that mount after that animate in. */\n ready: MutableRefObject<boolean>;\n /** A message mounted; it counts as new while the reader is scrolled up. Returns the cleanup for when it goes. */\n register(id: string): () => void;\n}\n\n/** @internal */\nexport const ChatConversationContext = /* @__PURE__ */ createContext<ChatConversationContextValue | null>(null);\n\n/** How close to the bottom, in pixels, still counts as reading the latest. */\nconst stickyDistance = 32;\n\nconst defaultCount = (count: number) => `${count} new`;\n\nconst prefersReducedMotion = () => typeof window !== \"undefined\" && Boolean(window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches);\n\n/**\n * The scrolling column of a chat. It follows the newest content while the reader is at the bottom (new messages, an\n * answer that's still streaming), stops as soon as they scroll up to read, and offers a \"Jump to latest\" button to\n * come back. It's a polite live region (role=\"log\"), so screen readers hear messages as they're added.\n */\nexport const ChatConversation = /* @__PURE__ */ forwardRef<ChatConversationHandle, ChatConversationProps>(function ChatConversation(\n {\n children,\n empty,\n footer,\n \"aria-label\": ariaLabel = \"Conversation\",\n \"aria-labelledby\": ariaLabelledBy,\n width = \"comfortable\",\n jumpLabel = \"Jump to latest\",\n formatNewCount = defaultCount,\n className,\n ...props\n },\n ref,\n) {\n const scrollerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const jumpRef = useRef<HTMLButtonElement>(null);\n const following = useRef(true);\n const lastTop = useRef(0);\n const ready = useRef(false);\n const unseen = useRef(new Set<string>());\n const [isFollowing, setIsFollowing] = useState(true);\n const [newCount, setNewCount] = useState(0);\n const isEmpty = Children.toArray(children).length === 0;\n\n const follow = useCallback((next: boolean) => {\n following.current = next;\n setIsFollowing(next);\n if (next && unseen.current.size > 0) {\n unseen.current.clear();\n setNewCount(0);\n }\n }, []);\n\n // Pins the view to the bottom at once. Following never animates, so a streaming answer never lags behind.\n const stick = useCallback(() => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n scroller.scrollTop = scroller.scrollHeight;\n lastTop.current = scroller.scrollTop;\n }, []);\n\n const scrollToBottom = useCallback(\n (options?: { behavior?: ScrollBehavior }) => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n follow(true);\n scroller.scrollTo({ top: scroller.scrollHeight, behavior: options?.behavior ?? (prefersReducedMotion() ? \"auto\" : \"smooth\") });\n },\n [follow],\n );\n\n useImperativeHandle(ref, () => ({ scrollToBottom }), [scrollToBottom]);\n\n // Opens at the newest message.\n useLayoutEffect(stick, [stick]);\n\n useEffect(() => {\n ready.current = true;\n }, []);\n\n // Follows whatever changes the size, whether or not this renders: a new message, a streaming answer, a code block\n // loading, the frame shrinking as the prompt box grows below. It runs before paint, so nothing lags a frame behind.\n useEffect(() => {\n const scroller = scrollerRef.current;\n const content = contentRef.current;\n if (!scroller || !content || typeof ResizeObserver === \"undefined\") return undefined;\n const observer = new ResizeObserver(() => {\n if (following.current) stick();\n });\n observer.observe(content);\n observer.observe(scroller);\n return () => observer.disconnect();\n }, [stick]);\n\n function onScroll() {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n const top = scroller.scrollTop;\n const distance = scroller.scrollHeight - top - scroller.clientHeight;\n // Any move up is the reader looking back. (Content shrinking under them only clamps them to the bottom.)\n if (top < lastTop.current && distance > 1) {\n if (following.current) follow(false);\n } else if (distance <= stickyDistance && !following.current) {\n follow(true);\n }\n lastTop.current = top;\n }\n\n const context = useMemo<ChatConversationContextValue>(\n () => ({\n ready,\n register(id) {\n if (ready.current && !following.current) {\n unseen.current.add(id);\n setNewCount(unseen.current.size);\n }\n return () => {\n if (unseen.current.delete(id)) setNewCount(unseen.current.size);\n };\n },\n }),\n [],\n );\n\n const showJump = !isFollowing && !isEmpty;\n const jump = usePresence(showJump);\n\n return (\n <div className={cx(\"ow-chat-conversation\", width === \"full\" && \"ow-chat-conversation--full\", className)} {...props}>\n <div className=\"ow-chat-conversation__viewport\">\n <div\n ref={scrollerRef}\n className=\"ow-chat-conversation__scroll\"\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n // A tab stop, so the conversation scrolls from the keyboard.\n tabIndex={isEmpty ? undefined : 0}\n onScroll={onScroll}\n >\n <div ref={contentRef} className=\"ow-chat-conversation__content\">\n <ChatConversationContext.Provider value={context}>{children}</ChatConversationContext.Provider>\n </div>\n </div>\n {isEmpty && empty ? (\n <div className=\"ow-chat-conversation__empty\">\n <div className=\"ow-chat-conversation__empty-inner\">{empty}</div>\n </div>\n ) : null}\n {jump.mounted ? (\n <div className=\"ow-chat-conversation__jump\" data-state={jump.state}>\n <Button\n ref={jumpRef}\n size=\"sm\"\n shape=\"pill\"\n startIcon={<ArrowDownIcon size={16} />}\n aria-label={newCount > 0 ? `${jumpLabel}, ${formatNewCount(newCount)}` : jumpLabel}\n tabIndex={showJump ? undefined : -1}\n onClick={() => {\n // The button goes once the view is at the bottom: keep keyboard focus in the conversation.\n if (document.activeElement === jumpRef.current) scrollerRef.current?.focus({ preventScroll: true });\n scrollToBottom();\n }}\n >\n {jumpLabel}\n {newCount > 0 ? <span className=\"ow-chat-conversation__count\">{formatNewCount(newCount)}</span> : null}\n </Button>\n </div>\n ) : null}\n </div>\n {footer != null && footer !== false ? (\n <div className=\"ow-chat-conversation__footer\">\n <div className=\"ow-chat-conversation__footer-inner\">{footer}</div>\n </div>\n ) : null}\n </div>\n );\n});\n", "import {\n forwardRef,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n type RefObject,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, CircleAlertIcon, CopyIcon, type IconProps } from \"../../icons\";\nimport { copyText } from \"../../utils/copyText\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\nimport { ToggleButton } from \"../Button/ButtonGroup\";\nimport { Toolbar } from \"../Toolbar/Toolbar\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { ChatConversationContext } from \"./ChatConversation\";\n\n/* Lucide shapes (ISC licence) the chat draws itself, like src/icons.tsx. */\nfunction lucide(paths: ReactNode) {\n return function Icon({ size = 16, strokeWidth = 2, ...props }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n {paths}\n </svg>\n );\n };\n}\n\nconst BotIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M12 8V4H8\" />\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\" />\n <path d=\"M2 14h2\" />\n <path d=\"M20 14h2\" />\n <path d=\"M15 13v2\" />\n <path d=\"M9 13v2\" />\n </>,\n);\nconst RotateCcwIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </>,\n);\nconst ThumbsUpIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\" />\n <path d=\"M7 10v12\" />\n </>,\n);\nconst ThumbsDownIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\" />\n <path d=\"M17 14V2\" />\n </>,\n);\nconst PencilIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\n </>,\n);\n\nexport interface ChatAgentAvatarProps {\n /** sm 24px, md 28px beside a message, lg 36px in a page or panel header: the sizes of Avatar.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Give it when the avatar stands alone; beside the agent's name, leave it out and it's hidden from screen readers. */\n label?: string;\n className?: string;\n}\n\nconst botSizes = { sm: 14, md: 16, lg: 18 };\n\n/**\n * The agent's avatar: a bot icon on a tinted circle, in the sizes of Avatar. Messages and the loader show it by\n * default; use it wherever else the agent appears, such as a chat's header.\n */\nexport function ChatAgentAvatar({ size = \"md\", label, className }: ChatAgentAvatarProps) {\n return (\n <span\n className={cx(\"ow-chat-avatar\", size !== \"md\" && `ow-chat-avatar--${size}`, className)}\n role={label ? \"img\" : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n >\n <BotIcon size={botSizes[size]} />\n </span>\n );\n}\n\n/**\n * Whether this message or loader should animate in: only when it arrives in a conversation that's already showing,\n * not for the history it opens with.\n * @internal\n */\nexport function useChatEntrance(): boolean {\n const conversation = useContext(ChatConversationContext);\n const [entering] = useState(() => conversation?.ready.current ?? false);\n return entering;\n}\n\nconst formatters = new Map<string, { short: Intl.DateTimeFormat; full: Intl.DateTimeFormat }>();\n\nfunction formattersFor(locale: string | undefined) {\n const key = locale ?? \"\";\n let entry = formatters.get(key);\n if (!entry) {\n entry = {\n short: new Intl.DateTimeFormat(locale, { timeStyle: \"short\" }),\n full: new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeStyle: \"short\" }),\n };\n formatters.set(key, entry);\n }\n return entry;\n}\n\n/** A short local time (\"14:02\" in en-GB, \"2:02 PM\" in en-US) for a Date or ISO string; anything unparseable shows as given. */\nfunction MessageTime({ time, locale }: { time: Date | string; locale?: string }) {\n const date = typeof time === \"string\" ? new Date(time) : time;\n if (Number.isNaN(date.getTime())) {\n return <time className=\"ow-chat-message__time\">{String(time)}</time>;\n }\n const { short, full } = formattersFor(locale);\n return (\n <time className=\"ow-chat-message__time\" dateTime={date.toISOString()} title={full.format(date)}>\n {short.format(date)}\n </time>\n );\n}\n\n/** Text inside these isn't where the writing is happening. */\nconst skipCaret = '[aria-hidden=\"true\"], .ow-visually-hidden';\n\n/**\n * Keeps the streaming caret just after the last character of the content, wherever that is: a plain string, the\n * last paragraph of rendered Markdown, a code block. It follows the content as it changes and as it reflows.\n */\nfunction useStreamingCaret(bodyRef: RefObject<HTMLElement>, contentRef: RefObject<HTMLElement>, caretRef: RefObject<HTMLElement>, active: boolean) {\n useLayoutEffect(() => {\n const body = bodyRef.current;\n const content = contentRef.current;\n const caret = caretRef.current;\n if (!active || !body || !content || !caret) return undefined;\n\n const place = () => {\n const walker = document.createTreeWalker(content, NodeFilter.SHOW_TEXT, {\n acceptNode: (node) => (node.nodeValue?.trim() && !node.parentElement?.closest(skipCaret) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT),\n });\n const last = walker.lastChild() as Text | null;\n const box = body.getBoundingClientRect();\n if (!last) {\n // Nothing written yet: the caret waits where the first word will go.\n caret.style.transform = \"\";\n caret.style.removeProperty(\"height\");\n caret.style.removeProperty(\"color\");\n caret.hidden = false;\n return;\n }\n const end = last.data.trimEnd().length;\n const range = document.createRange();\n range.setStart(last, end - 1);\n range.setEnd(last, end);\n const rects = range.getClientRects();\n const rect = rects[rects.length - 1];\n if (!rect) {\n caret.hidden = true;\n return;\n }\n const x = Math.min(rect.right - box.left + 2, box.width - 2);\n caret.hidden = false;\n caret.style.transform = `translate(${Math.round(x)}px, ${Math.round(rect.top - box.top)}px)`;\n caret.style.height = `${Math.round(rect.height)}px`;\n caret.style.color = getComputedStyle(last.parentElement ?? content).color;\n };\n\n place();\n const mutations = new MutationObserver(place);\n mutations.observe(content, { subtree: true, childList: true, characterData: true });\n const resizes = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(place);\n resizes?.observe(body);\n return () => {\n mutations.disconnect();\n resizes?.disconnect();\n };\n }, [active, bodyRef, contentRef, caretRef]);\n}\n\nexport type ChatMessageFrom = \"user\" | \"assistant\" | \"system\";\nexport type ChatMessageStatus = \"streaming\" | \"done\" | \"error\";\n\nexport interface ChatMessageProps extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n /** Who it's from. `user`: the person, in a bubble on the right. `assistant`: the agent, full width beside its\n * avatar. `system`: a muted line in the middle, between hairlines, for things that happened (\"Maya changed the\n * model to Claude Sonnet\"). */\n from: ChatMessageFrom;\n /** The message. A person's plain text keeps its line breaks; give an agent's formatted answer as Prose, and put\n * paragraphs in Text so blocks sit 12px apart. */\n children?: ReactNode;\n /** Shown above the message: \"Acme agent\", \"Maya Chen\". Left out, screen readers hear \"You\" or \"Agent\" instead. */\n name?: ReactNode;\n /** The agent's bot tile by default; any node (an Avatar) in its place, or null for none. A person's message shows one\n * only when you give it. */\n avatar?: ReactNode;\n /** When it was sent, as a Date or an ISO string. It shows as a short local time, with the full date on hover. */\n time?: Date | string;\n /** The locale for the time, such as \"en-GB\". Defaults to the browser's. */\n locale?: string;\n /** `streaming` while the text is still arriving: a soft caret blinks after it and the message is aria-busy.\n * `error` shows a line saying what went wrong, with Retry when you pass `onRetry`.\n * @default \"done\" */\n status?: ChatMessageStatus;\n /** What went wrong, for `status=\"error\"`.\n * @default \"The answer didn't finish.\" for the agent, \"Couldn't send this message.\" for a person */\n error?: ReactNode;\n /** Shows a Retry button on the error line. */\n onRetry?(): void;\n /** The Retry button's words, for another language.\n * @default \"Retry\" */\n retryLabel?: string;\n /** Actions under the message, usually a ChatMessageActions. They wait until the message has finished streaming. */\n actions?: ReactNode;\n /** `hover` shows the actions while the message is hovered or has focus, and always on touch screens. `always` keeps\n * them in view, for the latest answer.\n * @default \"hover\" */\n showActions?: \"hover\" | \"always\";\n}\n\n/**\n * One message in a conversation: the person's in a bubble on the right, the agent's across the full width with its\n * avatar, name and time, or a system line in the middle. It shows a caret while the answer streams, an error with\n * Retry when it fails, and its actions on hover.\n */\nexport const ChatMessage = /* @__PURE__ */ forwardRef<HTMLElement, ChatMessageProps>(function ChatMessage(\n { from, children, name, avatar, time, locale, status = \"done\", error, onRetry, retryLabel = \"Retry\", actions, showActions = \"hover\", className, ...props },\n ref,\n) {\n const conversation = useContext(ChatConversationContext);\n const entering = useChatEntrance();\n const id = useId();\n const bodyRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const streaming = status === \"streaming\";\n\n useEffect(() => conversation?.register(id), [conversation, id]);\n useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== \"system\");\n\n if (from === \"system\") {\n return (\n <div\n ref={ref as Ref<HTMLDivElement>}\n className={cx(\"ow-chat-message\", \"ow-chat-message--system\", entering && \"ow-chat-message--enter\", className)}\n {...props}\n >\n <span className=\"ow-chat-message__system-text\">\n {children}\n {time !== undefined ? (\n <>\n <span aria-hidden=\"true\"> \u00B7 </span>\n <MessageTime time={time} locale={locale} />\n </>\n ) : null}\n </span>\n </div>\n );\n }\n\n const isUser = from === \"user\";\n const avatarNode = avatar !== undefined ? avatar : isUser ? null : <ChatAgentAvatar />;\n const hasHeader = name != null || time !== undefined;\n const errorText = error ?? (isUser ? \"Couldn't send this message.\" : \"The answer didn't finish.\");\n\n return (\n <article\n ref={ref}\n className={cx(\n \"ow-chat-message\",\n `ow-chat-message--${from}`,\n entering && \"ow-chat-message--enter\",\n streaming && \"ow-chat-message--streaming\",\n status === \"error\" && \"ow-chat-message--error\",\n showActions === \"always\" && \"ow-chat-message--actions-always\",\n className,\n )}\n aria-busy={streaming || undefined}\n {...props}\n >\n {avatarNode != null && avatarNode !== false ? <div className=\"ow-chat-message__avatar\">{avatarNode}</div> : null}\n <div className=\"ow-chat-message__main\">\n {hasHeader ? (\n <div className=\"ow-chat-message__header\">\n {name != null ? (\n <span className=\"ow-chat-message__name\">{name}</span>\n ) : (\n <span className=\"ow-visually-hidden\">{isUser ? \"You\" : \"Agent\"}</span>\n )}\n {time !== undefined ? <MessageTime time={time} locale={locale} /> : null}\n </div>\n ) : (\n <span className=\"ow-visually-hidden\">{isUser ? \"You\" : \"Agent\"}</span>\n )}\n <div ref={bodyRef} className=\"ow-chat-message__body\">\n <div ref={contentRef} className=\"ow-chat-message__content\">\n {children}\n </div>\n {streaming ? <span ref={caretRef} className=\"ow-chat-message__caret\" aria-hidden=\"true\" /> : null}\n </div>\n {status === \"error\" ? (\n <div className={cx(\"ow-chat-message__error\", onRetry && \"ow-chat-message__error--retry\")}>\n <CircleAlertIcon size={16} className=\"ow-chat-message__error-icon\" />\n <span className=\"ow-chat-message__error-text\">{errorText}</span>\n {onRetry ? (\n <Button size=\"sm\" startIcon={<RotateCcwIcon size={16} />} onClick={onRetry}>\n {retryLabel}\n </Button>\n ) : null}\n </div>\n ) : null}\n {actions && !streaming ? <div className=\"ow-chat-message__actions\">{actions}</div> : null}\n </div>\n </article>\n );\n});\n\nexport type ChatRating = \"up\" | \"down\";\n\nexport interface ChatMessageActionsProps {\n /** The message as plain text. Shows Copy, which copies it and says \"Copied\" for two seconds. */\n copyText?: string;\n /** Shows Edit, for the person's own messages. */\n onEdit?(): void;\n /** Shows Retry, to ask for the answer again. */\n onRetry?(): void;\n /** Shows Good response and Bad response. Called with the one pressed, or null when the pressed one is pressed again. */\n onRate?(rating: ChatRating | null): void;\n /** Which rating is pressed, when you keep it yourself. */\n rating?: ChatRating | null;\n /** The starting rating when uncontrolled.\n * @default null */\n defaultRating?: ChatRating | null;\n /** More actions after these: ghost, sm, icon-only Buttons, each in a Tooltip with its aria-label. */\n children?: ReactNode;\n /** The buttons' words, for another language. */\n labels?: Partial<Record<\"copy\" | \"copied\" | \"edit\" | \"retry\" | \"good\" | \"bad\", string>>;\n /** Names the toolbar for screen readers.\n * @default \"Message actions\" */\n \"aria-label\"?: string;\n className?: string;\n}\n\nconst defaultLabels = { copy: \"Copy\", copied: \"Copied\", edit: \"Edit\", retry: \"Retry\", good: \"Good response\", bad: \"Bad response\" };\n\nfunction CopyAction({ text, label, copiedLabel }: { text: string; label: string; copiedLabel: string }) {\n const [copied, setCopied] = useState(false);\n const timer = useRef(0);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n const current = copied ? copiedLabel : label;\n return (\n <>\n <Tooltip label={current}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={current}\n className={cx(\"ow-chat-actions__copy\", copied && \"ow-chat-actions__copy--copied\")}\n onClick={async () => {\n if (await copyText(text)) {\n setCopied(true);\n window.clearTimeout(timer.current);\n timer.current = window.setTimeout(() => setCopied(false), 2000);\n }\n }}\n >\n <span className=\"ow-chat-actions__copy-icon\">\n <CopyIcon size={16} />\n <CheckIcon size={16} />\n </span>\n </Button>\n </Tooltip>\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {copied ? copiedLabel : \"\"}\n </span>\n </>\n );\n}\n\n/**\n * The row of small actions under a message: Copy, Edit, Retry, and Good or Bad response. Only the ones you give a\n * callback (or `copyText`) appear. It's a toolbar: one tab stop, with the arrow keys moving between the buttons.\n */\nexport function ChatMessageActions({\n copyText: text,\n onEdit,\n onRetry,\n onRate,\n rating,\n defaultRating = null,\n children,\n labels,\n \"aria-label\": ariaLabel = \"Message actions\",\n className,\n}: ChatMessageActionsProps) {\n const words = { ...defaultLabels, ...labels };\n const [current, setCurrent] = useControllableState<ChatRating | null>(rating, defaultRating, onRate);\n\n const rate = (value: ChatRating, label: string, Icon: typeof ThumbsUpIcon) => {\n const pressed = current === value;\n return (\n <Tooltip label={label}>\n <ToggleButton\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={label}\n pressed={pressed}\n className=\"ow-chat-actions__rate\"\n onPressedChange={() => setCurrent(pressed ? null : value)}\n >\n <Icon size={16} />\n </ToggleButton>\n </Tooltip>\n );\n };\n\n return (\n <Toolbar variant=\"plain\" size=\"sm\" aria-label={ariaLabel} className={cx(\"ow-chat-actions\", className)}>\n {text !== undefined ? <CopyAction text={text} label={words.copy} copiedLabel={words.copied} /> : null}\n {onEdit ? (\n <Tooltip label={words.edit}>\n <Button variant=\"ghost\" size=\"sm\" iconOnly aria-label={words.edit} onClick={onEdit}>\n <PencilIcon size={16} />\n </Button>\n </Tooltip>\n ) : null}\n {onRetry ? (\n <Tooltip label={words.retry}>\n <Button variant=\"ghost\" size=\"sm\" iconOnly aria-label={words.retry} onClick={onRetry}>\n <RotateCcwIcon size={16} />\n </Button>\n </Tooltip>\n ) : null}\n {onRate ? (\n <>\n {rate(\"up\", words.good, ThumbsUpIcon)}\n {rate(\"down\", words.bad, ThumbsDownIcon)}\n </>\n ) : null}\n {children}\n </Toolbar>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\nimport { ChatAgentAvatar, useChatEntrance } from \"./ChatMessage\";\n\nexport interface ChatLoaderProps {\n /** Words in place of the dots, with a shimmer across them: \"Thinking\u2026\", \"Reading the codebase\u2026\". */\n label?: ReactNode;\n /** Just the dots or the label, without a message's avatar and spacing: for inside a message, a step or a status bar.\n * @default false */\n inline?: boolean;\n /** The agent's name above, as on its messages: \"Acme agent\". */\n name?: ReactNode;\n /** The agent's bot tile by default; any node in its place, or null for none. */\n avatar?: ReactNode;\n /** What screen readers hear while the dots show. With a `label`, they hear the label.\n * @default \"Working\u2026\" */\n srLabel?: string;\n className?: string;\n}\n\n/**\n * The agent is working and nothing has arrived yet: three dots that pulse in turn, or a shimmering label such as\n * \"Thinking\u2026\". It sits in the conversation like the agent's next message, so the answer takes its place without a jump.\n */\nexport function ChatLoader({ label, inline = false, name, avatar, srLabel = \"Working\u2026\", className }: ChatLoaderProps) {\n const entering = useChatEntrance();\n const indicator =\n label != null ? (\n <TextShimmer className=\"ow-chat-loader__label\">{label}</TextShimmer>\n ) : (\n <span className=\"ow-chat-loader__dots\">\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-visually-hidden\">{srLabel}</span>\n </span>\n );\n\n if (inline) {\n return (\n <span role=\"status\" className={cx(\"ow-chat-loader\", \"ow-chat-loader--inline\", className)}>\n {indicator}\n </span>\n );\n }\n\n const avatarNode = avatar === undefined ? <ChatAgentAvatar /> : avatar;\n return (\n <div role=\"status\" className={cx(\"ow-chat-message\", \"ow-chat-message--assistant\", \"ow-chat-loader\", entering && \"ow-chat-loader--enter\", className)}>\n {avatarNode != null && avatarNode !== false ? <div className=\"ow-chat-message__avatar\">{avatarNode}</div> : null}\n <div className=\"ow-chat-message__main\">\n {name != null ? (\n <div className=\"ow-chat-message__header\">\n <span className=\"ow-chat-message__name\">{name}</span>\n </div>\n ) : null}\n <div className=\"ow-chat-loader__line\">{indicator}</div>\n </div>\n </div>\n );\n}\n", "import { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, ChevronRightIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\nimport { CodeBlock, Snippet } from \"../CodeBlock/CodeBlock\";\nimport { Code } from \"../Kbd/Kbd\";\nimport { Spinner } from \"../Spinner/Spinner\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\n\n/**\n * Where a tool call or a step has got to. `approval` waits for a person to approve it; `cancelled` didn't run or didn't\n * finish because a person denied it or stopped the run.\n */\nexport type ChatToolStatus = \"pending\" | \"running\" | \"success\" | \"error\" | \"approval\" | \"cancelled\";\n\n/* Pieces shared with ChainOfThought and ChatSources: the status mark, durations and the collapsing panel. */\n\nconst statusWords: Record<ChatToolStatus, string> = {\n pending: \"Not started\",\n running: \"Running\",\n success: \"Done\",\n error: \"Failed\",\n approval: \"Needs approval\",\n cancelled: \"Cancelled\",\n};\n\n/** A slash across the ring: it was called off. */\nfunction SlashIcon() {\n return (\n <svg\n width={12}\n height={12}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n\nfunction ExclamationIcon() {\n return (\n <svg\n width={12}\n height={12}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M12 5v9\" />\n <path d=\"M12 19h.01\" />\n </svg>\n );\n}\n\n/** The round mark before a tool call or a step: a spinner, a check, a cross, a \"!\", a slash or a hollow ring, with its status as words for screen readers. */\nexport function ChatStatusMarker({ status, icon }: { status: ChatToolStatus; icon?: ReactNode }) {\n // A step's own icon stands in for the check or the ring; running, failed and waiting always show their mark.\n const showsIcon = Boolean(icon) && (status === \"success\" || status === \"pending\");\n const glyph =\n status === \"running\" ? (\n <Spinner size=\"sm\" label=\"\" />\n ) : status === \"error\" ? (\n <XIcon size={12} strokeWidth={3} />\n ) : status === \"approval\" ? (\n <ExclamationIcon />\n ) : status === \"cancelled\" ? (\n <SlashIcon />\n ) : showsIcon ? (\n icon\n ) : status === \"success\" ? (\n <CheckIcon size={12} strokeWidth={3} />\n ) : null;\n return (\n <span className={cx(\"ow-chat-status\", `ow-chat-status--${status}`, showsIcon && \"ow-chat-status--icon\")}>\n <span className=\"ow-chat-status__glyph\" aria-hidden=\"true\">\n {glyph}\n </span>\n <span className=\"ow-visually-hidden\">{statusWords[status]}: </span>\n </span>\n );\n}\n\n/** \"380 ms\", \"4.2 s\", \"12 s\", \"1 min 12 s\", \"1 h 4 min\": a duration as people say it, with the locale's digits. */\nexport function formatDuration(ms: number, locale?: string): string {\n const number = (value: number, digits = 0) => new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(value);\n const safe = Math.max(0, ms);\n if (safe < 1000) return `${number(Math.round(safe))} ms`;\n const seconds = safe / 1000;\n if (seconds < 10) return `${number(Math.floor(seconds * 10) / 10, 1)} s`;\n if (seconds < 60) return `${number(Math.floor(seconds))} s`;\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) {\n const rest = Math.floor(seconds % 60);\n return rest ? `${number(minutes)} min ${number(rest)} s` : `${number(minutes)} min`;\n }\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n return rest ? `${number(hours)} h ${number(rest)} min` : `${number(hours)} h`;\n}\n\n/** A duration in a <time> element, so it carries a machine-readable value too. */\nexport function ChatDuration({ ms, locale, className }: { ms: number; locale?: string; className?: string }) {\n return (\n <time dateTime={`PT${Math.max(0, Math.round(ms)) / 1000}S`} className={className}>\n {formatDuration(ms, locale)}\n </time>\n );\n}\n\n/**\n * Open state that follows a status: it opens when `wantsOpen` turns true (an error, a step under way) and closes again\n * when it turns false, unless the person has opened or closed it themselves since. A controlled `expanded` is left alone.\n */\nexport function useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen,\n closeWhenSettled = true,\n initial = wantsOpen,\n}: {\n expanded: boolean | undefined;\n defaultExpanded: boolean | undefined;\n onExpandedChange: ((expanded: boolean) => void) | undefined;\n wantsOpen: boolean;\n closeWhenSettled?: boolean;\n initial?: boolean;\n}): [boolean, () => void] {\n const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded ?? initial, onExpandedChange);\n const touched = useRef(false);\n const previous = useRef(wantsOpen);\n\n useEffect(() => {\n if (previous.current === wantsOpen) return;\n previous.current = wantsOpen;\n if (expanded !== undefined) return;\n if (wantsOpen) {\n touched.current = false;\n setOpen(true);\n } else if (closeWhenSettled && !touched.current) {\n setOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only a change of status moves it.\n }, [wantsOpen]);\n\n return [\n isOpen,\n () => {\n touched.current = true;\n setOpen(!isOpen);\n },\n ];\n}\n\n/**\n * A panel that opens and closes under a disclosure button, animating its height (a 0fr \u2192 1fr grid row). Closed, it's\n * inert: nothing in it can be tabbed to or read out. `bleed` lets focus rings at its edges show past the clip.\n */\nexport function ChatCollapse({\n id,\n open,\n bleed = false,\n className,\n children,\n}: {\n id: string;\n open: boolean;\n bleed?: boolean;\n className?: string;\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (ref.current) ref.current.inert = !open;\n }, [open]);\n return (\n <div ref={ref} id={id} className={cx(\"ow-chat-collapse\", bleed && \"ow-chat-collapse--bleed\")} data-open={open}>\n <div className=\"ow-chat-collapse__clip\">\n <div className={className}>{children}</div>\n </div>\n </div>\n );\n}\n\nexport interface ChatToolProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** What the agent is doing, in words: \"Run the test suite\". */\n title: ReactNode;\n /** The tool it calls, shown in code type beside the title: \"run_tests\". */\n name?: string;\n /** A 15px icon for the tool, before the title. */\n icon?: ReactNode;\n /** Where the call has got to. Running shows a spinner and a shimmering title; `approval` asks the person to approve it;\n * `cancelled` is for a call they denied, or one the run stopped before it finished: say which in `summary`. */\n status: ChatToolStatus;\n /** The result in one line: \"212 tests passed\", \"Read 3 files\". */\n summary?: ReactNode;\n /** How long it took, or has taken so far, in milliseconds. Shown as \"4.2 s\". */\n duration?: number;\n /** What the tool was called with: a one-line string (a command) in a Snippet, a longer one in a code block, or an\n * object as formatted JSON. Shown under \"Input\". */\n input?: string | Record<string, unknown> | unknown[];\n /** What the tool returned: a string in a code block, or any node (a list of files, a link). Shown under \"Output\". */\n output?: ReactNode;\n /** What went wrong, shown in the danger colour under \"Error\". */\n error?: ReactNode;\n /** Whether the input and output show. Leave out to let it follow the status: closed, opening for an error or an approval. */\n expanded?: boolean;\n /** Whether it starts open. Defaults to open for an error or an approval and closed otherwise. */\n defaultExpanded?: boolean;\n /** Called with the new state when it opens or closes, by the person or by a change of status. */\n onExpandedChange?(expanded: boolean): void;\n /** What it asks to do, while `status` is \"approval\". Defaults to \"Wants to run\" and the tool's name. */\n approvalMessage?: ReactNode;\n /** The approve button's label: name the action, e.g. \"Approve and publish\".\n * @default \"Approve\" */\n approveLabel?: string;\n /** The deny button's label, e.g. \"Don't publish\".\n * @default \"Deny\" */\n denyLabel?: string;\n /** Called when the person approves the call. Move `status` on from \"approval\" in response. */\n onApprove?(): void;\n /** Called when the person refuses the call. Move `status` on to \"cancelled\" in response. */\n onDeny?(): void;\n /** The locale for the duration's digits, e.g. \"de-CH\". Defaults to the browser's. */\n locale?: string;\n}\n\n/** The longest an input or output gets before it scrolls. */\nconst codeMaxHeight = 280;\n\nfunction formatInput(input: NonNullable<ChatToolProps[\"input\"]>): string {\n if (typeof input === \"string\") return input;\n try {\n return JSON.stringify(input, null, 2);\n } catch {\n return String(input);\n }\n}\n\n/**\n * One tool call an agent makes: what it's doing, the tool, its status and result on one row, which opens to show the\n * input and output. A failed call opens to its error, and a call that needs approval asks for it with Approve and Deny.\n */\nexport const ChatTool = /* @__PURE__ */ forwardRef<HTMLDivElement, ChatToolProps>(function ChatTool(\n {\n title,\n name,\n icon,\n status,\n summary,\n duration,\n input,\n output,\n error,\n expanded,\n defaultExpanded,\n onExpandedChange,\n approvalMessage,\n approveLabel = \"Approve\",\n denyLabel = \"Deny\",\n onApprove,\n onDeny,\n locale,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const messageRef = useRef<HTMLParagraphElement>(null);\n const decided = useRef(false);\n const [announcement, setAnnouncement] = useState(\"\");\n\n const needsApproval = status === \"approval\";\n const [isOpen, toggle] = useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen: status === \"error\" || needsApproval,\n });\n\n const hasInput = input !== undefined && input !== null && input !== \"\";\n const hasOutput = output !== undefined && output !== null && output !== false && output !== \"\";\n const hasError = error !== undefined && error !== null && error !== false && error !== \"\";\n const hasDetails = hasInput || hasOutput || hasError;\n const hasMeta = Boolean(summary) || duration !== undefined;\n\n // Say politely that the agent is waiting for the person, once the request is on screen. The region starts empty\n // and fills a moment later, so screen readers notice the change even when it mounts already waiting.\n useEffect(() => {\n if (!needsApproval) {\n setAnnouncement(\"\");\n return;\n }\n const timer = window.setTimeout(() => {\n const request = messageRef.current?.textContent?.trim();\n setAnnouncement(`Needs approval. ${request ?? \"\"}`.trim());\n }, 150);\n return () => window.clearTimeout(timer);\n }, [needsApproval]);\n\n // Approving or denying removes the buttons; keep the keyboard on this call rather than losing it to the page.\n useEffect(() => {\n if (needsApproval || !decided.current) return;\n decided.current = false;\n const active = document.activeElement;\n if (!active || active === document.body) (triggerRef.current ?? rootRef.current)?.focus();\n }, [needsApproval]);\n\n const running = status === \"running\";\n const header = (\n <>\n <ChatStatusMarker status={status} />\n {icon ? (\n <span className=\"ow-chat-tool__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"ow-chat-tool__main\">\n <span className=\"ow-chat-tool__heading\">\n <span className=\"ow-chat-tool__title\">{running ? <TextShimmer>{title}</TextShimmer> : title}</span>\n {name ? <Code className=\"ow-chat-tool__name\">{name}</Code> : null}\n </span>\n {hasMeta ? (\n <span className=\"ow-chat-tool__meta\">\n {summary ? <span className=\"ow-chat-tool__summary\">{summary}</span> : null}\n {summary && duration !== undefined ? (\n <span className=\"ow-chat-tool__dot\" aria-hidden=\"true\">\n \u00B7\n </span>\n ) : null}\n {duration !== undefined ? <ChatDuration ms={duration} locale={locale} className=\"ow-chat-tool__duration\" /> : null}\n </span>\n ) : null}\n </span>\n {hasDetails ? (\n <span className=\"ow-chat-tool__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n ) : null}\n </>\n );\n\n return (\n <div\n ref={(element) => {\n rootRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n className={cx(\"ow-chat-tool\", className)}\n data-status={status}\n data-open={hasDetails ? isOpen : undefined}\n aria-busy={running || undefined}\n tabIndex={hasDetails ? undefined : -1}\n {...props}\n >\n {hasDetails ? (\n <button\n ref={triggerRef}\n type=\"button\"\n id={`${id}-trigger`}\n className=\"ow-chat-tool__header ow-chat-tool__header--button\"\n aria-expanded={isOpen}\n aria-controls={`${id}-details`}\n onClick={toggle}\n >\n {header}\n </button>\n ) : (\n <div className=\"ow-chat-tool__header\">{header}</div>\n )}\n\n {hasDetails ? (\n <ChatCollapse id={`${id}-details`} open={isOpen} className=\"ow-chat-tool__details\">\n {hasInput ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Input</span>\n {typeof input === \"string\" && !input.includes(\"\\n\") ? (\n <Snippet value={input} prompt={null} />\n ) : (\n <CodeBlock code={formatInput(input)} language={typeof input === \"string\" ? undefined : \"json\"} maxHeight={codeMaxHeight} />\n )}\n </div>\n ) : null}\n {hasOutput ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Output</span>\n {typeof output === \"string\" ? (\n <CodeBlock code={output} maxHeight={codeMaxHeight} />\n ) : (\n <div className=\"ow-chat-tool__output\">{output}</div>\n )}\n </div>\n ) : null}\n {hasError ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Error</span>\n <div className=\"ow-chat-tool__error\">{error}</div>\n </div>\n ) : null}\n </ChatCollapse>\n ) : null}\n\n {needsApproval ? (\n <div className=\"ow-chat-tool__approval\" role=\"group\" aria-labelledby={`${id}-request`}>\n <p ref={messageRef} id={`${id}-request`} className=\"ow-chat-tool__request\">\n {approvalMessage ??\n (name ? (\n <>\n Wants to run <Code>{name}</Code>\n </>\n ) : (\n \"Wants to go ahead\"\n ))}\n </p>\n <div className=\"ow-chat-tool__actions\">\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={() => {\n decided.current = true;\n onApprove?.();\n }}\n >\n {approveLabel}\n </Button>\n <Button\n size=\"sm\"\n onClick={() => {\n decided.current = true;\n onDeny?.();\n }}\n >\n {denyLabel}\n </Button>\n </div>\n </div>\n ) : null}\n\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {announcement}\n </span>\n </div>\n );\n});\n", "import { forwardRef, useId, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { ChatCollapse, ChatStatusMarker, formatDuration, useStatusExpansion } from \"../ChatTool/ChatTool\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\n\n/** Where the reasoning, or one step of it, has got to. */\nexport type ChainOfThoughtStatus = \"pending\" | \"running\" | \"success\" | \"error\";\n\nexport interface ChainOfThoughtStep {\n /** A stable key for the step, so it keeps its place as steps are added. */\n id: string;\n /** The step in words: \"Find where invoice dates are formatted\". */\n title: ReactNode;\n /** Where the step has got to: a hollow ring, a spinner, a check or a cross. */\n status: ChainOfThoughtStatus;\n /** More about the step under its title: what it found, a file path, a short list. */\n detail?: ReactNode;\n /** A 12px icon in place of the check or the hollow ring, e.g. a search icon. Running and failed steps keep their own mark. */\n icon?: ReactNode;\n}\n\nexport interface ChainOfThoughtProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The plan, in order, each with its status. */\n steps?: ChainOfThoughtStep[];\n /** \"running\" shows \"Thinking\u2026\" with a shimmer and keeps it open; anything else is finished.\n * @default \"success\" */\n status?: ChainOfThoughtStatus;\n /** How long it thought, in milliseconds: \"Thought for 12 s\". */\n duration?: number;\n /** The header's words. Defaults to \"Thinking\u2026\" while running and \"Thought for 12 s\" once done. */\n label?: ReactNode;\n /** The reasoning itself, as text, shown above the steps. It can grow while it streams in. */\n children?: ReactNode;\n /** Whether the reasoning shows. Leave out to let it follow `status`. */\n expanded?: boolean;\n /** Whether it starts open. Defaults to open while running and closed once done. */\n defaultExpanded?: boolean;\n /** Called with the new state when it opens or closes, by the person or by a change of status. */\n onExpandedChange?(expanded: boolean): void;\n /** Folds the reasoning away when `status` turns from \"running\" to done, unless the person has opened or closed it.\n * @default true */\n collapseWhenDone?: boolean;\n /** The locale for the duration's digits, e.g. \"de-CH\". Defaults to the browser's. */\n locale?: string;\n}\n\nconst plural = (count: number, word: string) => `${count} ${word}${count === 1 ? \"\" : \"s\"}`;\n\n/**\n * An agent's reasoning and plan: a \"Thinking\u2026\" header that opens to the reasoning and a list of steps on a thin line,\n * each with its status. It stays open while the agent works and folds to \"Thought for 12 s\" when it's done.\n */\nexport const ChainOfThought = /* @__PURE__ */ forwardRef<HTMLDivElement, ChainOfThoughtProps>(function ChainOfThought(\n {\n steps = [],\n status = \"success\",\n duration,\n label,\n children,\n expanded,\n defaultExpanded,\n onExpandedChange,\n collapseWhenDone = true,\n locale,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const running = status === \"running\";\n const [isOpen, toggle] = useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen: running,\n closeWhenSettled: collapseWhenDone,\n initial: running || !collapseWhenDone,\n });\n\n const hasReasoning = children !== undefined && children !== null && children !== false && children !== \"\";\n const hasBody = hasReasoning || steps.length > 0;\n const finished = steps.filter((step) => step.status === \"success\" || step.status === \"error\").length;\n const failed = steps.filter((step) => step.status === \"error\").length;\n\n const heading = label ?? (running ? \"Thinking\u2026\" : duration !== undefined ? `Thought for ${formatDuration(duration, locale)}` : \"Reasoning\");\n const count = steps.length > 0 ? (running ? `${finished} of ${plural(steps.length, \"step\")}` : plural(steps.length, \"step\")) : null;\n\n const headerText = (\n <span className=\"ow-chat-toggle__text\">\n <span className=\"ow-chain-of-thought__label\">{running ? <TextShimmer>{heading}</TextShimmer> : heading}</span>\n {count ? (\n <span className=\"ow-chat-toggle__meta\">\n <span aria-hidden=\"true\">\u00B7 </span>\n {count}\n {failed > 0 ? <span className=\"ow-chain-of-thought__failed\">, {failed} failed</span> : null}\n </span>\n ) : null}\n </span>\n );\n\n return (\n <div ref={ref} className={cx(\"ow-chain-of-thought\", className)} data-status={status} aria-busy={running || undefined} {...props}>\n {hasBody ? (\n <button type=\"button\" className=\"ow-chat-toggle\" aria-expanded={isOpen} aria-controls={`${id}-body`} onClick={toggle}>\n <span className=\"ow-chat-toggle__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n {headerText}\n </button>\n ) : (\n <div className=\"ow-chat-toggle ow-chain-of-thought__static\">{headerText}</div>\n )}\n {hasBody ? (\n <ChatCollapse id={`${id}-body`} open={isOpen} bleed className=\"ow-chain-of-thought__body\">\n {hasReasoning ? <div className=\"ow-chain-of-thought__reasoning\">{children}</div> : null}\n {steps.length > 0 ? (\n <ol className=\"ow-chain-of-thought__steps\">\n {steps.map((step) => (\n <li key={step.id} className=\"ow-chain-of-thought__step\" data-status={step.status}>\n <ChatStatusMarker status={step.status} icon={step.icon} />\n <div className=\"ow-chain-of-thought__step-body\">\n <span className=\"ow-chain-of-thought__step-title\">\n {step.status === \"running\" ? <TextShimmer>{step.title}</TextShimmer> : step.title}\n </span>\n {step.detail !== undefined && step.detail !== null ? (\n <div className=\"ow-chain-of-thought__detail\">{step.detail}</div>\n ) : null}\n </div>\n </li>\n ))}\n </ol>\n ) : null}\n </ChatCollapse>\n ) : null}\n </div>\n );\n});\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type HTMLAttributes, type MouseEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { ArrowUpRightIcon, ChevronRightIcon, FileIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { linkClassName } from \"../Breadcrumbs/Breadcrumbs\";\nimport { ChatCollapse } from \"../ChatTool/ChatTool\";\n\n/** One source an answer drew on: a file, a pull request, a web page. ChatSource and ChatSources both take it. */\nexport interface ChatSourceItem {\n /** What it is: a function, a pull request's title, a page's title. */\n title: ReactNode;\n /** Where it is, in one line: \"src/billing/invoice.ts \u00B7 lines 40\u201372\", \"Pull request #482\", \"docs.stripe.com\". */\n source?: ReactNode;\n /** A few lines from it, in the preview. ChatSources leaves it out. */\n snippet?: ReactNode;\n /** Where it opens. With it the citation is a link; without, a button. */\n href?: string;\n /** Opens `href` in a new tab, for sources outside your app.\n * @default false */\n external?: boolean;\n /** A 15px icon for the kind of source, beside its title. */\n icon?: ReactNode;\n /** Its number, shown in the citation chip and on its card: [1], [2]. */\n index?: number;\n}\n\nexport interface ChatSourceProps extends ChatSourceItem {\n /** A short name for the chip when there's no `index`: \"invoice.ts\", \"#482\". */\n label?: string;\n /** How a string `snippet` shows: `text` as a quote, `code` in the mono face with its line breaks kept.\n * @default \"text\" */\n snippetFormat?: \"text\" | \"code\";\n /** The words of the preview's link to `href`.\n * @default \"Open\" */\n openLabel?: string;\n /** Called when the chip is pressed, e.g. to show the source in a side panel. On touch, the first press opens the preview instead. */\n onClick?(event: MouseEvent<HTMLElement>): void;\n /** Names the chip for screen readers. Defaults to \"Source 1\", or the label. */\n \"aria-label\"?: string;\n /** Classes for the chip's wrapper, which also holds the preview. */\n className?: string;\n}\n\nconst openDelay = 250;\nconst closeDelay = 150;\n\n/**\n * An inline citation in an answer: a small numbered chip that previews its source on hover, keyboard focus, or a tap,\n * in a card above the page. The chip is a link to the source when it has an `href`; the preview describes it to screen\n * readers without taking focus.\n */\nexport const ChatSource = /* @__PURE__ */ forwardRef<HTMLElement, ChatSourceProps>(function ChatSource(\n {\n title,\n source,\n snippet,\n href,\n external = false,\n icon,\n index,\n label,\n snippetFormat = \"text\",\n openLabel = \"Open\",\n onClick,\n \"aria-label\": ariaLabel,\n className,\n },\n ref,\n) {\n const id = useId();\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const chipRef = useRef<HTMLElement | null>(null);\n const cardRef = useRef<HTMLSpanElement>(null);\n const timer = useRef(0);\n // How the last press started, so a tap can open the preview before it follows the link.\n const pointer = useRef(\"mouse\");\n const [open, setOpen] = useState(false);\n const { mounted, state } = usePresence(open);\n const style = useFloating({ open: mounted, anchorRef: chipRef, floatingRef: cardRef, placement: \"bottom-start\", offset: 6, maxHeight: 360 });\n\n const schedule = (next: boolean, delay: number) => {\n window.clearTimeout(timer.current);\n if (delay === 0) setOpen(next);\n else timer.current = window.setTimeout(() => setOpen(next), delay);\n };\n const close = useCallback(() => {\n window.clearTimeout(timer.current);\n setOpen(false);\n }, []);\n useDismiss(open, [wrapperRef], close);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n const name = ariaLabel ?? (index !== undefined ? `Source ${index}` : (label ?? \"Source\"));\n const describedBy = [`${id}-title`, source ? `${id}-source` : null, snippet ? `${id}-snippet` : null].filter(Boolean).join(\" \");\n const externalProps = external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {};\n\n const chipProps = {\n ref: (element: HTMLElement | null) => {\n chipRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n className: cx(\"ow-chat-source__chip\", index === undefined && \"ow-chat-source__chip--label\", open && \"ow-chat-source__chip--open\"),\n \"aria-label\": name,\n \"aria-describedby\": describedBy,\n onFocus: (event: { currentTarget: HTMLElement }) => {\n if (event.currentTarget.matches(\":focus-visible\")) schedule(true, 0);\n },\n onBlur: () => schedule(false, 0),\n onPointerDown: (event: { pointerType: string }) => {\n pointer.current = event.pointerType;\n },\n onClick: (event: MouseEvent<HTMLElement>) => {\n const tapped = event.detail > 0 && pointer.current !== \"mouse\";\n pointer.current = \"mouse\";\n if (tapped && !open) {\n // The first tap shows the preview; the next one follows the link.\n event.preventDefault();\n schedule(true, 0);\n return;\n }\n if (!href) schedule(true, 0);\n onClick?.(event);\n },\n };\n\n const chipText = <span className=\"ow-chat-source__chip-text\">{index ?? label}</span>;\n\n return (\n <span\n ref={wrapperRef}\n className={cx(\"ow-chat-source\", className)}\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") schedule(true, open ? 0 : openDelay);\n }}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") schedule(false, closeDelay);\n }}\n >\n {href ? (\n <a href={href} {...externalProps} {...chipProps}>\n {chipText}\n </a>\n ) : (\n <button type=\"button\" {...chipProps}>\n {chipText}\n </button>\n )}\n <span ref={cardRef} {...manualPopover} hidden={!mounted} data-state={state} className=\"ow-chat-source-card ow-floating\" style={style}>\n <span className=\"ow-chat-source-card__header\">\n {icon ? (\n <span className=\"ow-chat-source-card__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span id={`${id}-title`} className=\"ow-chat-source-card__title\">\n {title}\n </span>\n </span>\n {source ? (\n <span id={`${id}-source`} className=\"ow-chat-source-card__source\">\n {source}\n </span>\n ) : null}\n {snippet ? (\n <span id={`${id}-snippet`} className={cx(\"ow-chat-source-card__snippet\", `ow-chat-source-card__snippet--${snippetFormat}`)}>\n {snippet}\n </span>\n ) : null}\n {href ? (\n // The chip is the same link, so this one stays out of the tab order.\n <a href={href} {...externalProps} tabIndex={-1} className={cx(linkClassName({ variant: \"standalone\" }), \"ow-chat-source-card__open\")}>\n {openLabel}\n <ArrowUpRightIcon size={13} />\n </a>\n ) : null}\n </span>\n </span>\n );\n});\n\nexport interface ChatSourcesProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The sources, in the order the answer cites them. An `id` keeps each one's place as the list changes. */\n sources: Array<ChatSourceItem & { id?: string }>;\n /** The toggle's words. Defaults to \"3 sources\". */\n label?: ReactNode;\n /** Whether the list shows. */\n expanded?: boolean;\n /** Whether the list starts open.\n * @default false */\n defaultExpanded?: boolean;\n /** Called with the new state when the person opens or closes the list. */\n onExpandedChange?(expanded: boolean): void;\n}\n\n/** The sources under an answer: a \"3 sources\" toggle that opens to a card for each, linking to it when it has an `href`. */\nexport const ChatSources = /* @__PURE__ */ forwardRef<HTMLDivElement, ChatSourcesProps>(function ChatSources(\n { sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props },\n ref,\n) {\n const id = useId();\n const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded, onExpandedChange);\n if (sources.length === 0) return null;\n\n return (\n <div ref={ref} className={cx(\"ow-chat-sources\", className)} {...props}>\n <button type=\"button\" className=\"ow-chat-toggle\" aria-expanded={isOpen} aria-controls={`${id}-list`} onClick={() => setOpen(!isOpen)}>\n <span className=\"ow-chat-toggle__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n <span className=\"ow-chat-toggle__text\">{label ?? `${sources.length} ${sources.length === 1 ? \"source\" : \"sources\"}`}</span>\n </button>\n <ChatCollapse id={`${id}-list`} open={isOpen} bleed className=\"ow-chat-sources__body\">\n <ul className=\"ow-chat-sources__list\">\n {sources.map((item, position) => {\n const content = (\n <>\n <span className=\"ow-chat-sources__lead\">\n {item.index !== undefined ? (\n <span className=\"ow-chat-sources__index\">\n <span className=\"ow-visually-hidden\">Source </span>\n {item.index}\n </span>\n ) : null}\n {item.icon || item.index === undefined ? (\n <span className=\"ow-chat-sources__icon\" aria-hidden=\"true\">\n {item.icon ?? <FileIcon size={15} />}\n </span>\n ) : null}\n </span>\n <span className=\"ow-chat-sources__text\">\n <span className=\"ow-chat-sources__title\">{item.title}</span>\n {item.source ? <span className=\"ow-chat-sources__source\">{item.source}</span> : null}\n </span>\n {item.href && item.external ? (\n <>\n <span className=\"ow-chat-sources__external\" aria-hidden=\"true\">\n <ArrowUpRightIcon size={14} />\n </span>\n <span className=\"ow-visually-hidden\"> (opens in a new tab)</span>\n </>\n ) : null}\n </>\n );\n return (\n <li key={item.id ?? item.index ?? position}>\n {item.href ? (\n <a\n href={item.href}\n className=\"ow-chat-sources__card ow-chat-sources__card--link\"\n {...(item.external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})}\n >\n {content}\n </a>\n ) : (\n <div className=\"ow-chat-sources__card\">{content}</div>\n )}\n </li>\n );\n })}\n </ul>\n </ChatCollapse>\n </div>\n );\n});\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type CSSProperties, type ForwardedRef } from \"react\";\nimport { HexAlphaColorPicker, HexColorInput, HexColorPicker } from \"react-colorful\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating, type Placement } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { ChevronDownIcon, PipetteIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption, EyeDropperResult } from \"./ColorPicker.types\";\nexport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from \"./ColorPicker.types\";\n\nconst swatchColor = (swatch: ColorSwatchOption) => (typeof swatch === \"string\" ? swatch : swatch.color);\nconst swatchName = (swatch: ColorSwatchOption) => (typeof swatch === \"string\" ? swatch : swatch.name);\nconst same = (a: string, b: string) => a.toLowerCase().replace(/^#/, \"\") === b.toLowerCase().replace(/^#/, \"\");\n\n/**\n * Picks a colour: a saturation area and a hue slider (react-colorful, dressed in Openware's look), a hex field,\n * an eyedropper where the browser has one, and optional swatches. The area and sliders work with the arrow keys.\n */\nexport function ColorPicker({\n value,\n defaultValue = \"#312c7e\",\n onChange,\n alpha = false,\n swatches,\n showInput = true,\n eyeDropper = true,\n \"aria-label\": ariaLabel = \"Colour\",\n className,\n}: ColorPickerProps) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const [canPick, setCanPick] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n useEffect(() => setCanPick(typeof window !== \"undefined\" && \"EyeDropper\" in window), []);\n\n // react-colorful names its sliders \"Color\", \"Hue\" and \"Alpha\"; read them out in Openware's words.\n useEffect(() => {\n const names: Record<string, string> = { saturation: \"Colour\", hue: \"Hue\", alpha: \"Opacity\" };\n for (const [part, label] of Object.entries(names)) {\n rootRef.current?.querySelector(`.react-colorful__${part} .react-colorful__interactive`)?.setAttribute(\"aria-label\", label);\n }\n }, [alpha]);\n const Picker = alpha ? HexAlphaColorPicker : HexColorPicker;\n const change = (next: string) => setColor(next.toLowerCase());\n\n async function pickFromScreen() {\n if (!window.EyeDropper) return;\n try {\n const result = await new window.EyeDropper().open();\n change(result.sRGBHex);\n } catch {\n // Escape pressed: nothing picked.\n }\n }\n\n return (\n <div ref={rootRef} role=\"group\" aria-label={ariaLabel} className={cx(\"ow-color-picker\", className)}>\n <Picker color={color} onChange={change} />\n {showInput || (eyeDropper && canPick) ? (\n <div className=\"ow-color-picker__row\">\n {eyeDropper && canPick ? (\n <button type=\"button\" className=\"ow-color-picker__dropper\" aria-label=\"Pick a colour from the screen\" onClick={pickFromScreen}>\n <PipetteIcon size={15} />\n </button>\n ) : null}\n {showInput ? (\n <span className=\"ow-input-group ow-input-group--sm ow-color-picker__input\">\n <span className=\"ow-input-group__addon\" aria-hidden=\"true\">\n #\n </span>\n <HexColorInput\n className=\"ow-input-group__input\"\n color={color}\n onChange={change}\n alpha={alpha}\n aria-label=\"Hex colour\"\n spellCheck={false}\n />\n </span>\n ) : null}\n <span className=\"ow-color-picker__preview\" style={{ \"--ow-color-picker-value\": color } as CSSProperties} aria-hidden=\"true\" />\n </div>\n ) : null}\n {swatches?.length ? (\n <div className=\"ow-color-picker__swatches\" role=\"group\" aria-label=\"Swatches\">\n {swatches.map((swatch) => {\n const swatchValue = swatchColor(swatch);\n return (\n <button\n key={swatchValue}\n type=\"button\"\n className=\"ow-color-picker__swatch\"\n style={{ \"--ow-color-picker-value\": swatchValue } as CSSProperties}\n aria-label={swatchName(swatch)}\n aria-pressed={same(swatchValue, color)}\n title={swatchName(swatch)}\n onClick={() => change(swatchValue)}\n />\n );\n })}\n </div>\n ) : null}\n </div>\n );\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A field that shows a colour and its hex, and opens a ColorPicker below. Escape or a click outside closes it. */\nexport const ColorField = /* @__PURE__ */ forwardRef<HTMLButtonElement, ColorFieldProps>(function ColorField(\n {\n value,\n defaultValue = \"#312c7e\",\n onChange,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n placement = \"bottom-start\",\n id,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...pickerProps\n },\n ref,\n) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement, offset: 6, maxHeight: 640 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, triggerRef], close);\n\n // Focus the colour area when it opens, so the arrow keys work straight away.\n useEffect(() => {\n if (!isOpen) return undefined;\n const frame = requestAnimationFrame(() => panelRef.current?.querySelector<HTMLElement>(\".react-colorful__interactive\")?.focus());\n return () => cancelAnimationFrame(frame);\n }, [isOpen]);\n\n return (\n <>\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${color.toUpperCase()}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\n \"ow-select\",\n \"ow-color-field\",\n `ow-select--${size}`,\n { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen },\n className,\n )}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <span className=\"ow-color-field__swatch\" style={{ \"--ow-color-picker-value\": color } as CSSProperties} aria-hidden=\"true\" />\n <span id={`${panelId}-value`} className=\"ow-select__value ow-color-field__value\">\n {color.toUpperCase()}\n </span>\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className=\"ow-select__chevron\" />\n </button>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a colour\"\n className=\"ow-popover ow-floating ow-color-field__panel\"\n style={style}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && (event.target as HTMLElement).closest(\".react-colorful\")) close();\n }}\n >\n <ColorPicker {...pickerProps} value={color} onChange={setColor} />\n </div>\n ) : null}\n </>\n );\n});\n", "import { forwardRef, useRef, useState, type CSSProperties, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { clamp, describeColor, hsvModel, hueHex, toHex, useColorModel, useDrag } from \"./color\";\n\nexport interface ColorAreaProps {\n /** The colour as hex, \"#0d9488\". Given with alpha (\"#0d9488cc\"), it keeps the alpha. */\n value?: string;\n /** The starting colour when uncontrolled.\n * @default \"#312c7e\" */\n defaultValue?: string;\n /** Called with a lowercase hex as the person drags or presses the arrow keys. */\n onChange?(color: string): void;\n /** Called when the person lets go or releases the key, for work too slow to do on every move. */\n onChangeEnd?(color: string): void;\n /** The hue to show while the colour is a grey, which has none of its own. Pass a hue ColorSlider's `onHueChange`\n * value here to keep the two in step on greys. Without it, the area keeps the last hue it had. */\n hue?: number;\n /** Pixels, or any CSS width. It never grows past its container.\n * @default 232 */\n width?: number | string;\n /** Pixels, or any CSS height.\n * @default 152 */\n height?: number | string;\n /** Fades it; the pointer and the keys do nothing.\n * @default false */\n disabled?: boolean;\n /** The locale for the percentages screen readers hear. Defaults to the browser's. */\n locale?: string;\n /** The form field name; the hex is submitted under it. */\n name?: string;\n /** Names the area for screen readers; its two sliders are \"Saturation\" and \"Brightness\" within it.\n * @default \"Colour\" */\n \"aria-label\"?: string;\n /** Names the area by a visible label's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out after each slider's value. */\n \"aria-describedby\"?: string;\n /** The group's id. */\n id?: string;\n /** Classes for the area, e.g. a size. */\n className?: string;\n}\n\ntype Axis = \"x\" | \"y\";\n\nconst size = (length: number | string | undefined) => (typeof length === \"number\" ? `${length}px` : length);\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A square of one hue: saturation across, brightness up and down. Drag the thumb, or use the arrow keys.\n * To screen readers it's two sliders, saturation and brightness, each reading out the colour.\n * The ref is the saturation slider's input, for focusing it.\n */\nexport const ColorArea = /* @__PURE__ */ forwardRef<HTMLInputElement, ColorAreaProps>(function ColorArea(\n {\n value,\n defaultValue = \"#312c7e\",\n onChange,\n onChangeEnd,\n hue,\n width,\n height,\n disabled = false,\n locale,\n name,\n \"aria-label\": ariaLabel = \"Colour\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n className,\n },\n ref,\n) {\n const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue, onChange, hsvModel, { hue });\n const rootRef = useRef<HTMLDivElement>(null);\n const inputs = useRef<Record<Axis, HTMLInputElement | null>>({ x: null, y: null });\n // Only one of the two sliders is a tab stop: the one last used.\n const [axis, setAxis] = useState<Axis>(\"x\");\n const isRtl = () => (rootRef.current ? getComputedStyle(rootRef.current).direction === \"rtl\" : false);\n const end = () => onChangeEnd?.(latest());\n\n const drag = useDrag({\n onMove: (x, y) => set({ ...hsv, s: (isRtl() ? 1 - x : x) * 100, v: (1 - y) * 100 }),\n onEnd: end,\n onStart: () => inputs.current[axis]?.focus({ preventScroll: true }),\n disabled,\n });\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n drag.keyboard();\n const step = event.shiftKey ? 10 : 1;\n const forward = isRtl() ? -1 : 1;\n let { s, v } = hsv;\n let moved: Axis = \"x\";\n switch (event.key) {\n case \"ArrowRight\":\n s = Math.round(s) + step * forward;\n break;\n case \"ArrowLeft\":\n s = Math.round(s) - step * forward;\n break;\n case \"Home\":\n s = 0;\n break;\n case \"End\":\n s = 100;\n break;\n case \"ArrowUp\":\n case \"PageUp\":\n v = Math.round(v) + (event.key === \"PageUp\" ? 10 : step);\n moved = \"y\";\n break;\n case \"ArrowDown\":\n case \"PageDown\":\n v = Math.round(v) - (event.key === \"PageDown\" ? 10 : step);\n moved = \"y\";\n break;\n default:\n return;\n }\n event.preventDefault();\n set({ ...hsv, s: clamp(s, 0, 100), v: clamp(v, 0, 100) });\n // Move focus to the slider for the axis that changed, so a screen reader reads that one.\n if (moved !== axis) {\n setAxis(moved);\n inputs.current[moved]?.focus({ preventScroll: true });\n }\n }\n\n function onKeyUp(event: KeyboardEvent<HTMLInputElement>) {\n if (/^(Arrow|Page|Home|End)/.test(event.key)) end();\n }\n\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 });\n const saturation = `Saturation ${percent.format(hsv.s / 100)}`;\n const brightness = `brightness ${percent.format(hsv.v / 100)}`;\n const colorName = describeColor(rgba);\n\n const input = (which: Axis) => (\n <input\n ref={(element) => {\n inputs.current[which] = element;\n if (which === \"x\") assignRef(ref, element);\n }}\n type=\"range\"\n className=\"ow-visually-hidden\"\n min={0}\n max={100}\n step={1}\n value={Math.round(which === \"x\" ? hsv.s : hsv.v)}\n disabled={disabled}\n tabIndex={axis === which ? undefined : -1}\n aria-label={which === \"x\" ? \"Saturation\" : \"Brightness\"}\n aria-roledescription=\"2D slider\"\n aria-orientation={which === \"x\" ? \"horizontal\" : \"vertical\"}\n aria-valuetext={\n which === \"x\"\n ? `${saturation}, ${brightness}, ${colorName}`\n : `${brightness[0]!.toUpperCase()}${brightness.slice(1)}, ${saturation.toLowerCase()}, ${colorName}`\n }\n aria-describedby={ariaDescribedBy}\n onChange={(event) => set({ ...hsv, [which === \"x\" ? \"s\" : \"v\"]: Number(event.target.value) })}\n onFocus={() => setAxis(which)}\n onBlur={drag.keyboard}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n />\n );\n\n return (\n <div\n ref={rootRef}\n id={id}\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-color-area\",\n { \"ow-color-area--dragging\": drag.dragging, \"ow-color-area--pointer\": drag.pointerFocus, \"ow-color-area--disabled\": disabled },\n className,\n )}\n style={\n {\n \"--ow-color-area-hue\": hueHex(hsv.h),\n \"--ow-color-area-width\": size(width),\n \"--ow-color-area-height\": size(height),\n } as CSSProperties\n }\n {...drag.handlers}\n >\n <div\n className=\"ow-color-area__thumb\"\n style={{ \"--ow-color-area-x\": `${hsv.s}%`, \"--ow-color-area-y\": `${100 - hsv.v}%`, \"--ow-color-area-color\": toHex(rgba) } as CSSProperties}\n >\n {input(\"x\")}\n {input(\"y\")}\n </div>\n {name ? <input type=\"hidden\" name={name} value={hex} /> : null}\n </div>\n );\n});\n", "import { useCallback, useReducer, useRef, useState, type PointerEvent as ReactPointerEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\n\n/** Red, green and blue from 0 to 255, alpha from 0 to 1. */\nexport interface Rgba {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\n/** Hue in degrees, saturation and brightness (value) from 0 to 100, alpha from 0 to 1. */\nexport interface Hsva {\n h: number;\n s: number;\n v: number;\n a: number;\n}\n\n/** Hue in degrees, saturation and lightness from 0 to 100, alpha from 0 to 1. */\nexport interface Hsla {\n h: number;\n s: number;\n l: number;\n a: number;\n}\n\nexport const clamp = (n: number, min: number, max: number) => Math.min(max, Math.max(min, n));\n\n/** \"#0d9488\", \"#0d9488cc\", \"#0d9\" or \"0d9488\" \u2192 its channels; anything else \u2192 null. */\nexport function parseHex(color: string): Rgba | null {\n let hex = color.trim().replace(/^#/, \"\");\n if (hex.length === 3 || hex.length === 4) hex = [...hex].map((digit) => digit + digit).join(\"\");\n if (!/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) return null;\n const byteAt = (index: number) => parseInt(hex.slice(index, index + 2), 16);\n return { r: byteAt(0), g: byteAt(2), b: byteAt(4), a: hex.length === 8 ? byteAt(6) / 255 : 1 };\n}\n\n/** Whether a hex colour spells out its alpha (#rgba or #rrggbbaa). */\nexport const hasAlpha = (color: string) => /^#?([0-9a-f]{4}|[0-9a-f]{8})$/i.test(color.trim());\n\nconst byte = (n: number) =>\n Math.round(clamp(n, 0, 255))\n .toString(16)\n .padStart(2, \"0\");\n\n/** Lowercase \"#rrggbb\", or \"#rrggbbaa\" with `alpha`. */\nexport function toHex({ r, g, b, a }: Rgba, alpha = false): string {\n return `#${byte(r)}${byte(g)}${byte(b)}${alpha ? byte(a * 255) : \"\"}`;\n}\n\n/** The same colour written one way, so \"#0D9488\" and \"#0d9488\" compare equal. Invalid colours come back as given. */\nexport function normalizeHex(color: string): string {\n const rgba = parseHex(color);\n return rgba ? toHex(rgba, hasAlpha(color)) : color;\n}\n\nexport function rgbToHsv({ r, g, b, a }: Rgba): Hsva {\n const max = Math.max(r, g, b);\n const range = max - Math.min(r, g, b);\n let h = 0;\n if (range) {\n if (max === r) h = ((g - b) / range) % 6;\n else if (max === g) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h = (h * 60 + 360) % 360;\n }\n return { h, s: max ? (range / max) * 100 : 0, v: (max / 255) * 100, a };\n}\n\nexport function hsvToRgb({ h, s, v, a }: Hsva): Rgba {\n const S = s / 100;\n const V = v / 100;\n const channel = (n: number) => {\n const k = (n + h / 60) % 6;\n return (V - V * S * Math.max(0, Math.min(k, 4 - k, 1))) * 255;\n };\n return { r: channel(5), g: channel(3), b: channel(1), a };\n}\n\nexport function hsvToHsl({ h, s, v, a }: Hsva): Hsla {\n const S = s / 100;\n const V = v / 100;\n const l = V * (1 - S / 2);\n return { h, s: l === 0 || l === 1 ? 0 : ((V - l) / Math.min(l, 1 - l)) * 100, l: l * 100, a };\n}\n\nexport function hslToHsv({ h, s, l, a }: Hsla): Hsva {\n const S = s / 100;\n const L = l / 100;\n const v = L + S * Math.min(L, 1 - L);\n return { h, s: v === 0 ? 0 : 2 * (1 - L / v) * 100, v: v * 100, a };\n}\n\n/** A way of seeing a colour that a control edits, and how to read a hex into it without losing what a grey can't hold. */\nexport interface ColorModel<M extends { h: number }> {\n read(rgba: Rgba, previous: M | undefined): M;\n write(model: M): Rgba;\n}\n\nexport const hsvModel: ColorModel<Hsva> = {\n read(rgba, previous) {\n const next = rgbToHsv(rgba);\n if (!previous) return next;\n // A grey has no hue, and black no saturation either: keep the last ones, so a corner doesn't lose them.\n if (next.s === 0 || next.v === 0) next.h = previous.h;\n if (next.v === 0) next.s = previous.s;\n return next;\n },\n write: hsvToRgb,\n};\n\nexport const hslModel: ColorModel<Hsla> = {\n read(rgba, previous) {\n const next = hsvToHsl(rgbToHsv(rgba));\n if (!previous) return next;\n if (next.s === 0) next.h = previous.h;\n // Black and white have neither hue nor saturation.\n if (next.l <= 0 || next.l >= 100) {\n next.h = previous.h;\n next.s = previous.s;\n }\n return next;\n },\n write: (model) => hsvToRgb(hslToHsv(model)),\n};\n\nconst fallback: Rgba = { r: 0, g: 0, b: 0, a: 1 };\n\n/**\n * A hex colour that a parent may control, seen through a model (HSV or HSL). The model is kept between renders\n * and only read again from the hex when the hex changes from outside, so greys and black keep their hue.\n * `hue`, when given, is the hue to show while the colour is a grey.\n */\nexport function useColorModel<M extends { h: number }>(\n value: string | undefined,\n defaultValue: string,\n onChange: ((color: string) => void) | undefined,\n model: ColorModel<M>,\n { hue, alpha = false }: { hue?: number; alpha?: boolean } = {},\n) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const memory = useRef<{ hex: string; model: ColorModel<M>; value: M } | null>(null);\n const [, rerender] = useReducer((n: number) => n + 1, 0);\n\n const incoming = normalizeHex(color);\n if (!memory.current || memory.current.hex !== incoming || memory.current.model !== model) {\n const rgba = parseHex(incoming);\n const previous = memory.current?.model === model ? memory.current.value : undefined;\n memory.current = { hex: incoming, model, value: rgba ? model.read(rgba, previous) : (previous ?? model.read(fallback, undefined)) };\n }\n\n const rgba = parseHex(memory.current.hex) ?? model.write(memory.current.value);\n const isGrey = rgba.r === rgba.g && rgba.g === rgba.b;\n const current = isGrey && hue !== undefined ? { ...memory.current.value, h: hue } : memory.current.value;\n const withAlpha = alpha || hasAlpha(color);\n\n const set = useCallback(\n (next: M) => {\n const hex = toHex(model.write(next), withAlpha);\n memory.current = { hex, model, value: next };\n // When the hex doesn't change (the hue of a grey), only the thumb moves: render that.\n rerender();\n setColor(hex);\n return hex;\n },\n [model, withAlpha, setColor],\n );\n\n // The latest hex, for onChangeEnd, which can run before the next render.\n const latest = useCallback(() => memory.current?.hex ?? incoming, [incoming]);\n\n return { value: current, rgba: model.write(current), hex: memory.current.hex, set, latest };\n}\n\n/**\n * Pointer dragging over an element: reports where the pointer is as fractions of its box (0 to 1, from the top\n * left), keeps reporting outside it through pointer capture, and calls onEnd when the pointer lets go. onStart runs\n * on press, to focus the control. `pointerFocus` is true from a press until a key or a blur: the control was focused\n * by the pointer and shows no focus ring, the way :focus-visible would if it were a native control.\n */\nexport function useDrag({\n onMove,\n onEnd,\n onStart,\n disabled = false,\n}: {\n onMove(x: number, y: number): void;\n onEnd(): void;\n onStart?(): void;\n disabled?: boolean;\n}) {\n const [dragging, setDragging] = useState(false);\n const [pointerFocus, setPointerFocus] = useState(false);\n const move = (event: ReactPointerEvent<HTMLElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n onMove(clamp((event.clientX - rect.left) / (rect.width || 1), 0, 1), clamp((event.clientY - rect.top) / (rect.height || 1), 0, 1));\n };\n return {\n dragging,\n pointerFocus,\n /** For the input's onKeyDown and onBlur: the focus ring shows again. */\n keyboard: () => setPointerFocus(false),\n handlers: {\n onPointerDown(event: ReactPointerEvent<HTMLElement>) {\n if (disabled || event.button !== 0) return;\n // No text selection or page scroll while dragging.\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n onStart?.();\n setPointerFocus(true);\n setDragging(true);\n move(event);\n },\n onPointerMove(event: ReactPointerEvent<HTMLElement>) {\n if (event.currentTarget.hasPointerCapture(event.pointerId)) move(event);\n },\n onLostPointerCapture() {\n setDragging(false);\n onEnd();\n },\n },\n };\n}\n\n// Relative luminance, for picking a check mark's colour.\nconst linear = (channel: number) => {\n const v = channel / 255;\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\nconst luminance = ({ r, g, b }: Pick<Rgba, \"r\" | \"g\" | \"b\">) => 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);\nconst ratio = (a: number, b: number) => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n\n/** Whether light (white) or dark (slate 900) ink reads better on a colour; a translucent colour is seen over white. */\nexport function inkFor({ r, g, b, a }: Rgba): \"light\" | \"dark\" {\n const over = (channel: number) => channel * a + 255 * (1 - a);\n const ground = luminance({ r: over(r), g: over(g), b: over(b) });\n return ratio(ground, 1) >= ratio(ground, luminance({ r: 15, g: 23, b: 42 })) ? \"light\" : \"dark\";\n}\n\nfunction hueName(h: number, l: number): string {\n if (h < 12 || h >= 345) return l > 70 ? \"pink\" : \"red\";\n if (h < 42) return l < 35 ? \"brown\" : \"orange\";\n if (h < 66) return l < 30 ? \"olive\" : \"yellow\";\n if (h < 85) return \"lime\";\n if (h < 150) return \"green\";\n if (h < 170) return \"teal\";\n if (h < 195) return l >= 45 ? \"cyan\" : \"teal\";\n if (h < 240) return \"blue\";\n if (h < 260) return \"indigo\";\n if (h < 290) return \"purple\";\n if (h < 320) return \"magenta\";\n return \"pink\";\n}\n\n/** A short description of a colour for screen readers: \"dark teal\", \"light grey\", \"greyish blue\". */\nexport function describeColor(rgba: Rgba): string {\n const { h, s, v } = rgbToHsv(rgba);\n const { l } = hsvToHsl({ h, s, v, a: 1 });\n const chroma = Math.max(rgba.r, rgba.g, rgba.b) - Math.min(rgba.r, rgba.g, rgba.b);\n if (chroma < 12) {\n if (l < 8) return \"black\";\n if (l > 97) return \"white\";\n return l < 35 ? \"dark grey\" : l > 75 ? \"light grey\" : \"grey\";\n }\n const name = hueName(h, l);\n const shade =\n name === \"brown\" || name === \"olive\" ? (l < 20 ? \"dark\" : \"\") : l < 20 ? \"very dark\" : l < 38 ? \"dark\" : l > 85 ? \"very light\" : l > 68 ? \"light\" : \"\";\n return [shade, chroma < 40 ? \"greyish\" : \"\", name].filter(Boolean).join(\" \");\n}\n\n/** The pure hue, as a hex: what a hue slider's thumb shows. */\nexport const hueHex = (h: number) => toHex(hsvToRgb({ h, s: 100, v: 100, a: 1 }));\n\n/** The six stops of the hue wheel, red to red. */\nexport const hueStops = \"#ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%\";\n", "import { forwardRef, useId, useRef, type CSSProperties, type ForwardedRef, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport {\n clamp,\n describeColor,\n hslModel,\n hsvModel,\n hueHex,\n hueStops,\n parseHex,\n toHex,\n useColorModel,\n useDrag,\n type ColorModel,\n type Hsla,\n type Hsva,\n type Rgba,\n} from \"./color\";\n\n/** A channel a ColorSlider changes: HSL's hue, saturation or lightness, the alpha, or red, green or blue. */\nexport type ColorChannel = \"hue\" | \"saturation\" | \"lightness\" | \"alpha\" | \"red\" | \"green\" | \"blue\";\n\nexport interface ColorSliderProps {\n /** The channel it changes. Saturation and lightness are HSL's; the track shows the channel's range for the current colour. */\n channel: ColorChannel;\n /** The colour as hex. The alpha channel takes and returns \"#rrggbbaa\"; the others keep any alpha they're given. */\n value?: string;\n /** The starting colour when uncontrolled.\n * @default \"#312c7e\" */\n defaultValue?: string;\n /** Called with a lowercase hex as the person drags or presses the arrow keys. */\n onChange?(color: string): void;\n /** Called when the person lets go or releases the key, for work too slow to do on every move. */\n onChangeEnd?(color: string): void;\n /** The hue to show while the colour is a grey, which has none of its own. Without it, the slider keeps the last hue it had. */\n hue?: number;\n /** Called with the hue as a hue slider moves, including over a grey, whose hex doesn't change. Pass it on to a\n * ColorArea's `hue` to keep the two in step. */\n onHueChange?(hue: number): void;\n /** Shown above the track, and names the slider for screen readers. */\n label?: ReactNode;\n /** Shows the channel's value (174\u00B0, 72%, or 0 to 255 for red, green and blue) at the right of the label.\n * Defaults to true when there's a label. */\n showValue?: boolean;\n /** A vertical slider is 152px tall, a ColorArea's height; set another with CSS.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Fades it; the pointer and the keys do nothing.\n * @default false */\n disabled?: boolean;\n /** The locale for the value shown and read out. Defaults to the browser's. */\n locale?: string;\n /** The form field name; the hex is submitted under it. */\n name?: string;\n /** Names the slider when there's no label. Defaults to the channel's name (\"Hue\", \"Opacity\"), unless aria-labelledby\n * or a Field names it. */\n \"aria-label\"?: string;\n /** Names the slider by a visible label's id. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out after the value; a Field sets it. */\n \"aria-describedby\"?: string;\n /** The input's id; a Field sets it so its label names the slider. */\n id?: string;\n /** Classes for the slider's outer element, e.g. a height for a vertical one. */\n className?: string;\n}\n\ntype Model = Hsva | Hsla;\n\nconst channels: Record<ColorChannel, { name: string; max: number; unit: \"degree\" | \"percent\" | \"number\" }> = {\n hue: { name: \"Hue\", max: 360, unit: \"degree\" },\n saturation: { name: \"Saturation\", max: 100, unit: \"percent\" },\n lightness: { name: \"Lightness\", max: 100, unit: \"percent\" },\n alpha: { name: \"Opacity\", max: 100, unit: \"percent\" },\n red: { name: \"Red\", max: 255, unit: \"number\" },\n green: { name: \"Green\", max: 255, unit: \"number\" },\n blue: { name: \"Blue\", max: 255, unit: \"number\" },\n};\n\nconst rgbKey = { red: \"r\", green: \"g\", blue: \"b\" } as const;\n\nfunction read(channel: ColorChannel, model: Model, rgba: Rgba): number {\n if (channel === \"hue\") return model.h;\n if (channel === \"saturation\") return model.s;\n if (channel === \"lightness\") return (model as Hsla).l;\n if (channel === \"alpha\") return model.a * 100;\n return rgba[rgbKey[channel]];\n}\n\nfunction write(channel: ColorChannel, model: Model, rgba: Rgba, n: number): Model {\n if (channel === \"hue\") return { ...model, h: n };\n if (channel === \"saturation\") return { ...model, s: n };\n if (channel === \"lightness\") return { ...model, l: n };\n if (channel === \"alpha\") return { ...model, a: n / 100 };\n return hsvModel.read({ ...rgba, [rgbKey[channel]]: Math.round(n) }, model as Hsva);\n}\n\n/** The track's colours, from the channel's minimum to its maximum, for the current colour. */\nfunction gradient(channel: ColorChannel, model: Model, rgba: Rgba): string {\n const opaque = { ...rgba, a: 1 };\n const hsl = (s: number, l: number) => toHex(hslModel.write({ h: model.h, s, l, a: 1 }));\n switch (channel) {\n case \"hue\":\n return hueStops;\n case \"saturation\":\n return `${hsl(0, (model as Hsla).l)}, ${hsl(100, (model as Hsla).l)}`;\n case \"lightness\":\n return `#000000, ${hsl(model.s, 50)}, #ffffff`;\n case \"alpha\":\n return `${toHex({ ...rgba, a: 0 }, true)}, ${toHex(opaque)}`;\n default: {\n const key = rgbKey[channel];\n return `${toHex({ ...opaque, [key]: 0 })}, ${toHex({ ...opaque, [key]: 255 })}`;\n }\n }\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * Changes one channel of a colour by dragging, over a track that shows that channel's range: a hue slider, an\n * opacity slider over a checkerboard, or red, green and blue. It works with the keyboard like Slider.\n * The ref is its input, for focusing it.\n */\nexport const ColorSlider = /* @__PURE__ */ forwardRef<HTMLInputElement, ColorSliderProps>(function ColorSlider(\n {\n channel,\n value,\n defaultValue = \"#312c7e\",\n onChange,\n onChangeEnd,\n hue,\n onHueChange,\n label,\n showValue = Boolean(label),\n orientation = \"horizontal\",\n disabled = false,\n locale,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n className,\n },\n ref,\n) {\n const spec = channels[channel];\n const isHsl = channel === \"saturation\" || channel === \"lightness\";\n const color = useColorModel<Model>(value, defaultValue, onChange, (isHsl ? hslModel : hsvModel) as ColorModel<Model>, {\n hue,\n alpha: channel === \"alpha\",\n });\n const { rgba, latest } = color;\n const current = read(channel, color.value, rgba);\n const labelId = useId();\n const trackRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const vertical = orientation === \"vertical\";\n const isRtl = () => !vertical && trackRef.current !== null && getComputedStyle(trackRef.current).direction === \"rtl\";\n const end = () => onChangeEnd?.(latest());\n\n function change(n: number) {\n const next = write(channel, color.value, rgba, clamp(n, 0, spec.max));\n color.set(next);\n if (next.h !== color.value.h) onHueChange?.(next.h);\n }\n\n const drag = useDrag({\n onMove: (x, y) => change((vertical ? 1 - y : isRtl() ? 1 - x : x) * spec.max),\n onEnd: end,\n onStart: () => inputRef.current?.focus({ preventScroll: true }),\n disabled,\n });\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n drag.keyboard();\n const step = event.shiftKey ? 10 : 1;\n const forward = isRtl() ? -1 : 1;\n const from = Math.round(current);\n const keys: Record<string, number> = {\n ArrowRight: from + step * forward,\n ArrowLeft: from - step * forward,\n ArrowUp: from + step,\n ArrowDown: from - step,\n PageUp: from + 10,\n PageDown: from - 10,\n Home: 0,\n End: spec.max,\n };\n if (!(event.key in keys)) return;\n event.preventDefault();\n change(keys[event.key]!);\n }\n\n const format =\n spec.unit === \"degree\"\n ? new Intl.NumberFormat(locale, { style: \"unit\", unit: \"degree\", unitDisplay: \"narrow\", maximumFractionDigits: 0 })\n : spec.unit === \"percent\"\n ? new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n : new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });\n const shown = format.format(spec.unit === \"percent\" ? current / 100 : current);\n const named = channel === \"hue\" ? describeColor(parseHex(hueHex(color.value.h))!) : describeColor({ ...rgba, a: 1 });\n const fill = channel === \"hue\" ? hueHex(color.value.h) : toHex(rgba, channel === \"alpha\");\n\n return (\n <div\n className={cx(\n \"ow-color-slider\",\n `ow-color-slider--${orientation}`,\n {\n \"ow-color-slider--alpha\": channel === \"alpha\",\n \"ow-color-slider--dragging\": drag.dragging,\n \"ow-color-slider--pointer\": drag.pointerFocus,\n \"ow-color-slider--disabled\": disabled,\n },\n className,\n )}\n >\n {label || showValue ? (\n <div className=\"ow-color-slider__header\">\n {label ? (\n <span id={labelId} className=\"ow-color-slider__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? (\n <output className=\"ow-color-slider__value\" aria-hidden=\"true\">\n {shown}\n </output>\n ) : null}\n </div>\n ) : null}\n <div\n ref={trackRef}\n className=\"ow-color-slider__track\"\n style={\n {\n \"--ow-color-slider-gradient\": `linear-gradient(var(--ow-color-slider-direction), ${gradient(channel, color.value, rgba)})`,\n } as CSSProperties\n }\n {...drag.handlers}\n >\n <div\n className=\"ow-color-slider__thumb\"\n style={{ \"--ow-color-slider-position\": `${(current / spec.max) * 100}%`, \"--ow-color-slider-thumb\": fill } as CSSProperties}\n >\n <input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"range\"\n className=\"ow-visually-hidden\"\n min={0}\n max={spec.max}\n step={1}\n value={Math.round(current)}\n disabled={disabled}\n aria-orientation={orientation}\n aria-labelledby={label ? labelId : ariaLabelledBy}\n aria-label={label || ariaLabelledBy || (id && !ariaLabel) ? undefined : (ariaLabel ?? spec.name)}\n aria-valuetext={channel === \"alpha\" ? shown : `${shown}, ${named}`}\n aria-describedby={ariaDescribedBy}\n onChange={(event) => change(Number(event.target.value))}\n onKeyDown={onKeyDown}\n onBlur={drag.keyboard}\n onKeyUp={(event) => {\n if (/^(Arrow|Page|Home|End)/.test(event.key)) end();\n }}\n />\n </div>\n </div>\n {name ? <input type=\"hidden\" name={name} value={color.hex} /> : null}\n </div>\n );\n});\n", "import { forwardRef, useRef, type CSSProperties, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { describeColor, inkFor, normalizeHex, parseHex } from \"./color\";\n\nexport interface ColorSwatchPickerOption {\n /** A hex colour: \"#312c7e\". */\n value: string;\n /** The colour's name, read out and shown on hover: \"Midnight\". Defaults to a description, like \"dark indigo\". */\n label?: string;\n /** Shown faded and skipped by the arrow keys, e.g. a colour another label has taken. */\n disabled?: boolean;\n}\n\nexport interface ColorSwatchPickerProps {\n /** The colours to choose from: hex strings, or { value, label } to give them names. */\n options: Array<string | ColorSwatchPickerOption>;\n /** The chosen colour. It matches an option whatever its case or length (#abc, #aabbcc). */\n value?: string;\n /** The starting colour when uncontrolled. Defaults to none. */\n defaultValue?: string;\n /** Called with the chosen option's value, as written in `options`. */\n onChange?(color: string): void;\n /** sm 24px, md 32px swatches.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default \"square\" */\n shape?: \"square\" | \"circle\";\n /** Fades every swatch and takes the picker out of the tab order.\n * @default false */\n disabled?: boolean;\n /** The form field name; the chosen colour is submitted under it. */\n name?: string;\n /** Names the group for screen readers, e.g. \"Label colour\". */\n \"aria-label\"?: string;\n /** Names the group by a visible heading's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out with the group. */\n \"aria-describedby\"?: string;\n /** The group's id. */\n id?: string;\n /** Classes for the group, e.g. a width that sets where the rows wrap. */\n className?: string;\n}\n\n/**\n * Picks one colour from a set of swatches, in rows that wrap. It's a radio group: Tab moves into it, onto the chosen\n * swatch, and the arrow keys move and choose. The chosen swatch has a ring and a check mark.\n */\nexport const ColorSwatchPicker = /* @__PURE__ */ forwardRef<HTMLDivElement, ColorSwatchPickerProps>(function ColorSwatchPicker(\n { options, value, defaultValue, onChange, size = \"md\", shape = \"square\", disabled = false, name, className, ...aria },\n ref,\n) {\n const [current, setCurrent] = useControllableState(value, defaultValue ?? \"\", onChange);\n const refs = useRef<Array<HTMLDivElement | null>>([]);\n const items = options.map((option) => {\n const item = typeof option === \"string\" ? { value: option } : option;\n const rgba = parseHex(item.value);\n return { ...item, rgba, label: item.label ?? (rgba ? describeColor(rgba) : item.value) };\n });\n const chosen = current ? normalizeHex(current) : \"\";\n const selectedIndex = items.findIndex((item) => normalizeHex(item.value) === chosen);\n const enabled = items.flatMap((item, index) => (item.disabled ? [] : [index]));\n const tabStop = selectedIndex >= 0 && !items[selectedIndex]!.disabled ? selectedIndex : enabled[0];\n\n function choose(index: number) {\n const item = items[index];\n if (disabled || !item || item.disabled) return;\n setCurrent(item.value);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>, index: number) {\n if (disabled) return;\n if (event.key === \" \") {\n event.preventDefault();\n choose(index);\n return;\n }\n const rtl = getComputedStyle(event.currentTarget).direction === \"rtl\";\n const moves: Record<string, number> = { ArrowDown: 1, ArrowUp: -1, ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 };\n const position = enabled.indexOf(index);\n let target: number | undefined;\n // Moving past the end of a row goes on to the next row; past the last swatch, back to the first.\n if (event.key in moves) target = enabled[(position + moves[event.key]! + enabled.length) % enabled.length];\n else if (event.key === \"Home\") target = enabled[0];\n else if (event.key === \"End\") target = enabled[enabled.length - 1];\n if (target === undefined) return;\n event.preventDefault();\n refs.current[target]?.focus();\n choose(target);\n }\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-color-swatch-picker\",\n `ow-color-swatch-picker--${size}`,\n { \"ow-color-swatch-picker--circle\": shape === \"circle\", \"ow-color-swatch-picker--disabled\": disabled },\n className,\n )}\n {...aria}\n >\n {items.map((item, index) => {\n const isSelected = index === selectedIndex;\n const isDisabled = disabled || Boolean(item.disabled);\n return (\n <div\n key={`${item.value}-${index}`}\n ref={(element) => {\n refs.current[index] = element;\n }}\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={item.label}\n aria-disabled={isDisabled || undefined}\n tabIndex={!isDisabled && index === tabStop ? 0 : -1}\n title={item.label}\n data-ink={item.rgba ? inkFor(item.rgba) : \"dark\"}\n className=\"ow-color-swatch-picker__swatch\"\n style={{ \"--ow-color-swatch-picker-value\": item.value } as CSSProperties}\n onClick={() => choose(index)}\n onKeyDown={(event) => onKeyDown(event, index)}\n >\n <CheckIcon size={size === \"sm\" ? 14 : 16} strokeWidth={2.5} className=\"ow-color-swatch-picker__check\" aria-hidden=\"true\" />\n </div>\n );\n })}\n {name ? <input type=\"hidden\" name={name} value={selectedIndex >= 0 ? items[selectedIndex]!.value : \"\"} /> : null}\n </div>\n );\n});\n", "import type { CSSProperties } from \"react\";\n\n/** The eleven steps of a brand scale, as in --ow-brand-50 \u2026 --ow-brand-950. */\nexport const brandSteps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;\n\nexport type BrandStep = (typeof brandSteps)[number];\nexport type BrandScale = Record<BrandStep, string>;\n\nexport interface BrandPreset {\n id: string;\n name: string;\n scale: BrandScale;\n}\n\n// Midnight's lightness and chroma at each step, in OKLCH. Every scale is built on this lightness curve, so white\n// text on step 600 (light) and 500 (dark), and the focus rings on 500 and 400, keep their contrast whatever the hue.\nconst lightness = [0.968, 0.94, 0.89, 0.81, 0.68, 0.53, 0.42, 0.33, 0.27, 0.22, 0.17];\nconst chroma = [0.012, 0.022, 0.04, 0.066, 0.1, 0.135, 0.134, 0.086, 0.072, 0.058, 0.045];\nconst peakChroma = 0.135;\n\ntype Lch = { l: number; c: number; h: number };\n\nfunction parseHex(color: string): [number, number, number] {\n let hex = color.trim().replace(/^#/, \"\");\n if (hex.length === 3 || hex.length === 4) hex = [...hex.slice(0, 3)].map((d) => d + d).join(\"\");\n if (!/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) throw new Error(`brandScale: \"${color}\" isn't a hex colour like #2563eb.`);\n return [0, 2, 4].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255) as [number, number, number];\n}\n\nconst toLinear = (v: number) => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst fromLinear = (v: number) => (v <= 0.0031308 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055);\n\nfunction hexToOklch(color: string): Lch {\n const [r, g, b] = parseHex(color).map(toLinear) as [number, number, number];\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;\n return { l: L, c: Math.hypot(A, B), h: ((Math.atan2(B, A) * 180) / Math.PI + 360) % 360 };\n}\n\nfunction oklchToLinear({ l: L, c, h }: Lch): [number, number, number] {\n const A = c * Math.cos((h * Math.PI) / 180);\n const B = c * Math.sin((h * Math.PI) / 180);\n const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;\n const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;\n const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ];\n}\n\nconst inGamut = (rgb: number[]) => rgb.every((v) => v >= -1e-4 && v <= 1 + 1e-4);\n\n/** The colour at this lightness and hue, with as much of the wanted chroma as sRGB can show. */\nfunction toHex(color: Lch): string {\n let { c } = color;\n if (!inGamut(oklchToLinear(color))) {\n let low = 0;\n let high = c;\n for (let i = 0; i < 24; i += 1) {\n const mid = (low + high) / 2;\n if (inGamut(oklchToLinear({ ...color, c: mid }))) low = mid;\n else high = mid;\n }\n c = low;\n }\n return `#${oklchToLinear({ ...color, c })\n .map((v) => Math.round(Math.min(1, Math.max(0, fromLinear(Math.min(1, Math.max(0, v))))) * 255))\n .map((v) => v.toString(16).padStart(2, \"0\"))\n .join(\"\")}`;\n}\n\n/**\n * Builds the eleven brand steps from one colour: its hue and colourfulness on Openware's lightness curve.\n * The steps keep midnight's contrast in both themes, so your exact colour may land a little lighter or\n * darker than given. A grey gives a neutral scale.\n *\n * `brandScale(\"#0d9488\")` \u2192 `{ 50: \"#ebf7f6\", \u2026, 600: \"#00595a\", \u2026, 950: \"#001414\" }`\n */\nexport function brandScale(color: string): BrandScale {\n const { c, h } = hexToOklch(color);\n const strength = Math.min(1.6, c / peakChroma);\n return Object.fromEntries(brandSteps.map((step, i) => [step, toHex({ l: lightness[i]!, c: chroma[i]! * strength, h })])) as BrandScale;\n}\n\n/** A colour or a scale as the --ow-brand-* custom properties, for a `style` prop or `element.style`. */\nexport function brandVariables(brand: string | BrandScale): CSSProperties {\n const scale = typeof brand === \"string\" ? brandScale(brand) : brand;\n return Object.fromEntries(brandSteps.map((step) => [`--ow-brand-${step}`, scale[step]])) as CSSProperties;\n}\n\n/** A colour or a scale as CSS to paste into a stylesheet. */\nexport function brandCss(brand: string | BrandScale, selector = \":root\"): string {\n const scale = typeof brand === \"string\" ? brandScale(brand) : brand;\n return `${selector} {\\n${brandSteps.map((step) => ` --ow-brand-${step}: ${scale[step]};`).join(\"\\n\")}\\n}`;\n}\n\n/**\n * Rebrands everything inside `element` (the whole page by default) by setting the --ow-brand-* properties on\n * it. Pass `null` to go back to midnight. Elements with their own data-theme set their own brand steps, so\n * give those the same properties, or use brandCss with `:root, [data-theme]` in a stylesheet.\n */\nexport function applyBrand(brand: string | BrandScale | null, element: HTMLElement = document.documentElement) {\n for (const step of brandSteps) element.style.removeProperty(`--ow-brand-${step}`);\n if (brand === null) return;\n const variables = brandVariables(brand) as Record<string, string>;\n for (const [name, value] of Object.entries(variables)) element.style.setProperty(name, value);\n}\n\n/** Seven ready-made scales, each checked for contrast in both themes. Midnight is the default. */\nexport const brandPresets: BrandPreset[] = [\n {\n id: \"midnight\",\n name: \"Midnight\",\n scale: {\n 50: \"#f2f3fc\",\n 100: \"#e7e9f9\",\n 200: \"#d4d7f4\",\n 300: \"#b7bbea\",\n 400: \"#898cd0\",\n 500: \"#5856ad\",\n 600: \"#312c7e\",\n 700: \"#1e1b4b\",\n 800: \"#18163d\",\n 900: \"#13112f\",\n 950: \"#0b0a20\",\n },\n },\n {\n id: \"ocean\",\n name: \"Ocean\",\n scale: {\n 50: \"#edf5fe\",\n 100: \"#dfedfd\",\n 200: \"#c3defa\",\n 300: \"#9ac5f3\",\n 400: \"#5a9de0\",\n 500: \"#006ebe\",\n 600: \"#004f8a\",\n 700: \"#003763\",\n 800: \"#00274a\",\n 900: \"#001b36\",\n 950: \"#001023\",\n },\n },\n {\n id: \"teal\",\n name: \"Teal\",\n scale: {\n 50: \"#ebf7f7\",\n 100: \"#daf1f0\",\n 200: \"#bae4e4\",\n 300: \"#87d0cf\",\n 400: \"#1fadad\",\n 500: \"#007c7c\",\n 600: \"#005959\",\n 700: \"#003e3e\",\n 800: \"#002d2d\",\n 900: \"#002020\",\n 950: \"#001313\",\n },\n },\n {\n id: \"forest\",\n name: \"Forest\",\n scale: {\n 50: \"#eef7f0\",\n 100: \"#e0f0e3\",\n 200: \"#c6e4cd\",\n 300: \"#9ecfaa\",\n 400: \"#5fac76\",\n 500: \"#008240\",\n 600: \"#005d2d\",\n 700: \"#00411d\",\n 800: \"#003014\",\n 900: \"#00220c\",\n 950: \"#001506\",\n },\n },\n {\n id: \"plum\",\n name: \"Plum\",\n scale: {\n 50: \"#f9f2f9\",\n 100: \"#f4e6f4\",\n 200: \"#ead1eb\",\n 300: \"#dab1db\",\n 400: \"#bb80be\",\n 500: \"#95489a\",\n 600: \"#732778\",\n 700: \"#4d2150\",\n 800: \"#39163b\",\n 900: \"#290e2b\",\n 950: \"#1a071b\",\n },\n },\n {\n id: \"rose\",\n name: \"Rose\",\n scale: {\n 50: \"#fef1f1\",\n 100: \"#fce5e6\",\n 200: \"#f8cfd1\",\n 300: \"#eeadb1\",\n 400: \"#d67981\",\n 500: \"#b43b4e\",\n 600: \"#8e1331\",\n 700: \"#5e1924\",\n 800: \"#470f19\",\n 900: \"#330910\",\n 950: \"#210408\",\n },\n },\n {\n id: \"ember\",\n name: \"Ember\",\n scale: {\n 50: \"#fdf2ec\",\n 100: \"#fae7dd\",\n 200: \"#f5d3c0\",\n 300: \"#eab395\",\n 400: \"#d18254\",\n 500: \"#a94e00\",\n 600: \"#7b3700\",\n 700: \"#572500\",\n 800: \"#411900\",\n 900: \"#2f1100\",\n 950: \"#1e0800\",\n },\n },\n];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AA,IACT;AAAA,EACJ;AACJ;",
|
|
6
|
-
"names": ["Element", "import_jsx_runtime", "size", "import_jsx_runtime", "size", "Button", "import_react", "import_react", "import_jsx_runtime", "size", "import_jsx_runtime", "CloseButton", "size", "ToggleButton", "import_react", "import_react", "import_jsx_runtime", "size", "focusable", "import_react", "import_jsx_runtime", "ChoiceCard", "icon", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "Toolbar", "size", "items", "import_react", "import_react", "top", "import_react", "import_jsx_runtime", "import_jsx_runtime", "size", "import_react", "import_react", "import_jsx_runtime", "Checkbox", "size", "import_react", "import_jsx_runtime", "icon", "import_jsx_runtime", "Form", "changed", "import_jsx_runtime", "import_react", "import_jsx_runtime", "Input", "size", "import_react", "import_jsx_runtime", "assignRef", "SearchField", "size", "import_react", "import_jsx_runtime", "NumberField", "size", "clamp", "import_react", "import_jsx_runtime", "import_react", "_", "import_react", "import_jsx_runtime", "size", "import_jsx_runtime", "pad", "DateField", "size", "import_react", "import_jsx_runtime", "pad", "TimeField", "size", "import_react", "import_jsx_runtime", "assignRef", "Textarea", "import_react", "import_jsx_runtime", "size", "state", "import_react", "import_jsx_runtime", "typeaheadResetMs", "isGroup", "textOf", "size", "import_react", "import_jsx_runtime", "assignRef", "Combobox", "size", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "Switch", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "icon", "hasFiles", "import_react", "import_jsx_runtime", "Calendar", "import_react", "import_jsx_runtime", "assignRef", "DatePicker", "size", "import_react", "import_jsx_runtime", "RangeCalendar", "import_react", "import_jsx_runtime", "assignRef", "matches", "DateRangePicker", "size", "import_jsx_runtime", "icon", "size", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "icons", "SonnerToaster", "import_react", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "MenuItem", "icon", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "icon", "import_react", "import_jsx_runtime", "icon", "import_react", "import_jsx_runtime", "items", "Link", "import_jsx_runtime", "size", "items", "import_react", "import_jsx_runtime", "items", "import_react", "import_jsx_runtime", "NavItem", "icon", "import_react", "import_jsx_runtime", "keyOf", "import_jsx_runtime", "icon", "import_react", "import_jsx_runtime", "items", "
|
|
3
|
+
"sources": ["../src/index.ts", "../src/utils/cx.ts", "../src/components/Text/Text.tsx", "../src/components/Button/Button.tsx", "../src/utils/text.ts", "../src/components/Spinner/Spinner.tsx", "../src/components/Button/ButtonGroup.tsx", "../src/hooks/useControllableState.ts", "../src/icons.tsx", "../src/components/SegmentedControl/SegmentedControl.tsx", "../src/hooks/useIndicator.ts", "../src/components/ChoiceCard/ChoiceCard.tsx", "../src/components/CodeBlock/CodeBlock.tsx", "../src/utils/copyText.ts", "../src/components/ToggleButtonGroup/ToggleButtonGroup.tsx", "../src/components/Toolbar/Toolbar.tsx", "../src/components/Tooltip/Tooltip.tsx", "../src/hooks/useFloating.ts", "../src/hooks/usePresence.ts", "../src/components/Field/Field.tsx", "../src/components/Checkbox/Checkbox.tsx", "../src/components/Form/Form.tsx", "../src/components/Alert/Alert.tsx", "../src/components/Input/Input.tsx", "../src/components/SearchField/SearchField.tsx", "../src/components/NumberField/NumberField.tsx", "../src/components/InputOTP/InputOTP.tsx", "../src/components/DateField/DateField.tsx", "../src/components/Calendar/dates.ts", "../src/components/DateField/SegmentedField.tsx", "../src/components/DateField/TimeField.tsx", "../src/components/Textarea/Textarea.tsx", "../src/utils/resizeTextArea.ts", "../src/components/Select/Select.tsx", "../src/components/ListBox/ListBox.tsx", "../src/components/Combobox/Combobox.tsx", "../src/components/RadioGroup/RadioGroup.tsx", "../src/components/Switch/Switch.tsx", "../src/components/Slider/Slider.tsx", "../src/components/FileDropZone/FileDropZone.tsx", "../src/components/Calendar/Calendar.tsx", "../src/components/Calendar/DatePicker.tsx", "../src/components/Calendar/RangeCalendar.tsx", "../src/components/Calendar/DateRangePicker.tsx", "../src/components/Badge/Badge.tsx", "../src/components/Progress/Progress.tsx", "../src/components/Meter/Meter.tsx", "../src/components/Skeleton/Skeleton.tsx", "../src/components/Toast/Toast.tsx", "../src/components/Dialog/Dialog.tsx", "../src/hooks/useModalDialog.ts", "../src/components/Drawer/Drawer.tsx", "../src/components/Popover/Popover.tsx", "../src/components/Menu/Menu.tsx", "../src/hooks/useMenuKeyboard.ts", "../src/components/CommandPalette/CommandPalette.tsx", "../src/components/CommandPalette/filterCommands.ts", "../src/components/Tabs/Tabs.tsx", "../src/components/Accordion/Accordion.tsx", "../src/components/Breadcrumbs/Breadcrumbs.tsx", "../src/components/Pagination/Pagination.tsx", "../src/components/Steps/Steps.tsx", "../src/components/NavList/NavList.tsx", "../src/components/AppShell/AppShell.context.ts", "../src/components/AppShell/AppShell.tsx", "../src/components/Layout/Layout.tsx", "../src/components/Table/Table.tsx", "../src/components/Stat/Stat.tsx", "../src/components/Chart/Cartesian.tsx", "../src/components/Chart/chartUtils.ts", "../src/components/Chart/ChartParts.tsx", "../src/components/Chart/LineChart.tsx", "../src/components/Chart/BarChart.tsx", "../src/components/Chart/DonutChart.tsx", "../src/components/Chart/Sparkline.tsx", "../src/components/FileTree/FileTree.tsx", "../src/components/EmptyState/EmptyState.tsx", "../src/components/Tag/Tag.tsx", "../src/components/Avatar/Avatar.tsx", "../src/components/Avatar/AvatarGroup.tsx", "../src/components/Kbd/Kbd.tsx", "../src/components/Card/Card.tsx", "../src/components/Container/Container.tsx", "../src/components/Section/Section.tsx", "../src/components/Marketing/Marketing.tsx", "../src/components/Prose/Prose.tsx", "../src/components/TextShimmer/TextShimmer.tsx", "../src/components/PromptInput/PromptInput.tsx", "../src/components/PromptInput/PromptSuggestion.tsx", "../src/components/Chat/ChatConversation.tsx", "../src/components/Chat/ChatMessage.tsx", "../src/components/Chat/ChatLoader.tsx", "../src/components/ChatTool/ChatTool.tsx", "../src/components/ChainOfThought/ChainOfThought.tsx", "../src/components/ChatSource/ChatSource.tsx", "../src/components/ColorPicker/ColorPicker.tsx", "../src/components/ColorPicker/ColorArea.tsx", "../src/components/ColorPicker/color.ts", "../src/components/ColorPicker/ColorSlider.tsx", "../src/components/ColorPicker/ColorSwatchPicker.tsx", "../src/utils/brand.ts"],
|
|
4
|
+
"sourcesContent": ["// Openware UI. Import the components from here and the CSS once:\n// import \"@openwarelabs/ui/fonts.css\";\n// import \"@openwarelabs/ui/styles.css\";\n\n// Typography\nexport { Text } from \"./components/Text/Text\";\nexport type { TextProps, TextVariant, TextTone } from \"./components/Text/Text\";\n\n// Buttons\nexport { Button, buttonClassName } from \"./components/Button/Button\";\nexport type { ButtonProps, ButtonStyleOptions, ButtonVariant, ButtonSize, ButtonShape } from \"./components/Button/Button\";\nexport { ButtonGroup, CloseButton, ToggleButton } from \"./components/Button/ButtonGroup\";\nexport type { ButtonGroupProps, CloseButtonProps, ToggleButtonProps } from \"./components/Button/ButtonGroup\";\nexport { SegmentedControl } from \"./components/SegmentedControl/SegmentedControl\";\nexport type { SegmentedControlProps, SegmentedControlOption } from \"./components/SegmentedControl/SegmentedControl\";\nexport { ChoiceCard } from \"./components/ChoiceCard/ChoiceCard\";\nexport type { ChoiceCardProps } from \"./components/ChoiceCard/ChoiceCard\";\nexport { CopyButton, CodeBlock, Snippet } from \"./components/CodeBlock/CodeBlock\";\nexport type { CopyButtonProps, CodeBlockProps, SnippetProps } from \"./components/CodeBlock/CodeBlock\";\nexport { ToggleButtonGroup } from \"./components/ToggleButtonGroup/ToggleButtonGroup\";\nexport type {\n ToggleButtonGroupProps,\n ToggleButtonGroupOption,\n ToggleButtonGroupSingleProps,\n ToggleButtonGroupMultipleProps,\n} from \"./components/ToggleButtonGroup/ToggleButtonGroup\";\nexport { Toolbar, ToolbarSeparator } from \"./components/Toolbar/Toolbar\";\nexport type { ToolbarProps, ToolbarSeparatorProps } from \"./components/Toolbar/Toolbar\";\n\n// Forms\nexport { Field } from \"./components/Field/Field\";\nexport type { FieldProps } from \"./components/Field/Field\";\nexport { Form, FormError, useFormStatus } from \"./components/Form/Form\";\nexport type { FormProps, FormErrorProps, FormStatus, FormValues, FormErrors, ValidityCheck, ValidityMessages } from \"./components/Form/Form\";\nexport { Input } from \"./components/Input/Input\";\nexport type { InputProps } from \"./components/Input/Input\";\nexport { SearchField } from \"./components/SearchField/SearchField\";\nexport type { SearchFieldProps } from \"./components/SearchField/SearchField\";\nexport { NumberField } from \"./components/NumberField/NumberField\";\nexport type { NumberFieldProps } from \"./components/NumberField/NumberField\";\nexport { InputOTP } from \"./components/InputOTP/InputOTP\";\nexport type { InputOTPProps } from \"./components/InputOTP/InputOTP\";\nexport { DateField } from \"./components/DateField/DateField\";\nexport type { DateFieldProps } from \"./components/DateField/DateField\";\nexport { TimeField } from \"./components/DateField/TimeField\";\nexport type { TimeFieldProps } from \"./components/DateField/TimeField\";\nexport { Textarea } from \"./components/Textarea/Textarea\";\nexport type { TextareaProps } from \"./components/Textarea/Textarea\";\nexport { Select } from \"./components/Select/Select\";\nexport type { SelectProps, SelectOption, SelectGroup, SelectItem } from \"./components/Select/Select\";\nexport { ListBox } from \"./components/ListBox/ListBox\";\nexport type { ListBoxProps, ListBoxModeProps, ListBoxOption, ListBoxGroup, ListBoxItem, ListBoxSelectionMode } from \"./components/ListBox/ListBox\";\nexport { Combobox } from \"./components/Combobox/Combobox\";\nexport type { ComboboxProps, ComboboxOption } from \"./components/Combobox/Combobox\";\nexport { Checkbox, CheckboxGroup, Fieldset } from \"./components/Checkbox/Checkbox\";\nexport type { CheckboxProps, CheckboxGroupProps, FieldsetProps } from \"./components/Checkbox/Checkbox\";\nexport { RadioGroup, Radio } from \"./components/RadioGroup/RadioGroup\";\nexport type { RadioGroupProps, RadioProps } from \"./components/RadioGroup/RadioGroup\";\nexport { Switch } from \"./components/Switch/Switch\";\nexport type { SwitchProps } from \"./components/Switch/Switch\";\nexport { Slider } from \"./components/Slider/Slider\";\nexport type { SliderProps } from \"./components/Slider/Slider\";\nexport { FileDropZone } from \"./components/FileDropZone/FileDropZone\";\nexport type { FileDropZoneProps } from \"./components/FileDropZone/FileDropZone\";\n\n// Dates\nexport { Calendar } from \"./components/Calendar/Calendar\";\nexport type { CalendarProps, CalendarHandle } from \"./components/Calendar/Calendar\";\nexport { DatePicker } from \"./components/Calendar/DatePicker\";\nexport type { DatePickerProps } from \"./components/Calendar/DatePicker\";\nexport { RangeCalendar } from \"./components/Calendar/RangeCalendar\";\nexport type { RangeCalendarProps, DateRange } from \"./components/Calendar/RangeCalendar\";\nexport { formatDateRange } from \"./components/Calendar/dates\";\nexport { DateRangePicker } from \"./components/Calendar/DateRangePicker\";\nexport type { DateRangePickerProps, DateRangePreset } from \"./components/Calendar/DateRangePicker\";\nexport { todayISO, addDays, addMonths, formatDate, weekday, parseISO, toISO } from \"./components/Calendar/dates\";\nexport type { ISODate } from \"./components/Calendar/dates\";\n\n// Feedback\nexport { Alert } from \"./components/Alert/Alert\";\nexport type { AlertProps, AlertVariant } from \"./components/Alert/Alert\";\nexport { Badge } from \"./components/Badge/Badge\";\nexport type { BadgeProps, BadgeVariant } from \"./components/Badge/Badge\";\nexport { ProgressBar, ProgressCircle } from \"./components/Progress/Progress\";\nexport type { ProgressBarProps, ProgressCircleProps, ProgressTone } from \"./components/Progress/Progress\";\nexport { Meter } from \"./components/Meter/Meter\";\nexport type { MeterProps } from \"./components/Meter/Meter\";\nexport { Spinner } from \"./components/Spinner/Spinner\";\nexport type { SpinnerProps } from \"./components/Spinner/Spinner\";\nexport { Skeleton, SkeletonRows } from \"./components/Skeleton/Skeleton\";\nexport type { SkeletonProps, SkeletonRowsProps } from \"./components/Skeleton/Skeleton\";\nexport { Toaster, toast } from \"./components/Toast/Toast\";\nexport type { ToasterProps, ToastOptions } from \"./components/Toast/Toast\";\nexport { Tooltip } from \"./components/Tooltip/Tooltip\";\nexport type { TooltipProps } from \"./components/Tooltip/Tooltip\";\n\n// Overlays\nexport { Dialog, ConfirmDialog } from \"./components/Dialog/Dialog\";\nexport type { DialogProps, ConfirmDialogProps } from \"./components/Dialog/Dialog\";\nexport { Drawer } from \"./components/Drawer/Drawer\";\nexport type { DrawerProps } from \"./components/Drawer/Drawer\";\nexport { Popover } from \"./components/Popover/Popover\";\nexport type { PopoverProps } from \"./components/Popover/Popover\";\nexport { Menu, MenuItem, MenuLabel, MenuSeparator } from \"./components/Menu/Menu\";\nexport type { MenuProps, MenuItemProps } from \"./components/Menu/Menu\";\nexport { CommandPalette } from \"./components/CommandPalette/CommandPalette\";\nexport type { Command, CommandPaletteProps } from \"./components/CommandPalette/CommandPalette\";\nexport { filterCommands } from \"./components/CommandPalette/filterCommands\";\n\n// Navigation\nexport { Tabs, TabList, Tab, TabPanel } from \"./components/Tabs/Tabs\";\nexport type { TabsProps, TabListProps, TabProps, TabPanelProps } from \"./components/Tabs/Tabs\";\nexport { Accordion, AccordionItem, Disclosure } from \"./components/Accordion/Accordion\";\nexport type { AccordionProps, AccordionItemProps, DisclosureProps } from \"./components/Accordion/Accordion\";\nexport { Breadcrumbs, Link, linkClassName } from \"./components/Breadcrumbs/Breadcrumbs\";\nexport type { BreadcrumbsProps, BreadcrumbItem, LinkProps, LinkStyleOptions } from \"./components/Breadcrumbs/Breadcrumbs\";\nexport { Pagination, paginationItems } from \"./components/Pagination/Pagination\";\nexport type { PaginationProps } from \"./components/Pagination/Pagination\";\nexport { Steps } from \"./components/Steps/Steps\";\nexport type { StepsProps, StepItem } from \"./components/Steps/Steps\";\nexport { NavList, NavItem } from \"./components/NavList/NavList\";\nexport type { NavListProps, NavItemProps } from \"./components/NavList/NavList\";\nexport { AppShell, SidebarHeader, SidebarContent, SidebarFooter, SidebarToggle, useAppShell } from \"./components/AppShell/AppShell\";\nexport type { AppShellProps, AppShellState, SidebarSectionProps, SidebarToggleProps } from \"./components/AppShell/AppShell\";\n\n// Data display\nexport { Table } from \"./components/Table/Table\";\nexport type { TableProps, TableColumn, TableSort } from \"./components/Table/Table\";\nexport { Stat } from \"./components/Stat/Stat\";\nexport type { StatProps } from \"./components/Stat/Stat\";\nexport { LineChart, BarChart, DonutChart, Sparkline } from \"./components/Chart/Chart\";\nexport type {\n BarChartProps,\n CartesianChartProps,\n ChartColor,\n ChartRow,\n ChartSeries,\n DonutChartProps,\n DonutChartSlice,\n LineChartProps,\n SparklineProps,\n} from \"./components/Chart/Chart\";\nexport { FileTree } from \"./components/FileTree/FileTree\";\nexport type { FileTreeProps, FileTreeNode } from \"./components/FileTree/FileTree\";\nexport { EmptyState } from \"./components/EmptyState/EmptyState\";\nexport type { EmptyStateProps } from \"./components/EmptyState/EmptyState\";\nexport { Tag, TagGroup, ColorSwatch } from \"./components/Tag/Tag\";\nexport type { TagProps, TagGroupProps, ColorSwatchProps } from \"./components/Tag/Tag\";\nexport { Avatar } from \"./components/Avatar/Avatar\";\nexport type { AvatarProps, AvatarSize } from \"./components/Avatar/Avatar\";\nexport { AvatarGroup, User } from \"./components/Avatar/AvatarGroup\";\nexport type { AvatarGroupProps, UserProps } from \"./components/Avatar/AvatarGroup\";\nexport { Kbd, Code } from \"./components/Kbd/Kbd\";\n\n// Layout\nexport { Card, SettingsRow } from \"./components/Card/Card\";\nexport type { CardProps, SettingsRowProps } from \"./components/Card/Card\";\nexport { Stack, Separator, ScrollShadow, VisuallyHidden } from \"./components/Layout/Layout\";\nexport { Container } from \"./components/Container/Container\";\nexport type { ContainerProps, ContainerSize } from \"./components/Container/Container\";\nexport { Section } from \"./components/Section/Section\";\nexport type { SectionProps } from \"./components/Section/Section\";\nexport type { StackProps, SeparatorProps, ScrollShadowProps, SpaceToken } from \"./components/Layout/Layout\";\n\n// Marketing\nexport { Chip, SectionHeading, SiteHeader, DotGrid } from \"./components/Marketing/Marketing\";\nexport type { SectionHeadingProps, SiteHeaderProps, DotGridProps } from \"./components/Marketing/Marketing\";\n\n// AI\nexport { Prose } from \"./components/Prose/Prose\";\nexport type { ProseProps } from \"./components/Prose/Prose\";\nexport { TextShimmer } from \"./components/TextShimmer/TextShimmer\";\nexport type { TextShimmerProps } from \"./components/TextShimmer/TextShimmer\";\nexport { PromptInput } from \"./components/PromptInput/PromptInput\";\nexport type { PromptInputProps, PromptAttachment } from \"./components/PromptInput/PromptInput\";\nexport { PromptSuggestion, PromptSuggestions } from \"./components/PromptInput/PromptSuggestion\";\nexport type { PromptSuggestionProps, PromptSuggestionsProps } from \"./components/PromptInput/PromptSuggestion\";\nexport { ChatConversation } from \"./components/Chat/ChatConversation\";\nexport type { ChatConversationProps, ChatConversationHandle } from \"./components/Chat/ChatConversation\";\nexport { ChatMessage, ChatMessageActions, ChatAgentAvatar } from \"./components/Chat/ChatMessage\";\nexport type {\n ChatMessageProps,\n ChatMessageActionsProps,\n ChatAgentAvatarProps,\n ChatMessageFrom,\n ChatMessageStatus,\n ChatRating,\n} from \"./components/Chat/ChatMessage\";\nexport { ChatLoader } from \"./components/Chat/ChatLoader\";\nexport type { ChatLoaderProps } from \"./components/Chat/ChatLoader\";\nexport { ChatTool } from \"./components/ChatTool/ChatTool\";\nexport type { ChatToolProps, ChatToolStatus } from \"./components/ChatTool/ChatTool\";\nexport { ChainOfThought } from \"./components/ChainOfThought/ChainOfThought\";\nexport type { ChainOfThoughtProps, ChainOfThoughtStep, ChainOfThoughtStatus } from \"./components/ChainOfThought/ChainOfThought\";\nexport { ChatSource, ChatSources } from \"./components/ChatSource/ChatSource\";\nexport type { ChatSourceProps, ChatSourcesProps, ChatSourceItem } from \"./components/ChatSource/ChatSource\";\n\n// Hooks and helpers\nexport { ColorField, ColorPicker } from \"./components/ColorPicker/ColorPicker\";\nexport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from \"./components/ColorPicker/ColorPicker\";\nexport { ColorArea } from \"./components/ColorPicker/ColorArea\";\nexport type { ColorAreaProps } from \"./components/ColorPicker/ColorArea\";\nexport { ColorSlider } from \"./components/ColorPicker/ColorSlider\";\nexport type { ColorChannel, ColorSliderProps } from \"./components/ColorPicker/ColorSlider\";\nexport { ColorSwatchPicker } from \"./components/ColorPicker/ColorSwatchPicker\";\nexport type { ColorSwatchPickerOption, ColorSwatchPickerProps } from \"./components/ColorPicker/ColorSwatchPicker\";\nexport { applyBrand, brandCss, brandPresets, brandScale, brandSteps, brandVariables } from \"./utils/brand\";\nexport type { BrandPreset, BrandScale, BrandStep } from \"./utils/brand\";\nexport { useModalDialog } from \"./hooks/useModalDialog\";\nexport { useMenuKeyboard } from \"./hooks/useMenuKeyboard\";\nexport { useControllableState } from \"./hooks/useControllableState\";\nexport { useFloating, useDismiss } from \"./hooks/useFloating\";\nexport { usePresence } from \"./hooks/usePresence\";\nexport type { Presence } from \"./hooks/usePresence\";\nexport type { Placement } from \"./hooks/useFloating\";\nexport { cx } from \"./utils/cx\";\nexport { getInitials } from \"./utils/text\";\nexport { copyText } from \"./utils/copyText\";\n", "type ClassValue = string | false | null | undefined | Record<string, boolean | undefined>;\n\n/** Joins class names, skipping falsy ones; an object adds each key whose value is true. */\nexport function cx(...values: ClassValue[]): string {\n const classes: string[] = [];\n for (const value of values) {\n if (!value) continue;\n if (typeof value === \"string\") {\n classes.push(value);\n continue;\n }\n for (const [name, on] of Object.entries(value)) if (on) classes.push(name);\n }\n return classes.join(\" \");\n}\n", "import type { HTMLAttributes, JSX, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** The text styles on the Typography page, by the same names: `lead` is the class ow-type-lead. */\nexport type TextVariant =\n | \"hero\"\n | \"page-title\"\n | \"section-title\"\n | \"heading\"\n | \"lead\"\n | \"prose\"\n | \"dialog-title\"\n | \"card-title\"\n | \"body\"\n | \"copy\"\n | \"label\"\n | \"button\"\n | \"caption\"\n | \"badge\"\n | \"overline\"\n | \"code\"\n | \"kbd\";\n\nexport type TextTone = \"default\" | \"soft\" | \"muted\" | \"primary\" | \"danger\" | \"success\" | \"warning\";\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n /** Which text style: size, leading, weight and tracking from the Typography page. The display styles shrink on phones.\n * @default \"body\" */\n variant?: TextVariant;\n /** The element, for the page's outline. Defaults to one that suits the variant: h1 for hero and page-title, h2 for\n * section-title, h3 for heading and the titles, p for running text, span for the rest. */\n as?: keyof JSX.IntrinsicElements;\n /** The colour. Left out, lead, copy, caption and overline are muted, as the styles ask, and the rest take the\n * colour around them. */\n tone?: TextTone;\n /** @default \"start\" */\n align?: \"start\" | \"center\" | \"end\";\n /** One line, cut off with an ellipsis.\n * @default false */\n truncate?: boolean;\n children?: ReactNode;\n}\n\nconst elements: Record<TextVariant, keyof JSX.IntrinsicElements> = {\n hero: \"h1\",\n \"page-title\": \"h1\",\n \"section-title\": \"h2\",\n heading: \"h3\",\n lead: \"p\",\n prose: \"p\",\n \"dialog-title\": \"h2\",\n \"card-title\": \"h3\",\n body: \"p\",\n copy: \"p\",\n label: \"span\",\n button: \"span\",\n caption: \"span\",\n badge: \"span\",\n overline: \"span\",\n code: \"code\",\n kbd: \"kbd\",\n};\n\nconst mutedByDefault: TextVariant[] = [\"lead\", \"copy\", \"caption\", \"overline\"];\n\n/**\n * Text in one of Openware's styles: `<Text variant=\"lead\">`. The variant sets the look and a sensible element;\n * `as` changes the element without changing the look, so the outline stays right.\n */\nexport function Text({ variant = \"body\", as, tone, align, truncate = false, className, children, ...props }: TextProps) {\n const Element = (as ?? elements[variant]) as \"p\";\n const colour = tone ?? (mutedByDefault.includes(variant) ? \"muted\" : undefined);\n return (\n <Element\n className={cx(\n \"ow-text\",\n `ow-type-${variant}`,\n `ow-text--${variant}`,\n colour && `ow-text--${colour}`,\n align && align !== \"start\" && `ow-text--${align}`,\n truncate && \"ow-text--truncate\",\n className,\n )}\n {...props}\n >\n {children}\n </Element>\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { toAriaShortcut } from \"../../utils/text\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n/** `rounded` is the app's 8px corner; `pill` is the marketing site's. */\nexport type ButtonShape = \"rounded\" | \"pill\";\n\nexport interface ButtonStyleOptions {\n /** primary for the one main action, secondary for the rest, ghost for low-stakes actions, danger for destructive ones.\n * @default \"secondary\" */\n variant?: ButtonVariant;\n /** sm 32px, md 40px, lg 44px (36, 40 and 46px as pills).\n * @default \"md\" */\n size?: ButtonSize;\n /** @default \"rounded\" */\n shape?: ButtonShape;\n /** A square button holding only an icon. Give it an aria-label.\n * @default false */\n iconOnly?: boolean;\n}\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonStyleOptions {\n /** An icon before the label, usually a 16px lucide-react icon. */\n startIcon?: ReactNode;\n /** An icon after the label, such as an arrow or a chevron. */\n endIcon?: ReactNode;\n /** Keyboard shortcut shown at the end, e.g. \"\u2318N\". Only pass one that actually works. */\n shortcut?: string;\n /** Shows a spinner in place of the start icon and disables the button, keeping its width.\n * @default false */\n loading?: boolean;\n /** Stretches the button to its container's width.\n * @default false */\n fullWidth?: boolean;\n}\n\n/**\n * The class names of a button, for things that must be another element: a router <Link>, an <a>.\n * `<Link className={buttonClassName({ variant: \"primary\" })}>Pricing</Link>`\n */\nexport function buttonClassName({\n variant = \"secondary\",\n size = \"md\",\n shape = \"rounded\",\n iconOnly = false,\n}: ButtonStyleOptions = {}): string {\n return cx(\n \"ow-button\",\n `ow-button--${variant}`,\n `ow-button--${size}`,\n shape === \"pill\" && \"ow-button--pill\",\n iconOnly && \"ow-button--icon-only\",\n );\n}\n\n/**\n * A tactile button: a light top-to-bottom gradient, a highlight along the top edge and a soft shadow,\n * pressed in by a pixel on click.\n */\nexport const Button = /* @__PURE__ */ forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n className,\n disabled,\n endIcon,\n fullWidth = false,\n iconOnly = false,\n loading = false,\n shape = \"rounded\",\n shortcut,\n size = \"md\",\n startIcon,\n type = \"button\",\n variant = \"secondary\",\n ...buttonProps\n },\n ref,\n) {\n const leading = loading ? <Spinner size=\"sm\" tone=\"current\" label=\"\" /> : startIcon;\n return (\n <button\n ref={ref}\n className={cx(\n buttonClassName({ variant, size, shape, iconOnly }),\n shortcut && !iconOnly && \"ow-button--with-shortcut\",\n loading && \"ow-button--loading\",\n fullWidth && \"ow-button--full\",\n className,\n )}\n type={type}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n aria-keyshortcuts={shortcut ? toAriaShortcut(shortcut) : undefined}\n {...buttonProps}\n >\n {leading ? <span className=\"ow-button__icon\">{leading}</span> : null}\n {iconOnly && loading ? null : children}\n {endIcon && !iconOnly ? <span className=\"ow-button__icon\">{endIcon}</span> : null}\n {shortcut && !iconOnly ? (\n <kbd aria-hidden=\"true\" className=\"ow-button__shortcut\">\n {shortcut}\n </kbd>\n ) : null}\n </button>\n );\n});\n", "/** \"Alex Silver\" \u2192 \"AS\", \"alex\" \u2192 \"A\". Empty input returns \"\". */\nexport function getInitials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? \"\") : \"\";\n\n return `${first}${last}`.toUpperCase();\n}\n\n/** \"\u2318N\" \u2192 \"Meta+N\", \"Ctrl+O\" \u2192 \"Control+O\", for aria-keyshortcuts. */\nexport function toAriaShortcut(shortcut: string): string {\n return shortcut.replace(\"\u2318\", \"Meta+\").replace(\"Ctrl+\", \"Control+\");\n}\n", "import { cx } from \"../../utils/cx\";\n\nexport interface SpinnerProps {\n /** sm 14px, md 20px, lg 28px.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** `primary` draws the arc in the progress colour; `current` takes the text colour, for use inside buttons.\n * @default \"primary\" */\n tone?: \"primary\" | \"current\";\n /** Read out by screen readers. Pass an empty string when something nearby already says it's loading.\n * @default \"Loading\" */\n label?: string;\n className?: string;\n}\n\n/** A small spinning ring for work that takes a moment. */\nexport function Spinner({ size = \"md\", tone = \"primary\", label = \"Loading\", className }: SpinnerProps) {\n return (\n <span\n className={cx(\"ow-spinner\", `ow-spinner--${size}`, `ow-spinner--${tone}`, className)}\n {...(label ? { role: \"status\", \"aria-label\": label } : { \"aria-hidden\": true })}\n />\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button, type ButtonProps } from \"./Button\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Joins the buttons into one control with shared borders. Off, they sit 8px apart.\n * @default true */\n attached?: boolean;\n /** @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n}\n\n/** Buttons that belong together: a toolbar's actions, or a split choice like \"Day \u00B7 Week \u00B7 Month\". */\nexport function ButtonGroup({ attached = true, orientation = \"horizontal\", className, ...props }: ButtonGroupProps) {\n return (\n <div\n role=\"group\"\n className={cx(\n \"ow-button-group\",\n attached && \"ow-button-group--attached\",\n orientation === \"vertical\" && \"ow-button-group--vertical\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface CloseButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** sm 24px for toasts and tags, md 32px for dialogs and panels.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** What it closes, for screen readers.\n * @default \"Close\" */\n label?: string;\n}\n\n/** The \u2715 in a dialog, drawer or panel header. */\nexport const CloseButton = /* @__PURE__ */ forwardRef<HTMLButtonElement, CloseButtonProps>(function CloseButton(\n { size = \"md\", label = \"Close\", className, type = \"button\", ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n aria-label={label}\n className={cx(\"ow-close-button\", `ow-close-button--${size}`, className)}\n {...buttonProps}\n >\n <XIcon size={size === \"sm\" ? 14 : 17} />\n </button>\n );\n});\n\nexport interface ToggleButtonProps extends Omit<ButtonProps, \"variant\"> {\n /** Whether it's on. Leave out to let the button keep its own state. */\n pressed?: boolean;\n /** The starting state when uncontrolled.\n * @default false */\n defaultPressed?: boolean;\n onPressedChange?(pressed: boolean): void;\n /** @default \"secondary\" */\n variant?: \"secondary\" | \"ghost\";\n}\n\n/** A button that stays pressed in while something is on: bold text, a filter, a view mode. */\nexport const ToggleButton = /* @__PURE__ */ forwardRef<HTMLButtonElement, ToggleButtonProps>(function ToggleButton(\n { pressed, defaultPressed = false, onPressedChange, onClick, className, variant = \"secondary\", ...buttonProps },\n ref,\n) {\n const [isPressed, setPressed] = useControllableState(pressed, defaultPressed, onPressedChange);\n return (\n <Button\n ref={ref}\n variant={variant}\n aria-pressed={isPressed}\n className={cx(isPressed && \"ow-button--pressed\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setPressed(!isPressed);\n }}\n {...buttonProps}\n />\n );\n});\n", "import { useCallback, useRef, useState } from \"react\";\n\n/**\n * State that a parent may control (`value` + `onChange`) or leave to the component (`defaultValue`).\n * Returns the current value and a setter that calls `onChange` either way.\n */\nexport function useControllableState<T>(\n value: T | undefined,\n defaultValue: T,\n onChange?: (next: T) => void,\n): [T, (next: T | ((previous: T) => T)) => void] {\n const [internal, setInternal] = useState<T>(defaultValue);\n const isControlled = value !== undefined;\n const current = isControlled ? value : internal;\n const currentRef = useRef(current);\n currentRef.current = current;\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const setValue = useCallback(\n (next: T | ((previous: T) => T)) => {\n const resolved =\n typeof next === \"function\" ? (next as (previous: T) => T)(currentRef.current) : next;\n if (Object.is(resolved, currentRef.current)) return;\n if (!isControlled) setInternal(resolved);\n onChangeRef.current?.(resolved);\n },\n [isControlled],\n );\n\n return [current, setValue];\n}\n", "import type { ReactNode, SVGProps } from \"react\";\n\n/*\n * The few icons the components draw themselves. They are Lucide shapes (ISC licence, lucide.dev):\n * a 24-unit grid, 2px round strokes in currentColor. For your own icons, use lucide-react.\n */\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n size?: number;\n}\n\nfunction icon(paths: ReactNode) {\n return function Icon({ size = 16, strokeWidth = 2, ...props }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n {paths}\n </svg>\n );\n };\n}\n\nexport const CheckIcon = /* @__PURE__ */ icon(<path d=\"M20 6 9 17l-5-5\" />);\nexport const ChevronDownIcon = /* @__PURE__ */ icon(<path d=\"m6 9 6 6 6-6\" />);\nexport const SearchIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </>,\n);\nexport const CornerDownLeftIcon = /* @__PURE__ */ icon(\n <>\n <polyline points=\"9 10 4 15 9 20\" />\n <path d=\"M20 4v7a4 4 0 0 1-4 4H4\" />\n </>,\n);\nexport const XIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>,\n);\nexport const UserIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </>,\n);\nexport const TrashIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M3 6h18\" />\n <path d=\"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6\" />\n <path d=\"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2\" />\n <line x1=\"10\" x2=\"10\" y1=\"11\" y2=\"17\" />\n <line x1=\"14\" x2=\"14\" y1=\"11\" y2=\"17\" />\n </>,\n);\nexport const CircleCheckIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </>,\n);\nexport const CircleAlertIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </>,\n);\nexport const ChevronRightIcon = /* @__PURE__ */ icon(<path d=\"m9 18 6-6-6-6\" />);\nexport const ChevronLeftIcon = /* @__PURE__ */ icon(<path d=\"m15 18-6-6 6-6\" />);\nexport const ChevronUpIcon = /* @__PURE__ */ icon(<path d=\"m18 15-6-6-6 6\" />);\nexport const MinusIcon = /* @__PURE__ */ icon(<path d=\"M5 12h14\" />);\nexport const PlusIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </>,\n);\nexport const InfoIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </>,\n);\nexport const TriangleAlertIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </>,\n);\nexport const PipetteIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m2 22 1-1h3l9-9\" />\n <path d=\"M3 21v-3l9-9\" />\n <path d=\"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z\" />\n </>,\n);\nexport const CopyIcon = /* @__PURE__ */ icon(\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>,\n);\nexport const CalendarIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M8 2v4\" />\n <path d=\"M16 2v4\" />\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\" />\n <path d=\"M3 10h18\" />\n </>,\n);\nexport const FileIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n </>,\n);\nexport const FolderIcon = /* @__PURE__ */ icon(\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />,\n);\nexport const FolderOpenIcon = /* @__PURE__ */ icon(\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />,\n);\nexport const UploadIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <polyline points=\"17 8 12 3 7 8\" />\n <line x1=\"12\" x2=\"12\" y1=\"3\" y2=\"15\" />\n </>,\n);\nexport const ArrowUpRightIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </>,\n);\nexport const ArrowUpIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m5 12 7-7 7 7\" />\n <path d=\"M12 19V5\" />\n </>,\n);\nexport const ArrowDownIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </>,\n);\nexport const ChevronsUpDownIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </>,\n);\nexport const InboxIcon = /* @__PURE__ */ icon(\n <>\n <polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </>,\n);\nexport const EllipsisIcon = /* @__PURE__ */ icon(\n <>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </>,\n);\nexport const MenuIcon = /* @__PURE__ */ icon(\n <>\n <path d=\"M4 5h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 19h16\" />\n </>,\n);\nexport const PanelLeftOpenIcon = /* @__PURE__ */ icon(\n <>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m14 9 3 3-3 3\" />\n </>,\n);\nexport const PanelLeftCloseIcon = /* @__PURE__ */ icon(\n <>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m16 15-3-3 3-3\" />\n </>,\n);\n", "import { useRef, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { useIndicator } from \"../../hooks/useIndicator\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** A 16px icon before the label. With no label, give the option an aria-label. */\n icon?: ReactNode;\n disabled?: boolean;\n \"aria-label\"?: string;\n}\n\nexport interface SegmentedControlProps {\n options: SegmentedControlOption[];\n value?: string;\n /** The starting value when uncontrolled. Defaults to the first option. */\n defaultValue?: string;\n onChange?(value: string): void;\n /** sm 28px, md 32px tall.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Stretches the segments to fill the container.\n * @default false */\n fullWidth?: boolean;\n /** Names the choice for screen readers. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Two to five mutually exclusive options in a well, with the chosen one raised: a view switch, a filter.\n * It behaves like a radio group: the arrow keys move and choose.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = \"md\",\n fullWidth = false,\n disabled = false,\n className,\n ...aria\n}: SegmentedControlProps) {\n const [current, setCurrent] = useControllableState(value, defaultValue ?? options[0]?.value ?? \"\", onChange);\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n const groupRef = useRef<HTMLDivElement>(null);\n useIndicator(groupRef, '[aria-checked=\"true\"]', current);\n const enabled = options.map((option, index) => ({ option, index })).filter(({ option }) => !option.disabled);\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>, index: number) {\n const keys: Record<string, number> = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };\n let target: number | undefined;\n if (event.key in keys) {\n const position = enabled.findIndex((entry) => entry.index === index);\n target = enabled[(position + keys[event.key]! + enabled.length) % enabled.length]?.index;\n } else if (event.key === \"Home\") target = enabled[0]?.index;\n else if (event.key === \"End\") target = enabled[enabled.length - 1]?.index;\n if (target === undefined) return;\n event.preventDefault();\n refs.current[target]?.focus();\n setCurrent(options[target]!.value);\n }\n\n const focusable = options.some((option) => option.value === current && !option.disabled) ? current : enabled[0]?.option.value;\n\n return (\n <div\n ref={groupRef}\n role=\"radiogroup\"\n className={cx(\"ow-segmented\", `ow-segmented--${size}`, fullWidth && \"ow-segmented--full\", disabled && \"ow-segmented--disabled\", className)}\n {...aria}\n >\n {options.map((option, index) => {\n const isSelected = option.value === current;\n return (\n <button\n key={option.value}\n ref={(element) => {\n refs.current[index] = element;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={option[\"aria-label\"]}\n tabIndex={option.value === focusable ? 0 : -1}\n disabled={disabled || option.disabled}\n className={cx(\"ow-segmented__item\", isSelected && \"ow-segmented__item--selected\")}\n onClick={() => setCurrent(option.value)}\n onKeyDown={(event) => onKeyDown(event, index)}\n >\n {option.icon ? <span className=\"ow-segmented__icon\">{option.icon}</span> : null}\n {option.label}\n </button>\n );\n })}\n <span className=\"ow-indicator\" aria-hidden=\"true\" />\n </div>\n );\n}\n", "import { useLayoutEffect, type RefObject } from \"react\";\n\n/**\n * Measures the selected child of `containerRef` (the first match of `selector`) and writes its box to the\n * container as --ow-indicator-x, -y, -w and -h, so one absolutely placed element (.ow-indicator) can slide\n * between choices. The container gets data-indicator=\"placed\" on the first measure (no animation) and \"ready\"\n * a frame later (animated from then on). It re-measures when `key` changes or anything resizes.\n */\nexport function useIndicator(containerRef: RefObject<HTMLElement | null>, selector: string, key: unknown) {\n useLayoutEffect(() => {\n const container = containerRef.current;\n if (!container) return undefined;\n let frame = 0;\n\n const measure = () => {\n const selected = container.querySelector<HTMLElement>(selector);\n if (!selected) {\n delete container.dataset.indicator;\n return;\n }\n container.style.setProperty(\"--ow-indicator-x\", `${selected.offsetLeft}px`);\n container.style.setProperty(\"--ow-indicator-y\", `${selected.offsetTop}px`);\n container.style.setProperty(\"--ow-indicator-w\", `${selected.offsetWidth}px`);\n container.style.setProperty(\"--ow-indicator-h\", `${selected.offsetHeight}px`);\n if (!container.dataset.indicator) {\n container.dataset.indicator = \"placed\";\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (container.dataset.indicator) container.dataset.indicator = \"ready\";\n });\n });\n }\n };\n\n measure();\n if (typeof ResizeObserver === \"undefined\") return () => cancelAnimationFrame(frame);\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n for (const child of container.children) observer.observe(child);\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n };\n }, [containerRef, selector, key]);\n}\n", "import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { toAriaShortcut } from \"../../utils/text\";\n\nexport interface ChoiceCardProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"title\"> {\n title: string;\n /** One line under the title saying what this choice does. */\n description: string;\n /** A 20px lucide-react icon, shown on a tinted tile. */\n icon: ReactNode;\n /** Marks the recommended choice with a tinted border. */\n recommended?: boolean;\n /** Keyboard shortcut shown in the top-right corner, e.g. \"\u2318N\". Only pass one that actually works. */\n shortcut?: string;\n}\n\n/** A large, card-shaped button for picking between a few options, e.g. on an empty state. */\nexport const ChoiceCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, ChoiceCardProps>(function ChoiceCard(\n { className, description, icon, recommended = false, shortcut, title, type = \"button\", ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n className={cx(\"ow-choice\", recommended && \"ow-choice--recommended\", className)}\n type={type}\n aria-keyshortcuts={shortcut ? toAriaShortcut(shortcut) : undefined}\n {...buttonProps}\n >\n <span className=\"ow-choice__top\">\n <span className=\"ow-choice__icon\">{icon}</span>\n {shortcut ? (\n <kbd aria-hidden=\"true\" className=\"ow-choice__shortcut\">\n {shortcut}\n </kbd>\n ) : null}\n </span>\n <span className=\"ow-choice__text\">\n <span className=\"ow-choice__title\">{title}</span>\n <span className=\"ow-choice__description\">{description}</span>\n </span>\n </button>\n );\n});\n", "import { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nimport { CheckIcon, CopyIcon } from \"../../icons\";\nimport { copyText } from \"../../utils/copyText\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface CopyButtonProps {\n /** The text to copy. */\n value: string;\n /** Shown beside the icon, and read out.\n * @default \"Copy\" */\n label?: string;\n /** Shown for two seconds after copying.\n * @default \"Copied\" */\n copiedLabel?: string;\n /** Just the icon; the label is still read out.\n * @default false */\n iconOnly?: boolean;\n /** `default` sits on surfaces; `onDark` sits on a code block.\n * @default \"default\" */\n tone?: \"default\" | \"onDark\";\n onCopy?(): void;\n className?: string;\n}\n\n/** Copies a value and says so: the icon turns into a check for two seconds and screen readers hear \"Copied\". */\nexport function CopyButton({ value, label = \"Copy\", copiedLabel = \"Copied\", iconOnly = false, tone = \"default\", onCopy, className }: CopyButtonProps) {\n const [copied, setCopied] = useState(false);\n const timer = useRef(0);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n return (\n <button\n type=\"button\"\n className={cx(\n \"ow-copy-button\",\n tone === \"onDark\" && \"ow-copy-button--on-dark\",\n iconOnly && \"ow-copy-button--icon-only\",\n copied && \"ow-copy-button--copied\",\n className,\n )}\n aria-label={iconOnly ? (copied ? copiedLabel : label) : undefined}\n onClick={async () => {\n if (await copyText(value)) {\n setCopied(true);\n onCopy?.();\n window.clearTimeout(timer.current);\n timer.current = window.setTimeout(() => setCopied(false), 2000);\n }\n }}\n >\n <span className=\"ow-copy-button__icon\" aria-hidden=\"true\">\n <CopyIcon size={14} />\n <CheckIcon size={14} />\n </span>\n {iconOnly ? null : <span>{copied ? copiedLabel : label}</span>}\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {copied ? copiedLabel : \"\"}\n </span>\n </button>\n );\n}\n\nexport interface CodeBlockProps {\n /** The code, as plain text. It's what the copy button copies. */\n code: string;\n /** Pre-highlighted HTML for the code (from Shiki or Prism, say). Without it the code shows plain. */\n html?: string;\n /** A file name or caption in the header. */\n title?: ReactNode;\n /** Shown on the right of the header, e.g. \"tsx\". */\n language?: string;\n /** @default false */\n showLineNumbers?: boolean;\n /** @default true */\n copyable?: boolean;\n /** Scrolls past this height (pixels). */\n maxHeight?: number;\n className?: string;\n}\n\n/** Code on a night ground, the same in both themes, with a copy button. */\nexport function CodeBlock({ code, html, title, language, showLineNumbers = false, copyable = true, maxHeight, className }: CodeBlockProps) {\n const hasHeader = title !== undefined || language !== undefined;\n const lines = code.replace(/\\n$/, \"\").split(\"\\n\");\n return (\n <div className={cx(\"ow-code-block\", showLineNumbers && \"ow-code-block--numbered\", className)}>\n {hasHeader ? (\n <div className=\"ow-code-block__header\">\n <span className=\"ow-code-block__title\">{title}</span>\n {language ? <span className=\"ow-code-block__language\">{language}</span> : null}\n {copyable ? <CopyButton value={code} tone=\"onDark\" iconOnly label=\"Copy code\" /> : null}\n </div>\n ) : copyable ? (\n <CopyButton value={code} tone=\"onDark\" iconOnly label=\"Copy code\" className=\"ow-code-block__floating-copy\" />\n ) : null}\n <pre className=\"ow-code-block__pre\" style={maxHeight ? { maxHeight } : undefined} tabIndex={0}>\n {showLineNumbers ? (\n <span className=\"ow-code-block__numbers\" aria-hidden=\"true\">\n {lines.map((_, index) => (\n <span key={index}>{index + 1}</span>\n ))}\n </span>\n ) : null}\n {html ? (\n <code className=\"ow-code-block__code\" dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <code className=\"ow-code-block__code\">{code.replace(/\\n$/, \"\")}</code>\n )}\n </pre>\n </div>\n );\n}\n\nexport interface SnippetProps {\n /** The command or value, copied as is. */\n value: string;\n /** A muted prompt before it, such as \"$\".\n * @default \"$\" */\n prompt?: string | null;\n className?: string;\n}\n\n/** One line to copy: an install command, an API key name, a URL. */\nexport function Snippet({ value, prompt = \"$\", className }: SnippetProps) {\n return (\n <div className={cx(\"ow-snippet\", className)}>\n <code className=\"ow-snippet__code\">\n {prompt ? (\n <span className=\"ow-snippet__prompt\" aria-hidden=\"true\">\n {prompt}\n </span>\n ) : null}\n {value}\n </code>\n <CopyButton value={value} iconOnly label={`Copy ${value}`} />\n </div>\n );\n}\n", "/** Copies text to the clipboard, falling back to a hidden textarea where the Clipboard API is refused. */\nexport async function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let ok = false;\n try {\n ok = document.execCommand(\"copy\");\n } catch {\n ok = false;\n }\n area.remove();\n return ok;\n }\n}\n", "import { useContext, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { ToggleButton } from \"../Button/ButtonGroup\";\nimport { ToolbarContext } from \"../Toolbar/Toolbar\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface ToggleButtonGroupOption {\n /** Identifies the option in `value`. */\n value: string;\n /** The visible text. Leave it out for an icon-only option, and give that an aria-label. */\n label?: ReactNode;\n /** A 16px icon before the label, or on its own. */\n icon?: ReactNode;\n /** Names an icon-only option for screen readers; a tooltip shows the same words. */\n \"aria-label\"?: string;\n /** Greys the option out; the arrow keys skip it.\n * @default false */\n disabled?: boolean;\n}\n\nexport interface ToggleButtonGroupProps {\n /** The toggles, in order. */\n options: ToggleButtonGroupOption[];\n /** `multiple` lets any number be on, like bold and italic; `single` allows at most one, like an alignment.\n * Either way all can be off, unless `disallowEmptySelection`.\n * @default \"single\" */\n selectionMode?: \"single\" | \"multiple\";\n /** What's on: in single mode a value, or \"\" for none; in multiple mode an array of values. Leave it out to let the\n * group keep its own state. */\n value?: string | string[];\n /** The starting value when uncontrolled.\n * @default \"\" or [] */\n defaultValue?: string | string[];\n /** Called with the new value: a string (\"\" for none) in single mode, an array in the options' order in multiple mode. */\n onChange?(value: string | string[]): void;\n /** Keeps one option on: pressing the only one that's on leaves it on.\n * @default false */\n disallowEmptySelection?: boolean;\n /** sm 32px, md 40px tall, like Button. Inside a Toolbar it takes the toolbar's size.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Inside a Toolbar it takes the toolbar's orientation.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Disables every option, keeping what's on visible.\n * @default false */\n disabled?: boolean;\n /** Names the group for screen readers, e.g. \"Text style\". */\n \"aria-label\"?: string;\n /** The id of a visible label for the group, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** The id of a hint or description for the group. */\n \"aria-describedby\"?: string;\n /** An id for the group's element. */\n id?: string;\n /** Extra classes for the group. */\n className?: string;\n}\n\ntype SharedProps = Omit<ToggleButtonGroupProps, \"selectionMode\" | \"value\" | \"defaultValue\" | \"onChange\">;\n\n/** The props in single mode: `value` is one option's value, or \"\" when none is on. */\nexport type ToggleButtonGroupSingleProps = SharedProps & {\n selectionMode?: \"single\";\n value?: string;\n defaultValue?: string;\n onChange?(value: string): void;\n};\n\n/** The props in multiple mode: `value` is the values of the options that are on. */\nexport type ToggleButtonGroupMultipleProps = SharedProps & {\n selectionMode: \"multiple\";\n value?: string[];\n defaultValue?: string[];\n onChange?(value: string[]): void;\n};\n\nconst toList = (value: string | string[] | undefined): string[] | undefined =>\n value === undefined ? undefined : Array.isArray(value) ? value : value === \"\" ? [] : [value];\n\nconst hasLabel = (option: ToggleButtonGroupOption) => option.label !== undefined && option.label !== null && option.label !== false && option.label !== \"\";\n\n/**\n * Toggle buttons joined into one control: several can be on (bold, italic, underline) or at most one (an alignment),\n * and, unlike a SegmentedControl, all can be off. On its own it's one tab stop with the arrow keys moving between its\n * buttons; inside a Toolbar it leaves the arrow keys to the toolbar.\n */\nexport function ToggleButtonGroup(props: ToggleButtonGroupSingleProps | ToggleButtonGroupMultipleProps) {\n const {\n options,\n selectionMode = \"single\",\n value,\n defaultValue,\n onChange,\n disallowEmptySelection = false,\n size: sizeProp,\n orientation: orientationProp,\n disabled = false,\n className,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n } = props as ToggleButtonGroupProps;\n const toolbar = useContext(ToolbarContext);\n const size = sizeProp ?? toolbar?.size ?? \"md\";\n const orientation = orientationProp ?? toolbar?.orientation ?? \"horizontal\";\n const multiple = selectionMode === \"multiple\";\n\n const [selected, setSelected] = useControllableState<string[]>(toList(value), toList(defaultValue) ?? [], (next) =>\n onChange?.(multiple ? next : (next[0] ?? \"\")),\n );\n const [focusedValue, setFocusedValue] = useState<string | null>(null);\n const refs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const rank = (item: string) => {\n const index = options.findIndex((option) => option.value === item);\n return index < 0 ? options.length : index;\n };\n\n function toggle(item: string) {\n let next: string[];\n if (selected.includes(item)) next = multiple ? selected.filter((entry) => entry !== item) : [];\n else next = multiple ? [...selected, item].sort((a, b) => rank(a) - rank(b)) : [item];\n if (next.length === 0 && disallowEmptySelection) return;\n setSelected(next);\n }\n\n // On its own, the group is one tab stop: the button focused last, else the first that's on, else the first.\n const enabled = disabled ? [] : options.filter((option) => !option.disabled);\n const tabStop = enabled.find((option) => option.value === focusedValue) ?? enabled.find((option) => selected.includes(option.value)) ?? enabled[0];\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>, current: string) {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = getComputedStyle(event.currentTarget).direction === \"rtl\";\n const steps: Record<string, number> = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1, ArrowDown: 1, ArrowUp: -1 };\n const position = enabled.findIndex((option) => option.value === current);\n let target: number | undefined;\n if (event.key in steps) target = (position + steps[event.key]! + enabled.length) % enabled.length;\n else if (event.key === \"Home\") target = 0;\n else if (event.key === \"End\") target = enabled.length - 1;\n if (target === undefined || !enabled[target]) return;\n event.preventDefault();\n refs.current[options.indexOf(enabled[target]!)]?.focus();\n }\n\n const iconOnly = options.length > 0 && options.every((option) => option.icon && !hasLabel(option));\n\n return (\n <div\n role=\"group\"\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={cx(\n \"ow-toggle-group\",\n `ow-toggle-group--${size}`,\n orientation === \"vertical\" && \"ow-toggle-group--vertical\",\n iconOnly && \"ow-toggle-group--icon-only\",\n className,\n )}\n >\n {options.map((option, index) => {\n const optionIconOnly = Boolean(option.icon) && !hasLabel(option);\n const button = (\n <ToggleButton\n key={option.value}\n ref={(element) => {\n refs.current[index] = element;\n }}\n size={size}\n iconOnly={optionIconOnly}\n startIcon={optionIconOnly ? undefined : option.icon}\n aria-label={option[\"aria-label\"]}\n pressed={selected.includes(option.value)}\n onPressedChange={() => toggle(option.value)}\n disabled={disabled || option.disabled}\n // In a toolbar, the toolbar sets the tab stops and handles the arrow keys.\n tabIndex={toolbar ? undefined : option === tabStop ? 0 : -1}\n onFocus={() => setFocusedValue(option.value)}\n onKeyDown={toolbar ? undefined : (event) => onKeyDown(event, option.value)}\n >\n {optionIconOnly ? option.icon : option.label}\n </ToggleButton>\n );\n return optionIconOnly && option[\"aria-label\"] ? (\n <Tooltip key={option.value} label={option[\"aria-label\"]} placement={orientation === \"vertical\" ? \"right\" : \"top\"}>\n {button}\n </Tooltip>\n ) : (\n button\n );\n })}\n </div>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n type FocusEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the toolbar for screen readers, e.g. \"Formatting\". Every toolbar needs a name, from this or aria-labelledby. */\n \"aria-label\"?: string;\n /** The id of a visible heading that names the toolbar, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Which way it runs. The arrow keys follow it: Left and Right across a horizontal toolbar, Up and Down a vertical one.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** `raised` is a bar of its own: a surface with a hairline border and a soft shadow. `plain` has no ground, for a\n * toolbar in a card or panel header.\n * @default \"raised\" */\n variant?: \"raised\" | \"plain\";\n /** The bar's padding and gaps, and the size its ToggleButtonGroups and separators take. Give its Buttons the same size.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n}\n\nexport interface ToolbarSeparatorProps {\n /** Extra classes for the line. */\n className?: string;\n}\n\ninterface ToolbarContextValue {\n orientation: \"horizontal\" | \"vertical\";\n size: \"sm\" | \"md\";\n}\n\n/** Lets what's inside a Toolbar follow its orientation and size, and leave the arrow keys to it. */\nexport const ToolbarContext = /* @__PURE__ */ createContext<ToolbarContextValue | null>(null);\n\nconst candidates =\n 'button, a[href], input:not([type=\"hidden\"]), select, textarea, [contenteditable=\"\"], [contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [tabindex]';\n\n/** Input types that edit text on one line: Left and Right move the caret, and only leave the field from its edge. */\nconst textTypes = [\"text\", \"search\", \"url\", \"tel\", \"password\", \"email\"];\n/** Input types that don't use the arrow keys at all. */\nconst pressTypes = [\"button\", \"checkbox\", \"submit\", \"reset\", \"image\", \"file\", \"color\"];\n\n/**\n * The controls the toolbar moves between, in DOM order: every enabled, visible, focusable element, except those in\n * a popover (a menu or listbox opened from the toolbar) or a nested toolbar, and those whose own tabindex of -1 says\n * they're not tab stops (the toolbar remembers the ones it set itself).\n */\nfunction itemsOf(root: HTMLElement, managed: WeakSet<HTMLElement>): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(candidates)).filter((element) => {\n if (element.matches(\":disabled\") || element.closest(\"[inert]\")) return false;\n const tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex !== null && Number(tabIndex) < 0 && !managed.has(element)) return false;\n if (!ownedBy(root, element)) return false;\n return element.getClientRects().length > 0;\n });\n}\n\n/** Whether an element belongs to this toolbar rather than to a popover or another toolbar inside it. */\nfunction ownedBy(root: HTMLElement, element: HTMLElement): boolean {\n for (let node = element.parentElement; node && node !== root; node = node.parentElement) {\n if (node.hasAttribute(\"popover\") || node.getAttribute(\"role\") === \"toolbar\") return false;\n }\n return root.contains(element);\n}\n\n/** Whether a control needs the key itself: fields keep their caret keys, an open select keeps every arrow. */\nfunction keepsKey(element: HTMLElement, key: string, forward: boolean): boolean {\n if (element.isContentEditable || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) return true;\n if (element.getAttribute(\"aria-expanded\") === \"true\" && element.hasAttribute(\"aria-haspopup\")) return true;\n const role = element.getAttribute(\"role\");\n if (role === \"slider\" || role === \"spinbutton\") return true;\n if (!(element instanceof HTMLInputElement) || pressTypes.includes(element.type)) return false;\n if (!textTypes.includes(element.type)) return true;\n if (key === \"ArrowUp\" || key === \"ArrowDown\") return false;\n if (key === \"Home\" || key === \"End\") return true;\n const { selectionStart, selectionEnd, value } = element;\n if (selectionStart === null || selectionEnd === null || selectionStart !== selectionEnd) return true;\n return forward ? selectionEnd < value.length : selectionStart > 0;\n}\n\n/**\n * A row of controls for one context: an editor's formatting bar, a table's actions. It's a single tab stop: the\n * arrow keys move between every control inside it, ToggleButtonGroups' buttons included, and Tab leaves it, coming\n * back to the control that was focused last.\n */\nexport const Toolbar = /* @__PURE__ */ forwardRef<HTMLDivElement, ToolbarProps>(function Toolbar(\n { orientation = \"horizontal\", variant = \"raised\", size = \"md\", className, children, onKeyDown, onFocus, ...props },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const activeRef = useRef<HTMLElement | null>(null);\n const activeIndex = useRef(0);\n const managed = useRef(new WeakSet<HTMLElement>());\n const context = useMemo(() => ({ orientation, size }), [orientation, size]);\n\n const setRef = useCallback(\n (element: HTMLDivElement | null) => {\n rootRef.current = element;\n if (typeof forwardedRef === \"function\") forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n },\n [forwardedRef],\n );\n\n // Roving tabindex: the active control is the one tab stop; the rest are -1. When it goes (removed or disabled),\n // the control that took its place in the order becomes the tab stop.\n const sync = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n const items = itemsOf(root, managed.current);\n let active = activeRef.current && items.includes(activeRef.current) ? activeRef.current : null;\n if (!active) {\n const focused = items.find((item) => item === document.activeElement);\n active = focused ?? items[Math.min(activeIndex.current, items.length - 1)] ?? null;\n }\n // With every control disabled there's nothing to move to; keep the memory for when they come back.\n if (active) {\n activeRef.current = active;\n activeIndex.current = items.indexOf(active);\n }\n for (const item of items) {\n const tabIndex = item === active ? \"0\" : \"-1\";\n if (item.getAttribute(\"tabindex\") !== tabIndex) item.setAttribute(\"tabindex\", tabIndex);\n managed.current.add(item);\n }\n }, []);\n\n useLayoutEffect(sync);\n\n // Controls inside can appear, go or be disabled without the toolbar rendering again. Writes only happen when\n // something differs, so the observer settles after its own changes.\n useEffect(() => {\n const root = rootRef.current;\n if (!root || typeof MutationObserver === \"undefined\") return undefined;\n const observer = new MutationObserver(sync);\n observer.observe(root, { subtree: true, childList: true, attributes: true, attributeFilter: [\"disabled\", \"hidden\", \"inert\", \"tabindex\"] });\n return () => observer.disconnect();\n }, [sync]);\n\n function handleFocus(event: FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n const root = rootRef.current;\n const target = event.target as HTMLElement;\n if (!root || target === root || !ownedBy(root, target)) return;\n // Whatever takes focus (a click, a menu handing focus back, a control that moves focus itself) becomes the tab stop.\n managed.current.add(target);\n activeRef.current = target;\n sync();\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const root = rootRef.current;\n if (!root || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const target = event.target as HTMLElement;\n const items = itemsOf(root, managed.current);\n const index = items.indexOf(target);\n if (index < 0) return;\n const rtl = getComputedStyle(root).direction === \"rtl\";\n const nextKey = orientation === \"vertical\" ? \"ArrowDown\" : rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const previousKey = orientation === \"vertical\" ? \"ArrowUp\" : rtl ? \"ArrowRight\" : \"ArrowLeft\";\n let next: number;\n if (event.key === nextKey) next = (index + 1) % items.length;\n else if (event.key === previousKey) next = (index - 1 + items.length) % items.length;\n else if (event.key === \"Home\") next = 0;\n else if (event.key === \"End\") next = items.length - 1;\n else return;\n if (keepsKey(target, event.key, event.key === nextKey || event.key === \"End\")) return;\n event.preventDefault();\n items[next]?.focus();\n }\n\n return (\n <div\n ref={setRef}\n role=\"toolbar\"\n aria-orientation={orientation}\n className={cx(\"ow-toolbar\", `ow-toolbar--${variant}`, `ow-toolbar--${size}`, orientation === \"vertical\" && \"ow-toolbar--vertical\", className)}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...props}\n >\n <ToolbarContext.Provider value={context}>{children}</ToolbarContext.Provider>\n </div>\n );\n});\n\n/** A line between groups of controls in a Toolbar, across the toolbar's direction. */\nexport function ToolbarSeparator({ className }: ToolbarSeparatorProps) {\n const toolbar = useContext(ToolbarContext);\n return (\n <div\n role=\"separator\"\n aria-orientation={toolbar?.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n className={cx(\"ow-toolbar__separator\", className)}\n />\n );\n}\n", "import { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\n\nexport interface TooltipProps {\n /** A few words. */\n label: ReactNode;\n /** The thing it explains: usually an icon-only Button with the same words as its aria-label. */\n children: ReactNode;\n /** Which side it prefers; it flips to the opposite side when there's no room. `right` suits icons in a folded sidebar.\n * @default \"top\" */\n placement?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** Milliseconds of hovering before it shows. Moving to a neighbour while one is showing skips the wait.\n * @default 400 */\n delay?: number;\n}\n\n/** When the last tooltip closed: another one opened soon after shows at once, as people scan a toolbar. */\nlet lastClosedAt = 0;\nconst warmWindow = 500;\n\n/**\n * A small dark label beside its child (above, unless `placement` says otherwise) on hover or keyboard focus. It's for sighted users only: the child\n * carries the same words for screen readers (an aria-label, or visually hidden text), so they aren't read twice.\n * It sits in the top layer, so scroll areas and dialogs can't clip it.\n */\nexport function Tooltip({ children, label, placement = \"top\", delay = 400 }: TooltipProps) {\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timer = useRef(0);\n const [open, setOpen] = useState(false);\n const { mounted, state } = usePresence(open, 100);\n const style = useFloating({ open: mounted, anchorRef, floatingRef: bubbleRef, placement, offset: 6 });\n\n const show = (immediately = false) => {\n window.clearTimeout(timer.current);\n if (immediately || Date.now() - lastClosedAt < warmWindow) setOpen(true);\n else timer.current = window.setTimeout(() => setOpen(true), delay);\n };\n const hide = () => {\n window.clearTimeout(timer.current);\n setOpen((current) => {\n if (current) lastClosedAt = Date.now();\n return false;\n });\n };\n\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n // Escape hides it without moving focus, as WCAG 1.4.13 asks.\n useEffect(() => {\n if (!open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") hide();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [open]);\n\n return (\n <span\n ref={anchorRef}\n className=\"ow-tooltip\"\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") show();\n }}\n onPointerLeave={hide}\n onPointerDown={hide}\n onFocus={(event) => {\n if (event.target.matches(\":focus-visible\")) show(true);\n }}\n onBlur={hide}\n >\n {children}\n {mounted ? (\n <span ref={bubbleRef} {...manualPopover} data-state={state} className=\"ow-tooltip__bubble ow-floating\" style={style} aria-hidden=\"true\">\n {label}\n </span>\n ) : null}\n </span>\n );\n}\n", "import { useCallback, useEffect, useLayoutEffect, useState, type CSSProperties, type RefObject } from \"react\";\n\nexport type Placement = \"bottom-start\" | \"bottom-end\" | \"bottom\" | \"top-start\" | \"top-end\" | \"top\" | \"left\" | \"right\";\n\ninterface Options {\n open: boolean;\n anchorRef: RefObject<HTMLElement | null>;\n floatingRef: RefObject<HTMLElement | null>;\n placement?: Placement;\n /** Distance from the anchor in pixels. */\n offset?: number;\n /** Make the floating element at least as wide as the anchor. */\n matchWidth?: boolean;\n /** The tallest it gets before scrolling. */\n maxHeight?: number;\n}\n\nconst margin = 8;\n\n/**\n * Positions a floating element (a popover, a listbox) against its anchor with fixed coordinates, flips it above\n * or below (or, for \"left\" and \"right\", to the other side) when there's no room, keeps it on screen, and follows the anchor when the page scrolls or resizes.\n * It also puts the element in the browser's top layer (popover=\"manual\"), so dialogs and overflow can't clip it.\n * Pass the element's `mounted` from usePresence as `open`, so it stays placed while it animates out.\n */\nexport function useFloating({\n open,\n anchorRef,\n floatingRef,\n placement = \"bottom-start\",\n offset = 4,\n matchWidth = false,\n maxHeight = 360,\n}: Options): CSSProperties {\n const [style, setStyle] = useState<CSSProperties>({\n position: \"fixed\",\n inset: \"auto\",\n left: 0,\n right: \"auto\",\n top: 0,\n bottom: \"auto\",\n visibility: \"hidden\",\n });\n\n const place = useCallback(() => {\n const anchor = anchorRef.current;\n const floating = floatingRef.current;\n if (!anchor || !floating) return;\n const rect = anchor.getBoundingClientRect();\n const width = Math.max(floating.offsetWidth, matchWidth ? rect.width : 0);\n const height = floating.scrollHeight;\n\n // Beside the anchor, centred on it: for a tooltip on a folded sidebar's icons.\n if (placement === \"left\" || placement === \"right\") {\n const roomLeft = rect.left - offset - margin;\n const roomRight = window.innerWidth - rect.right - offset - margin;\n const onLeft = placement === \"left\" ? width <= roomLeft || roomLeft > roomRight : width > roomRight && roomLeft > roomRight;\n const top = Math.min(Math.max(margin, rect.top + rect.height / 2 - height / 2), window.innerHeight - height - margin);\n floating.dataset.side = onLeft ? \"left\" : \"right\";\n setStyle({\n position: \"fixed\",\n inset: \"auto\",\n margin: 0,\n left: onLeft ? \"auto\" : rect.right + offset,\n right: onLeft ? window.innerWidth - rect.left + offset : \"auto\",\n top,\n bottom: \"auto\",\n maxHeight: Math.max(120, Math.min(maxHeight, window.innerHeight - 2 * margin)),\n [\"--ow-floating-origin\" as string]: `${onLeft ? \"right\" : \"left\"} center`,\n });\n return;\n }\n const below = window.innerHeight - rect.bottom - offset - margin;\n const above = rect.top - offset - margin;\n const wantsTop = placement.startsWith(\"top\");\n const fitsBelow = height <= below;\n const fitsAbove = height <= above;\n const top = wantsTop ? fitsAbove || above > below : !fitsBelow && above > below;\n\n const align = placement.endsWith(\"start\") ? \"start\" : placement.endsWith(\"end\") ? \"end\" : \"center\";\n let left = align === \"start\" ? rect.left : align === \"end\" ? rect.right - width : rect.left + rect.width / 2 - width / 2;\n left = Math.min(Math.max(margin, left), window.innerWidth - width - margin);\n\n // Which way it opened, for the enter and exit animations (base.css: .ow-floating).\n floating.dataset.side = top ? \"top\" : \"bottom\";\n // Every edge is set, every time: a value React clears falls back to the browser's\n // [popover] { inset: 0 }, which pins the layer to the top of the window.\n setStyle({\n position: \"fixed\",\n inset: \"auto\",\n margin: 0,\n left,\n right: \"auto\",\n top: top ? \"auto\" : rect.bottom + offset,\n bottom: top ? window.innerHeight - rect.top + offset : \"auto\",\n minWidth: matchWidth ? rect.width : undefined,\n maxHeight: Math.max(120, Math.min(maxHeight, top ? above : below)),\n [\"--ow-floating-origin\" as string]: `${top ? \"bottom\" : \"top\"} ${align === \"start\" ? \"left\" : align === \"end\" ? \"right\" : \"center\"}`,\n });\n }, [anchorRef, floatingRef, placement, offset, matchWidth, maxHeight]);\n\n // Top layer: above modal dialogs and outside any overflow: hidden.\n useLayoutEffect(() => {\n const floating = floatingRef.current;\n if (!open || !floating) return;\n try {\n if (!floating.matches(\":popover-open\")) floating.showPopover();\n } catch {\n // Without popover support it still shows as a fixed element.\n }\n place();\n return () => {\n try {\n if (floating.matches(\":popover-open\")) floating.hidePopover();\n } catch {\n // Already hidden.\n }\n };\n }, [open, floatingRef, place]);\n\n useEffect(() => {\n if (!open) return;\n const onScroll = (event: Event) => {\n if (floatingRef.current?.contains(event.target as Node)) return;\n place();\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(() => place());\n if (floatingRef.current) observer?.observe(floatingRef.current);\n window.addEventListener(\"scroll\", onScroll, true);\n window.addEventListener(\"resize\", place);\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"scroll\", onScroll, true);\n window.removeEventListener(\"resize\", place);\n };\n }, [open, place, floatingRef]);\n\n return style;\n}\n\n/** Calls `onDismiss` on a press outside every given element, or on Escape. */\nexport function useDismiss(open: boolean, refs: Array<RefObject<HTMLElement | null>>, onDismiss: (reason: \"outside\" | \"escape\") => void) {\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (refs.every((ref) => !ref.current?.contains(target))) onDismiss(\"outside\");\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n // Close this layer, not the dialog around it.\n event.preventDefault();\n event.stopPropagation();\n onDismiss(\"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 // eslint-disable-next-line react-hooks/exhaustive-deps -- refs are stable objects.\n }, [open, onDismiss]);\n}\n\n/** The attribute that makes an element a manual popover, typed loosely for React 18. */\nexport const manualPopover = { popover: \"manual\" } as Record<string, string>;\n", "import { useEffect, useState } from \"react\";\n\n/** How long a closing layer stays mounted for its exit animation (base.css: ow-floating-out). */\nexport const exitDuration = 140;\n\nexport interface Presence {\n /** Render the element while this is true: it stays true through the exit animation. */\n mounted: boolean;\n /** Put this on the element as data-state, so CSS can run the enter or the exit animation. */\n state: \"open\" | \"closed\";\n}\n\n/**\n * Keeps an element mounted for a moment after `open` turns false, so it can animate out instead of vanishing.\n * With reduced motion it unmounts at once.\n */\nexport function usePresence(open: boolean, exitMs = exitDuration): Presence {\n const [mounted, setMounted] = useState(open);\n if (open && !mounted) setMounted(true);\n\n useEffect(() => {\n if (open || !mounted) return undefined;\n const reduceMotion = typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n const timer = window.setTimeout(() => setMounted(false), reduceMotion ? 0 : exitMs);\n return () => window.clearTimeout(timer);\n }, [open, mounted, exitMs]);\n\n return { mounted: open || mounted, state: open ? \"open\" : \"closed\" };\n}\n", "import { cloneElement, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState, type ReactElement, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { FormContext, type FormFieldEntry, type ValidityMessages } from \"../Form/Form\";\n\nexport interface FieldProps {\n /** The label, set above the control. Leave it out for a control that has its own, like a Checkbox. */\n label?: ReactNode;\n /** One control: an Input, Textarea, Select, or any element that takes an id. */\n children: ReactElement;\n /** A muted line under the control. */\n hint?: ReactNode;\n /** An error under the control; it also marks the control invalid. Inside a Form, it takes the place of the Form's. */\n error?: ReactNode;\n /**\n * The field's name, for a control with no `name` of its own (Select, Combobox, Switch, DatePicker): Field submits\n * the control's `value` (or `checked`) under it in a hidden input, and inside a Form shows the Form's error for it.\n * The control must be controlled; a string, a number, true or an array of them is sent.\n */\n name?: string;\n /**\n * Inside a Form, what to say when one of the browser's checks fails, in place of its own message: one string for\n * any check, or one per check, like { valueMissing: \"Enter your work email.\", typeMismatch: \"\u2026\" }.\n */\n errorMessages?: ValidityMessages;\n className?: string;\n}\n\n/** Elements a <label for> can name. */\nconst isLabelable = (element: HTMLElement) =>\n element instanceof HTMLInputElement ||\n element instanceof HTMLSelectElement ||\n element instanceof HTMLTextAreaElement ||\n element instanceof HTMLButtonElement ||\n element instanceof HTMLMeterElement ||\n element instanceof HTMLOutputElement ||\n element instanceof HTMLProgressElement;\n\n/** A stable key for a control's value, to notice when it changes. */\nconst keyOf = (value: unknown) => JSON.stringify(value ?? null);\n\n/**\n * A label above a control, with an optional hint and error below. Field wires them together:\n * it gives the control an id (unless it has one), points aria-describedby at the hint and error,\n * and marks it invalid when there is an error. Inside a Form, it shows the Form's error for its control's name.\n */\nexport function Field({ label, children, hint, error, name: nameProp, errorMessages, className }: FieldProps) {\n const form = useContext(FormContext);\n const generatedId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const labelId = `${generatedId}-label`;\n const hintId = `${generatedId}-hint`;\n const errorId = `${generatedId}-error`;\n\n const child = isValidElement<Record<string, unknown>>(children) ? children : null;\n const controlId = (child?.props.id as string | undefined) ?? `${generatedId}-control`;\n const name = nameProp ?? (child?.props.name as string | undefined);\n const shownError = error || (form && name ? form.status.errors[name] : undefined);\n const describedBy =\n [child?.props[\"aria-describedby\"] as string | undefined, hint ? hintId : undefined, shownError ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n\n // Our own controls draw the invalid state from `isInvalid`; native elements get aria-invalid. It's only passed\n // when there's something to say, so a control without the prop (SegmentedControl) doesn't get it as an attribute.\n // Checkbox passes its props to its <input>, so it gets aria-invalid too.\n const invalid = (child?.props.isInvalid as boolean | undefined) ?? (shownError ? true : undefined);\n const invalidProp =\n child && typeof child.type !== \"string\" && child.type !== Checkbox\n ? invalid === undefined\n ? {}\n : { isInvalid: invalid }\n : { \"aria-invalid\": shownError ? true : undefined };\n\n // A control with no name of its own (Select, Switch) has no input to submit, so Field carries its value.\n const carries = Boolean(nameProp && child && typeof child.type !== \"string\" && child.props.name === undefined);\n const carried = carries && child ? (\"value\" in child.props ? child.props.value : child.props.checked) : undefined;\n // Strings and numbers are sent as they are, true as \"on\" (like a checkbox); anything else isn't sent.\n const carriedValues = (Array.isArray(carried) ? carried : [carried]).filter(\n (value): value is string | number | true => typeof value === \"string\" || typeof value === \"number\" || value === true,\n );\n const carriedKey = carries ? keyOf(carried) : undefined;\n\n // <label for> only names inputs, selects, textareas and buttons. When the control turns out to be something else\n // (a radiogroup like SegmentedControl, a ListBox, a DateField's group), it's named with aria-labelledby instead.\n const [labelsByFor, setLabelsByFor] = useState(true);\n useLayoutEffect(() => {\n if (!label) return;\n const control = rootRef.current?.ownerDocument.getElementById(controlId);\n setLabelsByFor(!control || isLabelable(control));\n });\n const labelledBy =\n label && !labelsByFor && child && child.props[\"aria-label\"] === undefined && child.props[\"aria-labelledby\"] === undefined\n ? { \"aria-labelledby\": labelId }\n : {};\n\n const entry = useRef<FormFieldEntry>({ name, root: rootRef, controlId, errorMessages });\n entry.current = { name, root: rootRef, controlId, errorMessages };\n const register = form?.register;\n useEffect(() => register?.(entry), [register]);\n\n // Such a control fires no input events either, so Field tells the Form when its value changes.\n const changed = form?.changed;\n const lastCarried = useRef(carriedKey);\n useEffect(() => {\n if (lastCarried.current === carriedKey) return;\n lastCarried.current = carriedKey;\n if (name) changed?.(name);\n }, [carriedKey, changed, name]);\n\n return (\n <div ref={rootRef} className={cx(\"ow-field\", className)}>\n {label ? (\n <label id={labelId} className=\"ow-field__label\" htmlFor={controlId}>\n {label}\n </label>\n ) : null}\n {child ? cloneElement(child, { id: controlId, \"aria-describedby\": describedBy, ...labelledBy, ...invalidProp }) : children}\n {carries && nameProp\n ? carriedValues.map((value, index) => <input key={index} type=\"hidden\" name={nameProp} value={value === true ? \"on\" : String(value)} />)\n : null}\n {hint ? (\n <p id={hintId} className=\"ow-field__hint\">\n {hint}\n </p>\n ) : null}\n {shownError ? (\n <p id={errorId} role=\"alert\" className=\"ow-field__error\">\n {shownError}\n </p>\n ) : null}\n </div>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useId,\n useRef,\n type ForwardedRef,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, MinusIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\ninterface CheckboxGroupContextValue {\n value: string[];\n toggle(value: string, checked: boolean): void;\n name: string;\n disabled: boolean;\n}\n\nconst CheckboxGroupContext = /* @__PURE__ */ createContext<CheckboxGroupContextValue | null>(null);\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n /** `sm` is 14px, for dense rows; `md` is 16px.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** `danger` for choices that make an action destructive, like also deleting files.\n * @default \"primary\" */\n tone?: \"primary\" | \"danger\";\n /** Shows a dash: some, not all, of what it controls is checked (a \"select all\" box).\n * @default false */\n indeterminate?: boolean;\n /** The label. With it, Checkbox renders its own <label>; without it, wrap it in yours. */\n children?: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A real checkbox input, restyled. It keeps native behaviour (Space to toggle, form submission, `disabled`).\n * Give it children for its label, or wrap the bare box in your own <label>. Inside a CheckboxGroup, give it a `value`.\n */\nexport const Checkbox = /* @__PURE__ */ forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n {\n className,\n size = \"md\",\n tone = \"primary\",\n indeterminate = false,\n children,\n description,\n value,\n checked,\n onChange,\n disabled,\n name,\n \"aria-describedby\": describedBy,\n ...inputProps\n },\n ref,\n) {\n const group = useContext(CheckboxGroupContext);\n const innerRef = useRef<HTMLInputElement | null>(null);\n const descriptionId = useId();\n const inGroup = group !== null && value !== undefined;\n\n useEffect(() => {\n if (innerRef.current) innerRef.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n const box = (\n <span\n className={cx(\n \"ow-checkbox\",\n `ow-checkbox--${size}`,\n tone === \"danger\" && \"ow-checkbox--danger\",\n children === undefined && className,\n )}\n >\n <input\n ref={(element) => {\n innerRef.current = element;\n assignRef(ref, element);\n }}\n type=\"checkbox\"\n className=\"ow-checkbox__input\"\n value={value}\n name={inGroup ? group.name : name}\n checked={inGroup ? group.value.includes(String(value)) : checked}\n disabled={disabled || (inGroup && group.disabled)}\n aria-describedby={[describedBy, description ? descriptionId : undefined].filter(Boolean).join(\" \") || undefined}\n onChange={(event) => {\n onChange?.(event);\n if (inGroup) group.toggle(String(value), event.target.checked);\n }}\n {...inputProps}\n />\n {indeterminate ? (\n <MinusIcon className=\"ow-checkbox__check ow-checkbox__check--dash\" size={size === \"sm\" ? 10 : 12} strokeWidth={3} />\n ) : (\n <CheckIcon className=\"ow-checkbox__check\" size={size === \"sm\" ? 10 : 12} strokeWidth={3} />\n )}\n </span>\n );\n\n if (children === undefined) return box;\n return (\n <label className={cx(\"ow-check-label\", (disabled || (inGroup && group.disabled)) && \"ow-check-label--disabled\", className)}>\n {box}\n <span className=\"ow-check-label__text\">\n <span>{children}</span>\n {description ? (\n <span id={descriptionId} className=\"ow-check-label__description\">\n {description}\n </span>\n ) : null}\n </span>\n </label>\n );\n});\n\nexport interface CheckboxGroupProps {\n /** The question, shown as the group's legend. */\n label: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n /** The checked values. */\n value?: string[];\n /** @default [] */\n defaultValue?: string[];\n onChange?(value: string[]): void;\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** An error under the options. */\n error?: ReactNode;\n disabled?: boolean;\n /** The form field name for every box. */\n name?: string;\n /** Checkboxes, each with a `value` and a label. */\n children: ReactNode;\n className?: string;\n}\n\n/** Several options where any number can be chosen, under one label. */\nexport function CheckboxGroup({\n label,\n description,\n value,\n defaultValue = [],\n onChange,\n orientation = \"vertical\",\n error,\n disabled = false,\n name,\n children,\n className,\n}: CheckboxGroupProps) {\n const [current, setCurrent] = useControllableState(value, defaultValue, onChange);\n const generatedName = useId();\n const errorId = useId();\n return (\n <CheckboxGroupContext.Provider\n value={{\n value: current,\n name: name ?? generatedName,\n disabled,\n toggle(item, checked) {\n setCurrent(checked ? [...current.filter((v) => v !== item), item] : current.filter((v) => v !== item));\n },\n }}\n >\n <Fieldset\n legend={label}\n description={description}\n error={error}\n errorId={errorId}\n className={cx(orientation === \"horizontal\" && \"ow-fieldset--horizontal\", className)}\n >\n {children}\n </Fieldset>\n </CheckboxGroupContext.Provider>\n );\n}\n\nexport interface FieldsetProps {\n /** The group's title. */\n legend: ReactNode;\n /** A muted line under the legend. */\n description?: ReactNode;\n /** An error under the content, announced when it appears. */\n error?: ReactNode;\n /** @internal */\n errorId?: string;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** Groups related controls under a legend: a set of checkboxes, an address, a pair of dates. */\nexport function Fieldset({ legend, description, error, errorId, disabled, children, className }: FieldsetProps) {\n const generatedId = useId();\n const descriptionId = `${generatedId}-description`;\n const resolvedErrorId = errorId ?? `${generatedId}-error`;\n return (\n <fieldset\n className={cx(\"ow-fieldset\", className)}\n disabled={disabled}\n aria-describedby={[description ? descriptionId : \"\", error ? resolvedErrorId : \"\"].filter(Boolean).join(\" \") || undefined}\n >\n <legend className=\"ow-fieldset__legend\">{legend}</legend>\n {description ? (\n <p id={descriptionId} className=\"ow-fieldset__description\">\n {description}\n </p>\n ) : null}\n <div className=\"ow-fieldset__content\">{children}</div>\n {error ? (\n <p id={resolvedErrorId} role=\"alert\" className=\"ow-field__error\">\n {error}\n </p>\n ) : null}\n </fieldset>\n );\n}\n", "import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type FormEvent,\n type FormHTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Alert } from \"../Alert/Alert\";\n\n/** What onSubmit and validate get: each name in the form with its value, or a string[] when the name appears more than once. */\nexport type FormValues = Record<string, string | string[]>;\n\n/** Messages by field name. */\nexport type FormErrors = Partial<Record<string, string>>;\n\n/** The browser's own checks, by their ValidityState names. */\nexport type ValidityCheck =\n | \"valueMissing\"\n | \"typeMismatch\"\n | \"patternMismatch\"\n | \"tooShort\"\n | \"tooLong\"\n | \"rangeUnderflow\"\n | \"rangeOverflow\"\n | \"stepMismatch\"\n | \"badInput\";\n\n/** What to say when a browser check fails: one message for any of them, or one per check. */\nexport type ValidityMessages = string | Partial<Record<ValidityCheck, string>>;\n\n/** What a Form tells the components inside it, through the render function or useFormStatus(). */\nexport interface FormStatus {\n /** True while the promise onSubmit returned is pending. */\n isSubmitting: boolean;\n /** The errors showing now, by field name. */\n errors: FormErrors;\n}\n\nexport interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, \"onSubmit\" | \"children\"> {\n /**\n * Called with the values once every check passes. Return a promise to keep the form busy until it settles; if it\n * rejects, the error's message shows in FormError (\"That didn't work. Try again.\" when it has none). Without\n * onSubmit, a valid form submits the usual way, to its `action`.\n */\n onSubmit?(values: FormValues, event: FormEvent<HTMLFormElement>): unknown;\n /** Checks the values after the browser's own checks, for rules it can't express: return { [name]: message } for what's wrong. */\n validate?(values: FormValues): FormErrors | void;\n /** Errors from the server, by field name. Each shows under its field until the person changes that field. */\n validationErrors?: FormErrors;\n /** The fields and buttons, or a function of the form's status: ({ isSubmitting, errors }) => \u2026 */\n children?: ReactNode | ((status: FormStatus) => ReactNode);\n}\n\n/** @internal What a Field tells its Form, so the Form can word its errors, focus it and tell which field lost focus. */\nexport interface FormFieldEntry {\n name: string | undefined;\n root: RefObject<HTMLElement>;\n controlId: string;\n errorMessages: ValidityMessages | undefined;\n}\n\ninterface FormContextValue {\n status: FormStatus;\n formError: string | undefined;\n register(entry: MutableRefObject<FormFieldEntry>): () => void;\n changed(name: string): void;\n addErrorSlot(): () => void;\n}\n\n/** @internal */\nexport const FormContext = /* @__PURE__ */ createContext<FormContextValue | null>(null);\n\ninterface Validatable extends HTMLElement {\n name: string;\n willValidate: boolean;\n validity: ValidityState;\n validationMessage: string;\n}\n\nconst checks: ValidityCheck[] = [\n \"valueMissing\",\n \"typeMismatch\",\n \"patternMismatch\",\n \"tooShort\",\n \"tooLong\",\n \"rangeUnderflow\",\n \"rangeOverflow\",\n \"stepMismatch\",\n \"badInput\",\n];\n\nconst failedMessage = \"That didn't work. Try again.\";\nconst focusable = ':is(input:not([type=\"hidden\"]), select, textarea, button, [tabindex]):not(:disabled):not([tabindex=\"-1\"])';\nconst idle: FormStatus = { isSubmitting: false, errors: {} };\n\nconst controlsOf = (form: HTMLFormElement) => Array.from(form.elements) as Validatable[];\n\nfunction canFocus(element: Element | null | undefined): element is HTMLElement {\n return element instanceof HTMLElement && element.matches(focusable) && element.getClientRects().length > 0;\n}\n\nfunction firstFocusable(root: Element | null | undefined) {\n return root ? Array.from(root.querySelectorAll(focusable)).find(canFocus) : undefined;\n}\n\nfunction valuesOf(form: HTMLFormElement, submitter?: HTMLElement | null): FormValues {\n const data = new FormData(form);\n // The button that submitted the form is part of what it sends, as in a plain form.\n if ((submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) && submitter.name) {\n data.append(submitter.name, submitter.value);\n }\n const values: FormValues = {};\n data.forEach((value, name) => {\n if (typeof value !== \"string\") return;\n const existing = values[name];\n values[name] = existing === undefined ? value : [...(Array.isArray(existing) ? existing : [existing]), value];\n });\n return values;\n}\n\nfunction messageOf(error: unknown) {\n if (typeof error === \"string\" && error) return error;\n if (error instanceof Error && error.message) return error.message;\n return failedMessage;\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n typeof value === \"object\" && value !== null && typeof (value as PromiseLike<unknown>).then === \"function\";\n\nfunction sameErrors(a: FormErrors, b: FormErrors) {\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);\n}\n\n/**\n * A form that checks its fields before it submits. On submit it runs the browser's checks (required, type, minLength,\n * pattern, min, max\u2026), then `validate`, then any `validationErrors`; each message shows under its Field and focus goes to\n * the first wrong field. Only when everything passes does it call onSubmit with the values.\n */\nexport const Form = /* @__PURE__ */ forwardRef<HTMLFormElement, FormProps>(function Form(\n { onSubmit, validate, validationErrors, children, className, onChange, onBlur, onReset, ...formProps },\n ref,\n) {\n const formRef = useRef<HTMLFormElement | null>(null);\n const fields = useRef(new Set<MutableRefObject<FormFieldEntry>>());\n const [local, setLocal] = useState<FormErrors>({});\n const [dismissed, setDismissed] = useState<ReadonlySet<string>>(() => new Set());\n const [isSubmitting, setSubmitting] = useState(false);\n const [formError, setFormError] = useState<string>();\n const [errorSlots, setErrorSlots] = useState(0);\n const [focusRequest, setFocusRequest] = useState(0);\n const [refreshRequest, setRefreshRequest] = useState(0);\n const queue = useRef({ changed: new Set<string>(), blurred: new Set<string>() });\n const submitted = useRef(false);\n const busy = useRef(false);\n const mounted = useRef(true);\n const attempts = useRef(0);\n const latest = useRef({ validate, validationErrors, local, dismissed });\n latest.current = { validate, validationErrors, local, dismissed };\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const setFormRef = useCallback(\n (element: HTMLFormElement | null) => {\n formRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n [ref],\n );\n\n const entryFor = (name: string) => [...fields.current].find((entry) => entry.current.name === name)?.current;\n\n /** The field a node belongs to: the Field around it, or its own name. */\n function nameAt(node: EventTarget | null) {\n if (!(node instanceof Element)) return undefined;\n for (const entry of fields.current) {\n const { name, root } = entry.current;\n if (name && root.current?.contains(node)) return name;\n }\n return (node as Validatable).name || undefined;\n }\n\n /** The browser's checks, then validate(): the first message for each name. */\n function collect(form: HTMLFormElement): FormErrors {\n const found: FormErrors = {};\n for (const element of controlsOf(form)) {\n const { name } = element;\n if (!name || found[name] || !element.willValidate || element.validity.valid) continue;\n const messages = entryFor(name)?.errorMessages;\n const failed = checks.find((check) => element.validity[check]);\n found[name] = typeof messages === \"string\" ? messages : (failed && messages?.[failed]) || element.validationMessage || \"Check this field.\";\n }\n const custom = latest.current.validate?.(valuesOf(form)) ?? {};\n for (const [name, message] of Object.entries(custom)) if (message && !found[name]) found[name] = message;\n return found;\n }\n\n const serverErrors = useMemo(() => {\n const active: FormErrors = {};\n for (const [name, message] of Object.entries(validationErrors ?? {})) if (message && !dismissed.has(name)) active[name] = message;\n return active;\n }, [validationErrors, dismissed]);\n\n // The browser's and validate()'s messages come before the server's.\n const errors = useMemo(() => ({ ...serverErrors, ...local }), [serverErrors, local]);\n const errorsRef = useRef(errors);\n errorsRef.current = errors;\n\n // Changes and blurs are handled after React renders them, so hidden inputs that carry a value have caught up.\n const request = useCallback((name: string, kind: \"changed\" | \"blurred\") => {\n // With no message showing, a change has nothing to clear: skip the render.\n if (kind === \"changed\" && !Object.keys(errorsRef.current).length) return;\n queue.current[kind].add(name);\n setRefreshRequest((count) => count + 1);\n }, []);\n\n // A hidden input that carries a control's value (a code, a date) changes without an input event, so watch it.\n useEffect(() => {\n const form = formRef.current;\n if (!form || typeof MutationObserver === \"undefined\") return;\n const observer = new MutationObserver((mutations) => {\n for (const { target } of mutations) {\n const name = target instanceof HTMLInputElement && target.type === \"hidden\" ? nameAt(target) : undefined;\n if (name) request(name, \"changed\");\n }\n });\n observer.observe(form, { subtree: true, attributes: true, attributeFilter: [\"value\"] });\n return () => observer.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- nameAt reads refs only.\n }, [request]);\n\n useEffect(() => {\n const form = formRef.current;\n const { changed, blurred } = queue.current;\n queue.current = { changed: new Set(), blurred: new Set() };\n if (!form || (!changed.size && !blurred.size)) return;\n\n // A server error is about the value it was sent, so it goes once that value changes.\n const server = latest.current.validationErrors ?? {};\n const edited = [...changed].filter((name) => server[name] && !latest.current.dismissed.has(name));\n if (edited.length) setDismissed((previous) => new Set([...previous, ...edited]));\n\n // Messages already showing are checked again (and go once fixed); a field that lost focus can get a new one.\n const current = latest.current.local;\n const names = new Set([...Object.keys(current), ...blurred]);\n if (!names.size) return;\n const fresh = collect(form);\n const next: FormErrors = {};\n for (const name of names) if (fresh[name]) next[name] = fresh[name];\n if (!sameErrors(next, current)) setLocal(next);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per request.\n }, [refreshRequest]);\n\n // New errors from the server show again, even where the person had edited, and take focus. Not on first render.\n const serverKey = JSON.stringify(validationErrors ?? {});\n const serverSeen = useRef<{ key: string; attempts: number } | null>(null);\n useEffect(() => {\n const previous = serverSeen.current;\n serverSeen.current = { key: serverKey, attempts: attempts.current };\n if (!previous || (previous.key === serverKey && previous.attempts === attempts.current)) return;\n setDismissed(new Set());\n if (Object.values(validationErrors ?? {}).some(Boolean)) setFocusRequest((count) => count + 1);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- serverKey stands for validationErrors.\n }, [validationErrors]);\n\n // Focus the first field with an error, in the order they appear.\n useEffect(() => {\n const form = formRef.current;\n if (!focusRequest || !form) return;\n const targets: HTMLElement[] = [];\n for (const name of Object.keys(errorsRef.current)) {\n const entry = entryFor(name);\n const named = controlsOf(form).filter((element) => element.name === name);\n const control = entry ? document.getElementById(entry.controlId) : null;\n const target =\n (canFocus(control) ? control : firstFocusable(entry?.root.current)) ??\n named.find(canFocus) ??\n // A hidden input that carries a value: focus what's beside it, such as a code's first box.\n firstFocusable(named[0]?.parentElement);\n if (target) targets.push(target);\n }\n targets.sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));\n targets[0]?.focus();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per request.\n }, [focusRequest]);\n\n function handleSubmit(event: FormEvent<HTMLFormElement>) {\n const form = event.currentTarget;\n const submitter = (event.nativeEvent as SubmitEvent).submitter;\n if (busy.current) {\n event.preventDefault();\n return;\n }\n attempts.current += 1;\n submitted.current = true;\n setFormError(undefined);\n\n // A button with formNoValidate, such as \"Save draft\", submits without the checks, as in a plain form.\n const skipChecks = (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) && submitter.formNoValidate;\n const found = skipChecks ? {} : collect(form);\n setLocal(found);\n if (!skipChecks && Object.keys({ ...serverErrors, ...found }).length) {\n event.preventDefault();\n setFocusRequest((count) => count + 1);\n return;\n }\n if (!onSubmit) return;\n\n event.preventDefault();\n let result: unknown;\n try {\n result = onSubmit(valuesOf(form, submitter), event);\n } catch (error) {\n setFormError(messageOf(error));\n return;\n }\n if (!isThenable(result)) return;\n busy.current = true;\n setSubmitting(true);\n result.then(\n () => {\n busy.current = false;\n if (mounted.current) setSubmitting(false);\n },\n (error: unknown) => {\n busy.current = false;\n if (!mounted.current) return;\n setSubmitting(false);\n setFormError(messageOf(error));\n },\n );\n }\n\n function handleChange(event: FormEvent<HTMLFormElement>) {\n onChange?.(event);\n const name = nameAt(event.target);\n if (name) request(name, \"changed\");\n }\n\n function handleBlur(event: FocusEvent<HTMLFormElement>) {\n onBlur?.(event);\n if (!submitted.current) return;\n const name = nameAt(event.target);\n // Moving between the boxes of one field, or the options of one radio group, isn't leaving it.\n if (name && nameAt(event.relatedTarget) !== name) request(name, \"blurred\");\n }\n\n function handleReset(event: FormEvent<HTMLFormElement>) {\n onReset?.(event);\n submitted.current = false;\n setLocal({});\n setFormError(undefined);\n setDismissed(new Set(Object.keys(validationErrors ?? {})));\n }\n\n const register = useCallback((entry: MutableRefObject<FormFieldEntry>) => {\n fields.current.add(entry);\n return () => {\n fields.current.delete(entry);\n };\n }, []);\n\n const changed = useCallback((name: string) => request(name, \"changed\"), [request]);\n\n const addErrorSlot = useCallback(() => {\n setErrorSlots((count) => count + 1);\n return () => setErrorSlots((count) => count - 1);\n }, []);\n\n const status = useMemo<FormStatus>(() => ({ isSubmitting, errors }), [isSubmitting, errors]);\n const context = useMemo<FormContextValue>(\n () => ({ status, formError, register, changed, addErrorSlot }),\n [status, formError, register, changed, addErrorSlot],\n );\n\n return (\n <FormContext.Provider value={context}>\n <form\n ref={setFormRef}\n {...formProps}\n noValidate\n aria-busy={isSubmitting || undefined}\n className={cx(\"ow-form\", className)}\n onSubmit={handleSubmit}\n onChange={handleChange}\n onBlur={handleBlur}\n onReset={handleReset}\n >\n {typeof children === \"function\" ? children(status) : children}\n {formError && errorSlots === 0 ? <FormErrorAlert message={formError} /> : null}\n </form>\n </FormContext.Provider>\n );\n});\n\nfunction FormErrorAlert({ message, className }: { message: string; className?: string }) {\n return (\n <Alert variant=\"danger\" className={cx(\"ow-form__error\", className)}>\n {message}\n </Alert>\n );\n}\n\nexport interface FormErrorProps {\n className?: string;\n}\n\n/**\n * Where a Form says why a submission failed: the message from a rejected onSubmit, in a danger Alert (role=\"alert\").\n * Put it just above the buttons. Without one, the Form shows the message at its end.\n */\nexport function FormError({ className }: FormErrorProps) {\n const form = useContext(FormContext);\n const addErrorSlot = form?.addErrorSlot;\n useEffect(() => addErrorSlot?.(), [addErrorSlot]);\n return form?.formError ? <FormErrorAlert message={form.formError} className={className} /> : null;\n}\n\n/** The status of the Form around a component, for a submit button that shows `loading` while it submits. */\nexport function useFormStatus(): FormStatus {\n return useContext(FormContext)?.status ?? idle;\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\";\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** info for news, success for something done, warning for something that needs the person, danger for something that failed.\n * @default \"info\" */\n variant?: AlertVariant;\n /** A short bold line. */\n title?: ReactNode;\n /** Replaces the variant's icon; false hides it. */\n icon?: ReactNode | false;\n /** Buttons under the text, usually small ones. */\n actions?: ReactNode;\n /** Shows a \u2715 that calls this. */\n onClose?(): void;\n children?: ReactNode;\n}\n\nconst icons: Record<AlertVariant, ReactNode> = {\n info: <InfoIcon size={16} />,\n success: <CircleCheckIcon size={16} />,\n warning: <TriangleAlertIcon size={16} />,\n danger: <CircleAlertIcon size={16} />,\n neutral: <InfoIcon size={16} />,\n};\n\n/** A message inside the page about the page: a notice, a warning before an action, an error that blocks the work. */\nexport function Alert({\n variant = \"info\",\n title,\n icon,\n actions,\n onClose,\n children,\n className,\n role,\n ...props\n}: AlertProps) {\n return (\n <div\n role={role ?? (variant === \"danger\" || variant === \"warning\" ? \"alert\" : \"status\")}\n className={cx(\"ow-alert\", `ow-alert--${variant}`, className)}\n {...props}\n >\n {icon === false ? null : <span className=\"ow-alert__icon\">{icon ?? icons[variant]}</span>}\n <div className=\"ow-alert__body\">\n {title ? <div className=\"ow-alert__title\">{title}</div> : null}\n {children ? <div className=\"ow-alert__description\">{children}</div> : null}\n {actions ? <div className=\"ow-alert__actions\">{actions}</div> : null}\n </div>\n {onClose ? <CloseButton size=\"sm\" label=\"Dismiss\" className=\"ow-alert__close\" onClick={onClose} /> : null}\n </div>\n );\n}\n", "import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid.\n * @default false */\n isInvalid?: boolean;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Inside the field, before the text: a 16px icon, a unit, a prefix like \"https://\". */\n startContent?: ReactNode;\n /** Inside the field, after the text: a unit, a small ghost Button, a Spinner. */\n endContent?: ReactNode;\n}\n\n/**\n * A single-line text field. With startContent or endContent, the field becomes a group and `className`\n * goes on the group, so width and margins apply to the whole field.\n */\nexport const Input = /* @__PURE__ */ forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, isInvalid = false, size = \"md\", startContent, endContent, ...inputProps },\n ref,\n) {\n const invalid = isInvalid || undefined;\n if (startContent === undefined && endContent === undefined) {\n return (\n <input\n ref={ref}\n className={cx(\"ow-input\", size === \"sm\" && \"ow-input--sm\", isInvalid && \"ow-input--invalid\", className)}\n aria-invalid={invalid}\n {...inputProps}\n />\n );\n }\n return (\n <div\n className={cx(\n \"ow-input-group\",\n size === \"sm\" && \"ow-input-group--sm\",\n isInvalid && \"ow-input-group--invalid\",\n inputProps.disabled && \"ow-input-group--disabled\",\n className,\n )}\n >\n {startContent !== undefined ? <span className=\"ow-input-group__addon\">{startContent}</span> : null}\n <input ref={ref} className=\"ow-input-group__input\" aria-invalid={invalid} {...inputProps} />\n {endContent !== undefined ? <span className=\"ow-input-group__addon\">{endContent}</span> : null}\n </div>\n );\n});\n", "import { forwardRef, useRef, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { SearchIcon } from \"../../icons\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\nimport { Input, type InputProps } from \"../Input/Input\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\nexport interface SearchFieldProps\n extends Omit<InputProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"startContent\" | \"endContent\" | \"onSubmit\"> {\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called with the text when the person presses Enter. */\n onSubmit?(value: string): void;\n /** Shows a spinner in place of the clear button while results load.\n * @default false */\n loading?: boolean;\n /** Names the field when there's no visible label.\n * @default \"Search\" */\n \"aria-label\"?: string;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A search box: a magnifier, the text, and a clear button once there's something to clear. Escape clears it. */\nexport const SearchField = /* @__PURE__ */ forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n value,\n defaultValue = \"\",\n onChange,\n onSubmit,\n loading = false,\n placeholder = \"Search\",\n \"aria-label\": ariaLabel = \"Search\",\n size = \"md\",\n onKeyDown,\n ...inputProps\n },\n ref,\n) {\n const [text, setText] = useControllableState(value, defaultValue, onChange);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && text) {\n event.preventDefault();\n event.stopPropagation();\n setText(\"\");\n } else if (event.key === \"Enter\") {\n onSubmit?.(text);\n }\n }\n\n return (\n <Input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n type=\"search\"\n size={size}\n placeholder={placeholder}\n aria-label={ariaLabel}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={handleKeyDown}\n startContent={<SearchIcon size={size === \"sm\" ? 14 : 16} />}\n endContent={\n loading ? (\n <Spinner size=\"sm\" label=\"Searching\" />\n ) : text ? (\n <CloseButton\n size=\"sm\"\n label=\"Clear search\"\n onClick={() => {\n setText(\"\");\n inputRef.current?.focus();\n }}\n />\n ) : null\n }\n {...inputProps}\n />\n );\n});\n", "import { forwardRef, useState, type InputHTMLAttributes, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { MinusIcon, PlusIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"value\" | \"defaultValue\" | \"onChange\" | \"size\" | \"type\" | \"min\" | \"max\" | \"step\"> {\n /** The number, or null when empty. */\n value?: number | null;\n /** @default null */\n defaultValue?: number | null;\n onChange?(value: number | null): void;\n min?: number;\n max?: number;\n /** How much the buttons and arrow keys change it. PageUp and PageDown move ten steps.\n * @default 1 */\n step?: number;\n /** How the number is shown while the field isn't being edited, e.g. { style: \"currency\", currency: \"EUR\" }. */\n formatOptions?: Intl.NumberFormatOptions;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default false */\n isInvalid?: boolean;\n /** Names the field when there's no visible label (Field gives it one). */\n \"aria-label\"?: string;\n}\n\nconst decimals = (step: number) => (String(step).split(\".\")[1] ?? \"\").length;\n\n/** A number with \u2212 and + buttons either side. Up and Down step it; the value is clamped to min and max. */\nexport const NumberField = /* @__PURE__ */ forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n step = 1,\n formatOptions,\n size = \"md\",\n isInvalid = false,\n disabled,\n className,\n onBlur,\n onFocus,\n onKeyDown,\n name,\n form,\n ...inputProps\n },\n ref,\n) {\n const [number, setNumber] = useControllableState(value, defaultValue, onChange);\n const [draft, setDraft] = useState<string | null>(null);\n const format = (n: number | null) =>\n n === null ? \"\" : formatOptions ? new Intl.NumberFormat(undefined, formatOptions).format(n) : String(n);\n\n const clamp = (n: number) => {\n const rounded = Number(n.toFixed(decimals(step)));\n return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, rounded));\n };\n\n // While the field has focus, `draft` holds the raw text; otherwise the number is shown formatted.\n function commit(text: string, keepEditing = false) {\n setDraft(keepEditing ? text : null);\n const cleaned = text.replace(/[^\\d.,-]/g, \"\").replace(\",\", \".\");\n if (cleaned === \"\" || cleaned === \"-\") {\n setNumber(null);\n return;\n }\n const parsed = Number(cleaned);\n if (Number.isNaN(parsed)) return;\n const next = clamp(parsed);\n setNumber(next);\n if (keepEditing) setDraft(String(next));\n }\n\n function stepBy(multiple: number) {\n const base = draft !== null && draft !== \"\" && !Number.isNaN(Number(draft)) ? Number(draft) : (number ?? min ?? 0);\n const next = clamp(base + step * multiple);\n setNumber(next);\n if (draft !== null) setDraft(String(next));\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const moves: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => min !== undefined && commit(String(min), draft !== null),\n End: () => max !== undefined && commit(String(max), draft !== null),\n Enter: () => draft !== null && commit(draft, true),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n }\n\n const atMin = min !== undefined && number !== null && number <= min;\n const atMax = max !== undefined && number !== null && number >= max;\n\n return (\n <div\n className={cx(\n \"ow-number-field\",\n size === \"sm\" && \"ow-number-field--sm\",\n isInvalid && \"ow-number-field--invalid\",\n disabled && \"ow-number-field--disabled\",\n className,\n )}\n >\n <button\n type=\"button\"\n className=\"ow-number-field__step\"\n aria-label=\"Decrease\"\n tabIndex={-1}\n disabled={disabled || atMin}\n onClick={() => stepBy(-1)}\n >\n <MinusIcon size={14} />\n </button>\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals(step) > 0 || (min ?? 0) < 0 ? \"decimal\" : \"numeric\"}\n role=\"spinbutton\"\n autoComplete=\"off\"\n className=\"ow-number-field__input\"\n aria-valuenow={number ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={number === null ? undefined : format(number)}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n value={draft ?? format(number)}\n onFocus={(event) => {\n onFocus?.(event);\n setDraft(number === null ? \"\" : String(number));\n }}\n onChange={(event) => setDraft(event.target.value)}\n onBlur={(event) => {\n onBlur?.(event);\n commit(event.target.value);\n }}\n onKeyDown={handleKeyDown}\n {...inputProps}\n />\n {/* The field shows the number formatted (\"\u20AC1,200.00\"), so a form gets the plain number from here instead. */}\n {name ? <input type=\"hidden\" name={name} form={form} value={number ?? \"\"} disabled={disabled} /> : null}\n <button\n type=\"button\"\n className=\"ow-number-field__step\"\n aria-label=\"Increase\"\n tabIndex={-1}\n disabled={disabled || atMax}\n onClick={() => stepBy(1)}\n >\n <PlusIcon size={14} />\n </button>\n </div>\n );\n});\n", "import { useRef, type ClipboardEvent, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface InputOTPProps {\n /** How many characters the code has.\n * @default 6 */\n length?: number;\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called once every box is filled. */\n onComplete?(value: string): void;\n /** `numeric` accepts digits only; `alphanumeric` letters and digits (shown upper case).\n * @default \"numeric\" */\n type?: \"numeric\" | \"alphanumeric\";\n /** Splits the boxes into groups with a dash between, e.g. 3 for \"123\u2013456\". */\n groupSize?: number;\n /** @default false */\n isInvalid?: boolean;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Names the code for screen readers.\n * @default \"Verification code\" */\n \"aria-label\"?: string;\n /** The form field name; a hidden input carries the whole code. */\n name?: string;\n /** Names the code by another element's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of the hint or error that describe it, read from every box; Field sets this. */\n \"aria-describedby\"?: string;\n /** The id of the first box, so a Field's label points at it and clicking the label starts there; Field sets this. */\n id?: string;\n className?: string;\n}\n\n/**\n * A one-time code in separate boxes. Typing moves forward, Backspace moves back,\n * and pasting a code fills every box. The browser can fill it from a text message.\n */\nexport function InputOTP({\n length = 6,\n value,\n defaultValue = \"\",\n onChange,\n onComplete,\n type = \"numeric\",\n groupSize,\n isInvalid = false,\n disabled,\n autoFocus,\n \"aria-label\": ariaLabel = \"Verification code\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n name,\n className,\n}: InputOTPProps) {\n const [code, setCode] = useControllableState(value, defaultValue, onChange);\n const refs = useRef<Array<HTMLInputElement | null>>([]);\n // The code as of the last change, read by handlers that run before React renders it,\n // such as the next box's onFocus when typing moves focus forward.\n const latest = useRef(code);\n latest.current = code;\n const allowed = type === \"numeric\" ? /\\d/ : /[a-z0-9]/i;\n const clean = (text: string) => [...text].filter((char) => allowed.test(char)).join(\"\").toUpperCase();\n const chars = Array.from({ length }, (_, index) => code[index] ?? \"\");\n\n function update(next: string, focusIndex: number) {\n const trimmed = next.slice(0, length);\n latest.current = trimmed;\n setCode(trimmed);\n refs.current[Math.min(focusIndex, length - 1)]?.focus();\n if (trimmed.length === length && !trimmed.includes(\" \")) onComplete?.(trimmed);\n }\n\n function setAt(index: number, char: string) {\n const next = chars.map((existing, i) => (i === index ? char : existing));\n // Keep the code contiguous: an empty box ends it.\n const firstGap = next.indexOf(\"\");\n return (firstGap === -1 ? next : next.slice(0, firstGap)).join(\"\");\n }\n\n function onInput(index: number, text: string) {\n const typed = clean(text);\n if (!typed) return;\n if (typed.length > 1) {\n // Autofill or a paste into one box.\n update(chars.slice(0, index).join(\"\") + typed, index + typed.length);\n return;\n }\n update(setAt(index, typed), index + 1);\n }\n\n function onKeyDown(index: number, event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === \"Backspace\") {\n event.preventDefault();\n // Removes one character; the ones after it move back a box.\n if (chars[index]) update(code.slice(0, index) + code.slice(index + 1), index);\n else if (index > 0) update(code.slice(0, index - 1) + code.slice(index), index - 1);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n refs.current[Math.max(0, index - 1)]?.focus();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n refs.current[Math.min(length - 1, index + 1, code.length)]?.focus();\n }\n }\n\n function onPaste(index: number, event: ClipboardEvent<HTMLInputElement>) {\n event.preventDefault();\n const pasted = clean(event.clipboardData.getData(\"text\"));\n if (pasted) update(chars.slice(0, index).join(\"\") + pasted, index + pasted.length);\n }\n\n return (\n <div\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={cx(\"ow-otp\", isInvalid && \"ow-otp--invalid\", className)}\n >\n {chars.map((char, index) => (\n <span key={index} className=\"ow-otp__slot\">\n {groupSize && index > 0 && index % groupSize === 0 ? (\n <span className=\"ow-otp__separator\" aria-hidden=\"true\" />\n ) : null}\n <input\n ref={(element) => {\n refs.current[index] = element;\n }}\n className=\"ow-otp__input\"\n type=\"text\"\n inputMode={type === \"numeric\" ? \"numeric\" : \"text\"}\n autoComplete={index === 0 ? \"one-time-code\" : \"off\"}\n autoCapitalize=\"characters\"\n maxLength={length}\n id={index === 0 ? id : undefined}\n aria-label={`Character ${index + 1} of ${length}`}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n autoFocus={autoFocus && index === 0}\n value={char}\n // Clicking an empty box past the end goes to the next one to fill.\n onFocus={(event) => {\n const filled = latest.current.length;\n if (index > filled) refs.current[filled]?.focus();\n else event.target.select();\n }}\n onChange={(event) => onInput(index, event.target.value.replace(char, \"\") || event.target.value)}\n onKeyDown={(event) => onKeyDown(index, event)}\n onPaste={(event) => onPaste(index, event)}\n />\n </span>\n ))}\n {name ? <input type=\"hidden\" name={name} value={code} /> : null}\n </div>\n );\n}\n", "import { forwardRef, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { todayISO, type ISODate } from \"../Calendar/dates\";\nimport { localeDigits, SegmentedField, type Part, type Segment, type SegmentValues } from \"./SegmentedField\";\n\nexport interface DateFieldProps {\n /** The date as \"YYYY-MM-DD\", or \"\" while any part is empty. */\n value?: ISODate;\n /** @default \"\" */\n defaultValue?: ISODate;\n /** Called with \"YYYY-MM-DD\" when the date is complete and whenever it changes after that, and with \"\" when a part is cleared. */\n onChange?(value: ISODate): void;\n /** The earliest valid date, \"YYYY-MM-DD\". An earlier one shows the field as invalid. */\n min?: ISODate;\n /** The latest valid date, \"YYYY-MM-DD\". A later one shows the field as invalid. */\n max?: ISODate;\n /** The order of day, month and year and the separators between them follow this locale: dd/mm/yyyy in \"en-IE\",\n * mm/dd/yyyy in \"en-US\", dd.mm.yyyy in \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid. A date outside\n * min and max does this by itself.\n * @default false */\n isInvalid?: boolean;\n /** @default false */\n disabled?: boolean;\n /** The date can be focused and read but not changed.\n * @default false */\n readOnly?: boolean;\n /** The form field name: a hidden input carries the \"YYYY-MM-DD\" value. */\n name?: string;\n /** Inside the field, before the date: a 16px calendar icon. */\n startContent?: ReactNode;\n /** Goes on the group. Field sets it, and its label then names the group and focuses the first segment when clicked. */\n id?: string;\n /** Names the date for screen readers when there's no visible label. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** Field points it at its hint and error; each segment is described by them. */\n \"aria-describedby\"?: string;\n className?: string;\n}\n\ntype DateParts = { day?: number | undefined; month?: number | undefined; year?: number | undefined };\n\nconst pad = (n: number, length = 2) => String(n).padStart(length, \"0\");\nconst isLeapYear = (year: number) => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\n/** Days in a month (1\u201312); with no month, 31, and with no year, February has 29. */\nfunction daysIn(year: number | undefined, month: number | undefined): number {\n if (month === undefined) return 31;\n if (month === 2) return year === undefined || isLeapYear(year) ? 29 : 28;\n return [4, 6, 9, 11].includes(month) ? 30 : 31;\n}\n\nfunction fromISO(iso: string): DateParts {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return {};\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > daysIn(year, month)) return {};\n return { year, month, day };\n}\n\nfunction toISOValue({ day, month, year }: DateParts): ISODate {\n return day === undefined || month === undefined || year === undefined ? \"\" : `${pad(year, 4)}-${pad(month)}-${pad(day)}`;\n}\n\n/** A day past the end of the month (31 when February is chosen) becomes its last day. */\nfunction constrain(parts: DateParts): DateParts {\n const last = daysIn(parts.year, parts.month);\n return parts.day !== undefined && parts.day > last ? { ...parts, day: last } : parts;\n}\n\ntype DateLayout = Array<{ type: \"day\" | \"month\" | \"year\" } | { type: \"literal\"; text: string }>;\n\n/** The order of day, month and year and the separators between them, from the locale's short numeric date. */\nfunction dateLayout(locale: string | undefined): DateLayout {\n const format = new Intl.DateTimeFormat(locale, { year: \"numeric\", month: \"2-digit\", day: \"2-digit\", timeZone: \"UTC\" });\n const layout: DateLayout = [];\n for (const part of format.formatToParts(new Date(Date.UTC(2026, 10, 23)))) {\n if (part.type === \"day\" || part.type === \"month\" || part.type === \"year\") layout.push({ type: part.type });\n else if (part.type === \"literal\") layout.push({ type: \"literal\", text: part.value });\n }\n return layout;\n}\n\n/**\n * A date typed into day, month and year segments in the locale's order, like macOS's date fields. Each segment\n * takes digits and moves on when it's full; the arrow keys step it. Pair it with a Calendar in a Popover, or use\n * DatePicker, when people would rather pick from a month.\n */\nexport const DateField = /* @__PURE__ */ forwardRef<HTMLDivElement, DateFieldProps>(function DateField(\n {\n value,\n defaultValue = \"\",\n onChange,\n min,\n max,\n locale,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n readOnly = false,\n name,\n startContent,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n },\n ref,\n) {\n const [current, setCurrent] = useControllableState<ISODate>(value, defaultValue, onChange);\n // The segments can hold a date that isn't complete yet; the value is \"\" until it is.\n const [parts, setParts] = useState<DateParts>(() => fromISO(current));\n const partsRef = useRef(parts);\n partsRef.current = parts;\n const [synced, setSynced] = useState(current);\n if (current !== synced) {\n setSynced(current);\n if (current !== toISOValue(parts)) setParts(fromISO(current));\n }\n\n function update(changes: SegmentValues) {\n const next = constrain({ ...partsRef.current, ...changes });\n partsRef.current = next;\n setParts(next);\n setCurrent(toISOValue(next));\n }\n\n const formats = useMemo(() => {\n const two = new Intl.NumberFormat(locale, { minimumIntegerDigits: 2, useGrouping: false });\n const four = new Intl.NumberFormat(locale, { minimumIntegerDigits: 4, useGrouping: false });\n const month = new Intl.DateTimeFormat(locale, { month: \"long\", timeZone: \"UTC\" });\n const months = Array.from({ length: 12 }, (_, index) => month.format(new Date(Date.UTC(2026, index, 1))));\n return { two, four, months, digits: localeDigits(locale), layout: dateLayout(locale) };\n }, [locale]);\n\n // Up or Down on an empty segment starts from today, or the nearest date min and max allow.\n let reference = todayISO();\n if (min && reference < min) reference = min;\n if (max && reference > max) reference = max;\n const start = fromISO(reference);\n const lastDay = daysIn(parts.year, parts.month);\n\n const segments: Record<\"day\" | \"month\" | \"year\", Segment> = {\n day: {\n type: \"day\",\n label: \"Day\",\n value: parts.day,\n min: 1,\n max: lastDay,\n placeholder: \"dd\",\n format: (n) => formats.two.format(n),\n describe: String,\n start: Math.min(start.day ?? 1, lastDay),\n page: 7,\n wrap: true,\n width: 2,\n },\n month: {\n type: \"month\",\n label: \"Month\",\n value: parts.month,\n min: 1,\n max: 12,\n placeholder: \"mm\",\n format: (n) => formats.two.format(n),\n describe: (n) => `${n} \u2013 ${formats.months[n - 1]}`,\n start: start.month ?? 1,\n page: 2,\n wrap: true,\n width: 2,\n },\n year: {\n type: \"year\",\n label: \"Year\",\n value: parts.year,\n min: 1,\n max: 9999,\n placeholder: \"yyyy\",\n format: (n) => formats.four.format(n),\n describe: String,\n start: start.year ?? 2026,\n page: 5,\n wrap: false,\n deferTyping: true,\n width: 4,\n },\n };\n const layout: Part[] = formats.layout.map((part) => (part.type === \"literal\" ? part : segments[part.type]));\n\n const outOfRange = current !== \"\" && ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <SegmentedField\n parts={layout}\n value={current}\n onSegmentsChange={update}\n parsePaste={(text) => (/^\\d{4}-\\d{2}-\\d{2}$/.test(text) && toISOValue(fromISO(text)) ? fromISO(text) : null)}\n digits={formats.digits}\n forwardedRef={ref}\n id={id}\n name={name}\n size={size}\n isInvalid={isInvalid || outOfRange}\n disabled={disabled}\n readOnly={readOnly}\n startContent={startContent}\n className={className}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n />\n );\n});\n", "/** Dates as \"YYYY-MM-DD\" strings: no time, no time zone, so a date never shifts by a day. */\nexport type ISODate = string;\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\nexport function toISO(year: number, month: number, day: number): ISODate {\n // setUTCFullYear, not Date.UTC, which reads years 0\u201399 as 1900\u20131999. Months and days past the end roll over.\n const date = new Date(0);\n date.setUTCFullYear(year, month, day);\n return `${String(date.getUTCFullYear()).padStart(4, \"0\")}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())}`;\n}\n\nexport function parseISO(iso: ISODate): { year: number; month: number; day: number } {\n const [year, month, day] = iso.split(\"-\").map(Number);\n return { year: year!, month: month! - 1, day: day! };\n}\n\nexport function todayISO(): ISODate {\n const now = new Date();\n return toISO(now.getFullYear(), now.getMonth(), now.getDate());\n}\n\nexport function addDays(iso: ISODate, days: number): ISODate {\n const { year, month, day } = parseISO(iso);\n return toISO(year, month, day + days);\n}\n\nexport function addMonths(iso: ISODate, months: number): ISODate {\n const { year, month, day } = parseISO(iso);\n const lastDay = new Date(Date.UTC(year, month + months + 1, 0)).getUTCDate();\n return toISO(year, month + months, Math.min(day, lastDay));\n}\n\n/** 0 = Sunday \u2026 6 = Saturday. */\nexport function weekday(iso: ISODate): number {\n const { year, month, day } = parseISO(iso);\n return new Date(Date.UTC(year, month, day)).getUTCDay();\n}\n\nexport function toDate(iso: ISODate): Date {\n const { year, month, day } = parseISO(iso);\n return new Date(Date.UTC(year, month, day));\n}\n\nexport function formatDate(iso: ISODate, locale: string | undefined, options: Intl.DateTimeFormatOptions): string {\n return new Intl.DateTimeFormat(locale, { ...options, timeZone: \"UTC\" }).format(toDate(iso));\n}\n\n/**\n * Two dates as one range in the locale, sharing what they have in common: \"3 \u2013 9 Oct 2026\", \"28 Sept \u2013 4 Oct 2026\".\n * The same day twice is written once.\n */\nexport function formatDateRange(start: ISODate, end: ISODate, locale: string | undefined, options: Intl.DateTimeFormatOptions): string {\n const format = new Intl.DateTimeFormat(locale, { ...options, timeZone: \"UTC\" });\n if (typeof format.formatRangeToParts !== \"function\") {\n return start === end ? format.format(toDate(start)) : `${format.format(toDate(start))} \u2013 ${format.format(toDate(end))}`;\n }\n const parts = format.formatRangeToParts(toDate(start), toDate(end));\n // A bare en dash (\"3\u20139 Oct\") gets spaces, so a range reads as two dates; other locales' separators stay.\n return parts\n .map((part, index) => {\n const between = part.source === \"shared\" && parts[index - 1]?.source === \"startRange\" && parts[index + 1]?.source === \"endRange\";\n return between && part.value === \"\u2013\" ? \" \u2013 \" : part.value;\n })\n .join(\"\");\n}\n\n/** Keeps a date between min and max, when they're given. */\nexport function clampDate(date: ISODate, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n if (min && date < min) return min;\n if (max && date > max) return max;\n return date;\n}\n\n/** The first day of the month a date falls in. */\nexport function startOfMonth(iso: ISODate): ISODate {\n const { year, month } = parseISO(iso);\n return toISO(year, month, 1);\n}\n\n/** Months counted from year 0, so two months can be compared and subtracted. */\nexport function monthIndex(iso: ISODate): number {\n const { year, month } = parseISO(iso);\n return year * 12 + month;\n}\n\n/** The six weeks a month grid shows for the month starting on `first`, each starting on `weekStartsOn`. */\nexport function monthWeeks(first: ISODate, weekStartsOn: 0 | 1): ISODate[][] {\n const offset = (weekday(first) - weekStartsOn + 7) % 7;\n const gridStart = addDays(first, -offset);\n return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => addDays(gridStart, w * 7 + d)));\n}\n", "import { useEffect, useRef, useState, type ClipboardEvent, type ForwardedRef, type KeyboardEvent, type MouseEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/*\n * The engine DateField and TimeField share: a group of spinbutton segments that take typed digits, step with the\n * arrow keys and move between each other, with the separators between them. Each field works out its segments\n * (order, range, how a value is shown) and keeps the values; this draws them and turns keys into changes.\n */\n\nexport type SegmentType = \"day\" | \"month\" | \"year\" | \"hour\" | \"minute\" | \"second\" | \"dayPeriod\";\n\n/** Values by segment; a key set to undefined clears that segment. */\nexport type SegmentValues = { [Type in SegmentType]?: number | undefined };\n\nexport interface Segment {\n type: SegmentType;\n /** Read out as the segment's name: \"Day\", \"Hour\". */\n label: string;\n value: number | undefined;\n min: number;\n max: number;\n /** Shown while it's empty: \"dd\", \"\u2013\u2013\". */\n placeholder: string;\n /** The value as shown: \"07\", \"PM\". */\n format(value: number): string;\n /** The value as read out (aria-valuetext): \"10 \u2013 October\". */\n describe(value: number): string;\n /** Up or Down on an empty segment starts here, without stepping. */\n start: number;\n /** Up and Down move by this, landing on its multiples. */\n step?: number;\n /** PageUp and PageDown move by this. */\n page: number;\n /** Past the max goes round to the min. The year stops instead. */\n wrap: boolean;\n /** Typing only sets the value once it's whole or the segment loses focus, so a year of 2026 doesn't pass through 0002. */\n deferTyping?: boolean;\n /** Letters that set a value: a and p for AM and PM. */\n letters?: Record<string, number>;\n /** Kept this many digits wide, so the field doesn't change width as it fills. */\n width?: 2 | 4;\n}\n\nexport type Part = Segment | { type: \"literal\"; text: string };\n\nexport interface SegmentedFieldProps {\n parts: Part[];\n /** The field's whole value, for the hidden input. */\n value: string;\n onSegmentsChange(changes: SegmentValues): void;\n /** Reads pasted text in the field's own format, such as \"2026-10-13\"; null when it can't. */\n parsePaste?(text: string): SegmentValues | null;\n /** The locale's digits, 0 to 9. */\n digits: string[];\n forwardedRef: ForwardedRef<HTMLDivElement>;\n id?: string;\n name?: string;\n size: \"sm\" | \"md\";\n isInvalid: boolean;\n disabled: boolean;\n readOnly: boolean;\n startContent?: ReactNode;\n className?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n}\n\ninterface Typing {\n type: SegmentType;\n text: string;\n}\n\nconst escapeHTML = (text: string) => text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n\nexport function SegmentedField({\n parts,\n value,\n onSegmentsChange,\n parsePaste,\n digits,\n forwardedRef,\n id,\n name,\n size,\n isInvalid,\n disabled,\n readOnly,\n startContent,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n}: SegmentedFieldProps) {\n const segments = parts.filter((part): part is Segment => part.type !== \"literal\");\n const editable = !disabled && !readOnly;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const segmentRefs = useRef<Array<HTMLSpanElement | null>>([]);\n // What each segment should show, to put back if the browser edits it anyway (an IME composition can't be cancelled).\n const texts = useRef<string[]>([]);\n // Digits typed into the focused segment that may still grow (\"1\" in a month waits for a second digit). Kept in a\n // ref as well, because typing moves focus and the blur that follows runs before React renders.\n const [typing, setTypingState] = useState<Typing | null>(null);\n const typingRef = useRef<Typing | null>(null);\n const [labelId, setLabelId] = useState<string>();\n\n function setTyping(next: Typing | null) {\n typingRef.current = next;\n setTypingState(next);\n }\n\n function focusSegment(index: number) {\n segmentRefs.current[Math.max(0, Math.min(segments.length - 1, index))]?.focus();\n }\n\n function parseDigit(char: string): number | undefined {\n if (char >= \"0\" && char <= \"9\") return Number(char);\n const index = digits.indexOf(char);\n return index >= 0 ? index : undefined;\n }\n\n const fits = (segment: Segment, n: number) => n >= segment.min && n <= segment.max;\n\n /** Ends typing in the segment; a year typed so far is set now. Returns the segment's value after that. */\n function flush(segment?: Segment): number | undefined {\n const typed = typingRef.current;\n if (!typed || (segment && typed.type !== segment.type)) return segment?.value;\n setTyping(null);\n const owner = segments.find((candidate) => candidate.type === typed.type);\n if (!owner?.deferTyping) return owner?.value;\n const n = Number(typed.text);\n if (!fits(owner, n)) return owner.value;\n onSegmentsChange({ [owner.type]: n });\n return n;\n }\n\n /** Typing a digit: fills the segment and moves on once no further digit could fit. Returns the focused index. */\n function typeDigit(index: number, digit: number): number {\n const segment = segments[index]!;\n const typed = typingRef.current;\n let text = (typed?.type === segment.type ? typed.text : \"\") + digit;\n let n = Number(text);\n if (n > segment.max) {\n text = String(digit);\n n = digit;\n }\n const complete = n * 10 > segment.max || text.length >= String(segment.max).length;\n if (fits(segment, n) && (complete || !segment.deferTyping)) onSegmentsChange({ [segment.type]: n });\n if (!complete) {\n setTyping({ type: segment.type, text });\n return index;\n }\n setTyping(null);\n if (!fits(segment, n) || index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n /** A letter sets AM or PM, from any segment; from the AM/PM segment itself it then moves on. */\n function typeLetter(index: number, char: string): number {\n const letter = char.toLowerCase();\n const target = segments.findIndex((segment) => segment.letters?.[letter] !== undefined);\n if (target < 0) return index;\n flush();\n onSegmentsChange({ [segments[target]!.type]: segments[target]!.letters![letter] });\n if (target !== index || index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n /** A separator (/ . : or a space) ends a half-typed segment and moves on, so \"1/5/2026\" is the 1st of May, not the 15th. */\n function typeSeparator(index: number): number {\n if (typingRef.current?.type !== segments[index]!.type) return index;\n flush();\n if (index >= segments.length - 1) return index;\n focusSegment(index + 1);\n return index + 1;\n }\n\n function insertText(index: number, text: string) {\n let current = index;\n for (const char of text) {\n const digit = parseDigit(char);\n if (digit !== undefined && !segments[current]!.letters) current = typeDigit(current, digit);\n else if (/[\\p{P}\\p{S}\\s]/u.test(char)) current = typeSeparator(current);\n else current = typeLetter(current, char);\n }\n }\n\n function step(index: number, key: string) {\n const segment = segments[index]!;\n const current = flush(segment);\n const unit = segment.step ?? 1;\n const top = segment.min + Math.floor((segment.max - segment.min) / unit) * unit;\n let next: number;\n if (key === \"Home\") next = segment.min;\n else if (key === \"End\") next = top;\n else if (current === undefined) next = segment.start;\n else if (key === \"PageUp\" || key === \"PageDown\") {\n const moved = current + (key === \"PageUp\" ? segment.page : -segment.page);\n const range = segment.max - segment.min + 1;\n next = segment.wrap ? segment.min + ((((moved - segment.min) % range) + range) % range) : Math.min(segment.max, Math.max(segment.min, moved));\n } else {\n // Snap to the step: with 15-minute steps, Up from 07 goes to 15 and Down to 00.\n const offset = current - segment.min;\n const moved = segment.min + (key === \"ArrowUp\" ? Math.floor(offset / unit) + 1 : Math.ceil(offset / unit) - 1) * unit;\n if (moved > segment.max) next = segment.wrap ? segment.min : segment.max;\n else if (moved < segment.min) next = segment.wrap ? top : segment.min;\n else next = moved;\n }\n onSegmentsChange({ [segment.type]: next });\n }\n\n /** Backspace or Delete empties the segment; Backspace on an empty one goes back to the one before. */\n function clear(index: number, moveBack: boolean) {\n const segment = segments[index]!;\n const wasTyping = typingRef.current?.type === segment.type;\n if (wasTyping) setTyping(null);\n if (segment.value !== undefined) onSegmentsChange({ [segment.type]: undefined });\n else if (!wasTyping && moveBack) focusSegment(index - 1);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLSpanElement>, index: number) {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n switch (event.key) {\n case \"ArrowLeft\":\n case \"ArrowRight\":\n event.preventDefault();\n flush();\n focusSegment(index + (event.key === \"ArrowRight\" ? 1 : -1));\n return;\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n event.preventDefault();\n if (editable) step(index, event.key);\n return;\n case \"Backspace\":\n case \"Delete\":\n event.preventDefault();\n if (editable) clear(index, event.key === \"Backspace\");\n return;\n }\n }\n\n const indexOf = (target: EventTarget | null) => {\n const element = target instanceof Element ? target.closest<HTMLElement>(\"[data-segment]\") : null;\n return element ? Number(element.dataset.segment) : undefined;\n };\n\n /** Reads digit groups in the segments' order, so \"13/10/2026\" pastes into dd/mm/yyyy, and a or p for AM/PM. */\n function readGroups(text: string): SegmentValues | null {\n const numeric = segments.filter((segment) => !segment.letters);\n const groups: number[] = [];\n let group = \"\";\n for (const char of `${text} `) {\n const digit = parseDigit(char);\n if (digit !== undefined) group += digit;\n else if (group) {\n groups.push(Number(group));\n group = \"\";\n }\n }\n if (groups.length !== numeric.length) return null;\n const changes: SegmentValues = {};\n for (const [i, segment] of numeric.entries()) {\n const n = groups[i]!;\n // The day's range depends on the month, which may be changing too: the field fits it afterwards.\n if (n < segment.min || n > (segment.type === \"day\" ? 31 : segment.max)) return null;\n changes[segment.type] = n;\n }\n const period = segments.find((segment) => segment.letters);\n const letter = period && [...text.toLowerCase()].find((char) => period.letters![char] !== undefined);\n if (period && letter) changes[period.type] = period.letters![letter];\n return changes;\n }\n\n function onPaste(event: ClipboardEvent<HTMLDivElement>) {\n event.preventDefault();\n if (!editable) return;\n const text = event.clipboardData.getData(\"text/plain\").trim();\n const changes = parsePaste?.(text) ?? readGroups(text);\n if (changes) {\n setTyping(null);\n onSegmentsChange(changes);\n return;\n }\n const index = indexOf(event.target);\n if (index !== undefined) insertText(index, text);\n }\n\n /** A click on the field but not on a segment (the padding, a separator, the icon) focuses the nearest segment. */\n function onMouseDown(event: MouseEvent<HTMLDivElement>) {\n if (disabled || event.button !== 0) return;\n const target = event.target as Element;\n if (target.closest(\"[data-segment], button, a, input, select, textarea\")) return;\n event.preventDefault();\n let nearest = 0;\n let distance = Infinity;\n segmentRefs.current.slice(0, segments.length).forEach((element, index) => {\n if (!element) return;\n const box = element.getBoundingClientRect();\n const gap = event.clientX < box.left ? box.left - event.clientX : Math.max(0, event.clientX - box.right);\n if (gap < distance) {\n distance = gap;\n nearest = index;\n }\n });\n focusSegment(nearest);\n }\n\n // The browser's editing events, read through a ref so the listeners can be added once.\n const handlers = useRef({ beforeInput: (_event: InputEvent) => {}, input: (_event: InputEvent) => {}, compositionEnd: (_event: CompositionEvent) => {} });\n const restore = (index: number) => {\n const element = segmentRefs.current[index];\n if (element && element.textContent !== texts.current[index]) element.textContent = texts.current[index] ?? \"\";\n };\n handlers.current = {\n // Segments are contentEditable so phones open their number pad; every edit is cancelled and done here instead.\n beforeInput(event) {\n const index = indexOf(event.target);\n if (event.inputType === \"insertCompositionText\" || index === undefined) return;\n event.preventDefault();\n if (!editable) return;\n if (event.inputType.startsWith(\"delete\")) clear(index, event.inputType === \"deleteContentBackward\");\n else if (event.data) insertText(index, event.data);\n },\n input(event) {\n const index = indexOf(event.target);\n if (index !== undefined && !event.isComposing) restore(index);\n },\n compositionEnd(event) {\n const index = indexOf(event.target);\n if (index === undefined) return;\n restore(index);\n if (editable && event.data) insertText(index, event.data);\n },\n };\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n const beforeInput = (event: Event) => handlers.current.beforeInput(event as InputEvent);\n const input = (event: Event) => handlers.current.input(event as InputEvent);\n const compositionEnd = (event: Event) => handlers.current.compositionEnd(event as CompositionEvent);\n root.addEventListener(\"beforeinput\", beforeInput);\n root.addEventListener(\"input\", input);\n root.addEventListener(\"compositionend\", compositionEnd);\n return () => {\n root.removeEventListener(\"beforeinput\", beforeInput);\n root.removeEventListener(\"input\", input);\n root.removeEventListener(\"compositionend\", compositionEnd);\n };\n }, []);\n\n // A label can't point at a group, so the one Field puts above (label[for=id]) is wired up here: it names the\n // group, and clicking it focuses the first segment.\n const focusFirst = useRef(() => {});\n focusFirst.current = () => {\n if (!disabled) focusSegment(0);\n };\n useEffect(() => {\n const root = rootRef.current;\n if (!root || !id) return;\n const scope = root.getRootNode() as Document | ShadowRoot;\n const labels = Array.from(scope.querySelectorAll<HTMLLabelElement>(`label[for=\"${CSS.escape(id)}\"]`));\n const label = labels[0];\n if (!label) {\n setLabelId(undefined);\n return;\n }\n if (!label.id) label.id = `${id}-label`;\n setLabelId(label.id);\n const onClick = () => focusFirst.current();\n labels.forEach((element) => element.addEventListener(\"click\", onClick));\n return () => labels.forEach((element) => element.removeEventListener(\"click\", onClick));\n }, [id]);\n\n let segmentIndex = -1;\n\n return (\n <div\n ref={(element) => {\n rootRef.current = element;\n if (typeof forwardedRef === \"function\") forwardedRef(element);\n else if (forwardedRef) forwardedRef.current = element;\n }}\n id={id}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={[...new Set([ariaLabelledBy, labelId].filter(Boolean))].join(\" \") || undefined}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-date-field\",\n size === \"sm\" && \"ow-date-field--sm\",\n startContent !== undefined && \"ow-date-field--with-start\",\n isInvalid && \"ow-date-field--invalid\",\n disabled && \"ow-date-field--disabled\",\n readOnly && \"ow-date-field--readonly\",\n className,\n )}\n onMouseDown={onMouseDown}\n onPaste={onPaste}\n >\n {startContent !== undefined ? <span className=\"ow-date-field__addon\">{startContent}</span> : null}\n <span className=\"ow-date-field__segments\">\n {parts.map((part, partIndex) => {\n if (part.type === \"literal\") {\n return (\n <span key={`literal-${partIndex}`} className=\"ow-date-field__literal\" aria-hidden=\"true\">\n {part.text}\n </span>\n );\n }\n segmentIndex += 1;\n const index = segmentIndex;\n const typed = typing?.type === part.type ? typing.text : null;\n const current = typed !== null && part.deferTyping ? Number(typed) : part.value;\n const isPlaceholder = typed === null && part.value === undefined;\n const text =\n typed !== null\n ? [...typed].map((digit) => digits[Number(digit)]).join(\"\")\n : part.value !== undefined\n ? part.format(part.value)\n : part.placeholder;\n texts.current[index] = text;\n return (\n <span\n key={part.type}\n ref={(element) => {\n segmentRefs.current[index] = element;\n }}\n role=\"spinbutton\"\n data-segment={index}\n className={cx(\n \"ow-date-field__segment\",\n part.width && `ow-date-field__segment--digits-${part.width}`,\n isPlaceholder && \"ow-date-field__segment--placeholder\",\n )}\n tabIndex={disabled ? undefined : 0}\n contentEditable={editable || undefined}\n suppressContentEditableWarning\n inputMode={part.letters ? \"text\" : \"numeric\"}\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n enterKeyHint={index < segments.length - 1 ? \"next\" : \"done\"}\n aria-label={part.label}\n aria-valuenow={current}\n aria-valuemin={part.min}\n aria-valuemax={part.max}\n aria-valuetext={current === undefined ? \"Empty\" : part.describe(current)}\n aria-invalid={isInvalid || undefined}\n aria-readonly={readOnly || undefined}\n aria-disabled={disabled || undefined}\n aria-describedby={ariaDescribedBy}\n dangerouslySetInnerHTML={{ __html: escapeHTML(text) }}\n onKeyDown={(event) => onKeyDown(event, index)}\n onBlur={() => flush()}\n />\n );\n })}\n </span>\n {name !== undefined ? <input type=\"hidden\" name={name} value={value} disabled={disabled} /> : null}\n </div>\n );\n}\n\n/** The locale's digits, 0 to 9, so typed and shown numbers follow its numbering system. */\nexport function localeDigits(locale: string | undefined): string[] {\n const format = new Intl.NumberFormat(locale, { useGrouping: false });\n return Array.from({ length: 10 }, (_, digit) => format.format(digit));\n}\n", "import { forwardRef, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { localeDigits, SegmentedField, type Part, type Segment, type SegmentValues } from \"./SegmentedField\";\n\nexport interface TimeFieldProps {\n /** The time on a 24-hour clock, \"HH:MM\", or \"HH:MM:SS\" when granularity is \"second\"; \"\" while any part is empty. */\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n /** Called with \"HH:MM\" (or \"HH:MM:SS\") when the time is complete and whenever it changes after that, and with \"\" when a part is cleared. */\n onChange?(value: string): void;\n /** 12 shows hours 1\u201312 and an AM/PM segment; 24 shows 00\u201323. Defaults to the locale's clock. */\n hourCycle?: 12 | 24;\n /** \"second\" adds a seconds segment.\n * @default \"minute\" */\n granularity?: \"minute\" | \"second\";\n /** Up and Down move the minutes by this much, landing on its multiples: 5, 15. Typed minutes can still be anything.\n * @default 1 */\n minuteStep?: number;\n /** The earliest valid time, \"HH:MM\". An earlier one shows the field as invalid. */\n min?: string;\n /** The latest valid time, \"HH:MM\". A later one shows the field as invalid. */\n max?: string;\n /** The separators, the AM/PM words and where they go follow this locale. Defaults to the browser's. */\n locale?: string;\n /** sm 32px for toolbars and settings rows, md 40px in forms.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid. A time outside\n * min and max does this by itself.\n * @default false */\n isInvalid?: boolean;\n /** @default false */\n disabled?: boolean;\n /** The time can be focused and read but not changed.\n * @default false */\n readOnly?: boolean;\n /** The form field name: a hidden input carries the \"HH:MM\" value. */\n name?: string;\n /** Inside the field, before the time: a 16px clock icon. */\n startContent?: ReactNode;\n /** Goes on the group. Field sets it, and its label then names the group and focuses the first segment when clicked. */\n id?: string;\n /** Names the time for screen readers when there's no visible label. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** Field points it at its hint and error; each segment is described by them. */\n \"aria-describedby\"?: string;\n className?: string;\n}\n\ntype TimeParts = { hour?: number | undefined; minute?: number | undefined; second?: number | undefined; dayPeriod?: number | undefined };\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\n/** \"09:30\" or \"09:30:15\" as seconds since midnight, or undefined when it isn't a time. */\nfunction toSeconds(time: string | undefined): number | undefined {\n const match = time ? /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/.exec(time) : null;\n if (!match) return undefined;\n const [hour, minute, second] = [Number(match[1]), Number(match[2]), Number(match[3] ?? 0)];\n return hour < 24 && minute < 60 && second < 60 ? hour * 3600 + minute * 60 + second : undefined;\n}\n\n/** Splits seconds since midnight into the segments as shown: on a 12-hour clock, 1\u201312 and AM (0) or PM (1). */\nfunction split(total: number, twelve: boolean, seconds: boolean): TimeParts {\n const hour = Math.floor(total / 3600);\n const parts: TimeParts = { hour, minute: Math.floor((total % 3600) / 60), second: seconds ? total % 60 : undefined };\n return twelve ? { ...parts, hour: hour % 12 || 12, dayPeriod: hour >= 12 ? 1 : 0 } : parts;\n}\n\nfunction toTime({ hour, minute, second, dayPeriod }: TimeParts, twelve: boolean, seconds: boolean): string {\n if (hour === undefined || minute === undefined || (seconds && second === undefined) || (twelve && dayPeriod === undefined)) return \"\";\n const hour24 = twelve ? (hour % 12) + (dayPeriod ? 12 : 0) : hour;\n return `${pad(hour24)}:${pad(minute)}${seconds ? `:${pad(second!)}` : \"\"}`;\n}\n\nfunction fromTime(time: string, twelve: boolean, seconds: boolean): TimeParts {\n const total = toSeconds(time);\n return total === undefined ? {} : split(total, twelve, seconds);\n}\n\nfunction localeHourCycle(locale: string | undefined): 12 | 24 {\n const options = new Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions();\n if (options.hourCycle) return options.hourCycle === \"h11\" || options.hourCycle === \"h12\" ? 12 : 24;\n return options.hour12 ? 12 : 24;\n}\n\ntype TimeLayout = Array<{ type: \"hour\" | \"minute\" | \"second\" | \"dayPeriod\" } | { type: \"literal\"; text: string }>;\n\n/** The order of the segments, the separators and the AM/PM words, from the locale's time format. */\nfunction timeLayout(locale: string | undefined, twelve: boolean, seconds: boolean) {\n const format = new Intl.DateTimeFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: seconds ? \"2-digit\" : undefined,\n hourCycle: twelve ? \"h12\" : \"h23\",\n timeZone: \"UTC\",\n });\n const periodOf = (hour: number) => format.formatToParts(new Date(Date.UTC(2026, 0, 1, hour))).find((part) => part.type === \"dayPeriod\")?.value;\n const layout: TimeLayout = [];\n for (const part of format.formatToParts(new Date(Date.UTC(2026, 0, 1, 13, 45, 30)))) {\n if (part.type === \"hour\" || part.type === \"minute\" || part.type === \"second\" || (part.type === \"dayPeriod\" && twelve)) layout.push({ type: part.type });\n else if (part.type === \"literal\") layout.push({ type: \"literal\", text: part.value });\n }\n // Some locales put no AM/PM in a 12-hour time; add it at the end so the time can still be told apart.\n if (twelve && !layout.some((part) => part.type === \"dayPeriod\")) layout.push({ type: \"literal\", text: \" \" }, { type: \"dayPeriod\" });\n return { layout, am: periodOf(1) ?? \"AM\", pm: periodOf(13) ?? \"PM\" };\n}\n\n/**\n * A time typed into hour, minute and optional second segments, with AM/PM on a 12-hour clock. It works like\n * DateField: digits fill a segment and move on, the arrow keys step it, and the value is always on a 24-hour clock.\n */\nexport const TimeField = /* @__PURE__ */ forwardRef<HTMLDivElement, TimeFieldProps>(function TimeField(\n {\n value,\n defaultValue = \"\",\n onChange,\n hourCycle,\n granularity = \"minute\",\n minuteStep = 1,\n min,\n max,\n locale,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n readOnly = false,\n name,\n startContent,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n },\n ref,\n) {\n const [current, setCurrent] = useControllableState(value, defaultValue, onChange);\n const localeCycle = useMemo(() => localeHourCycle(locale), [locale]);\n const twelve = (hourCycle ?? localeCycle) === 12;\n const seconds = granularity === \"second\";\n const [parts, setParts] = useState<TimeParts>(() => fromTime(current, twelve, seconds));\n const partsRef = useRef(parts);\n partsRef.current = parts;\n // The segments can hold a time that isn't complete yet; they're set again from the value when it changes from\n // outside, or when the clock or granularity changes what they show.\n const shape = `${current}|${twelve}|${seconds}`;\n const [synced, setSynced] = useState(shape);\n if (shape !== synced) {\n setSynced(shape);\n if (current !== toTime(parts, twelve, seconds) || !synced.endsWith(`|${twelve}|${seconds}`)) setParts(fromTime(current, twelve, seconds));\n }\n\n function update(changes: SegmentValues) {\n const next = { ...partsRef.current, ...changes };\n // An hour typed on a 12-hour clock is AM, as the placeholder shows, until A or P says otherwise.\n if (twelve && changes.hour !== undefined && next.dayPeriod === undefined) next.dayPeriod = 0;\n partsRef.current = next;\n setParts(next);\n setCurrent(toTime(next, twelve, seconds));\n }\n\n const formats = useMemo(() => {\n const one = new Intl.NumberFormat(locale, { useGrouping: false });\n const two = new Intl.NumberFormat(locale, { minimumIntegerDigits: 2, useGrouping: false });\n return { one, two, digits: localeDigits(locale), ...timeLayout(locale, twelve, seconds) };\n }, [locale, twelve, seconds]);\n\n // Up or Down on an empty segment starts from the current hour, or the nearest time min and max allow.\n const now = new Date();\n let reference = now.getHours() * 3600;\n const minSeconds = toSeconds(min);\n const maxSeconds = toSeconds(max);\n if (minSeconds !== undefined && reference < minSeconds) reference = minSeconds;\n if (maxSeconds !== undefined && reference > maxSeconds) reference = maxSeconds;\n const start = split(reference, twelve, true);\n const step = Math.max(1, Math.min(30, Math.round(minuteStep)));\n\n const letters: Record<string, number> = { a: 0, p: 1 };\n const amLetter = formats.am.charAt(0).toLowerCase();\n const pmLetter = formats.pm.charAt(0).toLowerCase();\n if (amLetter !== pmLetter) Object.assign(letters, { [amLetter]: 0, [pmLetter]: 1 });\n\n const segments: Record<\"hour\" | \"minute\" | \"second\" | \"dayPeriod\", Segment> = {\n hour: {\n type: \"hour\",\n label: \"Hour\",\n value: parts.hour,\n min: twelve ? 1 : 0,\n max: twelve ? 12 : 23,\n placeholder: \"\u2013\u2013\",\n // 9:05 AM on a 12-hour clock, 09:05 on a 24-hour one.\n format: (n) => (twelve ? formats.one : formats.two).format(n),\n describe: String,\n start: start.hour ?? 0,\n page: 2,\n wrap: true,\n width: twelve ? undefined : 2,\n },\n minute: {\n type: \"minute\",\n label: \"Minute\",\n value: parts.minute,\n min: 0,\n max: 59,\n placeholder: \"\u2013\u2013\",\n format: (n) => formats.two.format(n),\n describe: (n) => formats.two.format(n),\n start: Math.floor((start.minute ?? 0) / step) * step,\n step,\n page: Math.max(15, step),\n wrap: true,\n width: 2,\n },\n second: {\n type: \"second\",\n label: \"Second\",\n value: parts.second,\n min: 0,\n max: 59,\n placeholder: \"\u2013\u2013\",\n format: (n) => formats.two.format(n),\n describe: (n) => formats.two.format(n),\n start: start.second ?? 0,\n page: 15,\n wrap: true,\n width: 2,\n },\n dayPeriod: {\n type: \"dayPeriod\",\n label: \"AM/PM\",\n value: parts.dayPeriod,\n min: 0,\n max: 1,\n placeholder: formats.am,\n format: (n) => (n ? formats.pm : formats.am),\n describe: (n) => (n ? formats.pm : formats.am),\n start: start.dayPeriod ?? 0,\n page: 1,\n wrap: true,\n letters,\n },\n };\n const layout: Part[] = formats.layout.map((part) => (part.type === \"literal\" ? part : segments[part.type]));\n\n const total = toSeconds(current);\n const outOfRange = total !== undefined && ((minSeconds !== undefined && total < minSeconds) || (maxSeconds !== undefined && total > maxSeconds));\n\n return (\n <SegmentedField\n parts={layout}\n value={current}\n onSegmentsChange={update}\n // \"14:30\" pastes as a 24-hour time even on a 12-hour clock; \"2:30 pm\" is read in the segments' order.\n parsePaste={(text) => (/^\\d{1,2}:\\d{2}(:\\d{2})?$/.test(text) && toSeconds(text) !== undefined ? fromTime(text, twelve, seconds) : null)}\n digits={formats.digits}\n forwardedRef={ref}\n id={id}\n name={name}\n size={size}\n isInvalid={isInvalid || outOfRange}\n disabled={disabled}\n readOnly={readOnly}\n startContent={startContent}\n className={className}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n />\n );\n});\n", "import {\n forwardRef,\n useLayoutEffect,\n useRef,\n type ChangeEvent,\n type CSSProperties,\n type ForwardedRef,\n type TextareaHTMLAttributes,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { resizeTextArea } from \"../../utils/resizeTextArea\";\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Grows with its text, up to `autoGrowMaxHeight`, then scrolls. */\n autoGrow?: boolean;\n /** The tallest an auto-growing box gets. A number is pixels. Default 180. */\n autoGrowMaxHeight?: number | string;\n /** Borderless and transparent, for use inside your own field container (a chat composer). */\n bare?: boolean;\n isInvalid?: boolean;\n}\n\nconst defaultAutoGrowMaxHeight = 180;\n\nfunction assignRef(ref: ForwardedRef<HTMLTextAreaElement>, element: HTMLTextAreaElement | null) {\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n}\n\n/** A multi-line text field, 72px tall at least; it can grow with its text. */\nexport const Textarea = /* @__PURE__ */ forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n autoGrow = false,\n autoGrowMaxHeight = defaultAutoGrowMaxHeight,\n bare = false,\n className,\n isInvalid = false,\n onChange,\n style,\n value,\n ...textareaProps\n },\n ref,\n) {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useLayoutEffect(() => {\n if (autoGrow && textAreaRef.current) resizeTextArea(textAreaRef.current);\n }, [autoGrow, autoGrowMaxHeight, value]);\n\n function setTextAreaRef(element: HTMLTextAreaElement | null) {\n textAreaRef.current = element;\n assignRef(ref, element);\n if (autoGrow && element) resizeTextArea(element);\n }\n\n function handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n // A controlled box is resized once its new value renders (the layout effect above).\n if (autoGrow && value === undefined) resizeTextArea(event.currentTarget);\n onChange?.(event);\n }\n\n const textareaStyle: CSSProperties | undefined = autoGrow\n ? {\n ...style,\n maxHeight: typeof autoGrowMaxHeight === \"number\" ? `${autoGrowMaxHeight}px` : autoGrowMaxHeight,\n }\n : style;\n\n return (\n <textarea\n {...textareaProps}\n ref={setTextAreaRef}\n className={cx(\n \"ow-textarea\",\n bare && \"ow-textarea--bare\",\n isInvalid && !bare && \"ow-textarea--invalid\",\n autoGrow && \"ow-textarea--auto-grow\",\n className,\n )}\n aria-invalid={isInvalid || undefined}\n style={textareaStyle}\n value={value}\n onChange={handleChange}\n />\n );\n});\n", "/** Text longer than this can't fit under any auto-grow cap, however wide the box. */\nconst surelyOverflowingLength = 20_000;\n\n/**\n * Whether the text needs more lines than fit under maxHeight even before wrapping. Counting line breaks is cheap;\n * measuring (scrollHeight) lays out all of the text, which takes tens of milliseconds per keystroke for a long draft.\n */\nfunction surelyOverflows(textArea: HTMLTextAreaElement, maxHeight: number): boolean {\n const text = textArea.value;\n if (text.length > surelyOverflowingLength) return true;\n const style = window.getComputedStyle(textArea);\n const lineHeight = Number.parseFloat(style.lineHeight) || Number.parseFloat(style.fontSize) * 1.2;\n if (!lineHeight) return false;\n const needed = Math.ceil(maxHeight / lineHeight) + 1;\n let lines = 1;\n for (let index = text.indexOf(\"\\n\"); index !== -1 && lines < needed; index = text.indexOf(\"\\n\", index + 1))\n lines += 1;\n return lines >= needed;\n}\n\n/** Grows a textarea to fit its text, up to its CSS max-height, then scrolls. */\nexport function resizeTextArea(textArea: HTMLTextAreaElement): void {\n const maxHeight = Number.parseFloat(window.getComputedStyle(textArea).maxHeight);\n // Already past the cap: it stays at the cap and scrolls, with nothing to measure.\n if (Number.isFinite(maxHeight) && surelyOverflows(textArea, maxHeight)) {\n textArea.style.height = `${maxHeight.toString()}px`;\n textArea.style.overflowY = \"auto\";\n return;\n }\n\n textArea.style.height = \"auto\";\n\n const shouldScroll = Number.isFinite(maxHeight) && textArea.scrollHeight > maxHeight;\n\n textArea.style.height = `${textArea.scrollHeight}px`;\n textArea.style.overflowY = shouldScroll ? \"auto\" : \"hidden\";\n}\n", "import { useCallback, useEffect, useId, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { CheckIcon, ChevronDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface SelectOption {\n value: string;\n label: ReactNode;\n /** Plain text for type-to-find and the trigger's tooltip, when `label` isn't a string. */\n textValue?: string;\n /** A muted line under the label. */\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface SelectGroup {\n label: string;\n options: SelectOption[];\n}\n\nexport type SelectItem = SelectOption | SelectGroup;\n\nexport interface SelectProps {\n value: string;\n options: SelectItem[];\n onChange(value: string): void;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n disabled?: boolean;\n /** Shown when no option matches `value`. Default \"Select\u2026\". */\n placeholder?: string;\n size?: \"sm\" | \"md\";\n isInvalid?: boolean;\n /** Classes for the trigger, e.g. a width. */\n className?: string;\n /** Classes for the trigger's and options' text, e.g. a monospace class. */\n valueClassName?: string;\n}\n\nconst menuGap = 4;\nconst menuMaxHeight = 288;\nconst typeaheadResetMs = 600;\n\nfunction isGroup(item: SelectItem): item is SelectGroup {\n return \"options\" in item;\n}\n\nfunction textOf(option: SelectOption): string {\n return option.textValue ?? (typeof option.label === \"string\" ? option.label : option.value);\n}\n\n/**\n * A dropdown: a button that opens a listbox of options, in place of a native <select>.\n * It works with the keyboard like a select (arrows, Home/End, type to find, Enter/Space to pick,\n * Escape/Tab to close), keeps focus on the trigger, and its menu sits in the top layer so it\n * isn't clipped by dialogs or scroll areas.\n */\nexport function Select({\n value,\n options,\n onChange,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n disabled = false,\n placeholder = \"Select\u2026\",\n size = \"md\",\n isInvalid = false,\n className,\n valueClassName,\n}: SelectProps) {\n const listboxId = useId();\n const optionIdPrefix = useId();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const typeahead = useRef({ text: \"\", timer: 0 });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n\n const flat = useMemo(() => options.flatMap((item) => (isGroup(item) ? item.options : [item])), [options]);\n const selectedIndex = flat.findIndex((option) => option.value === value);\n const selected = flat[selectedIndex];\n const optionId = (index: number) => `${optionIdPrefix}-${index}`;\n\n const enabledFrom = useCallback(\n (start: number, step: 1 | -1): number => {\n for (let index = start; index >= 0 && index < flat.length; index += step) {\n if (!flat[index]!.disabled) return index;\n }\n return -1;\n },\n [flat],\n );\n\n const { mounted, state } = usePresence(isOpen);\n const floatingStyle = useFloating({\n open: mounted,\n anchorRef: triggerRef,\n floatingRef: menuRef,\n offset: menuGap,\n matchWidth: true,\n maxHeight: menuMaxHeight,\n });\n\n function open(startAt?: \"first\" | \"last\") {\n if (disabled || isOpen) return;\n setActiveIndex(\n startAt === \"first\"\n ? enabledFrom(0, 1)\n : startAt === \"last\"\n ? enabledFrom(flat.length - 1, -1)\n : selectedIndex >= 0 && !flat[selectedIndex]!.disabled\n ? selectedIndex\n : enabledFrom(0, 1),\n );\n setIsOpen(true);\n }\n\n function close() {\n setIsOpen(false);\n }\n\n function choose(index: number) {\n const option = flat[index];\n if (!option || option.disabled) return;\n close();\n triggerRef.current?.focus();\n if (option.value !== value) onChange(option.value);\n }\n\n // Keep the active option in view while moving with the keyboard.\n useEffect(() => {\n if (!isOpen || activeIndex < 0) return;\n document.getElementById(optionId(activeIndex))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable for this component.\n }, [isOpen, activeIndex]);\n\n // Close on a click elsewhere. (useFloating follows the trigger when the page scrolls or resizes.)\n useEffect(() => {\n if (!isOpen) return;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (!menuRef.current?.contains(target) && !triggerRef.current?.contains(target)) close();\n };\n document.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => document.removeEventListener(\"pointerdown\", onPointerDown, true);\n }, [isOpen]);\n\n useEffect(() => {\n if (disabled) setIsOpen(false);\n }, [disabled]);\n\n useEffect(() => () => window.clearTimeout(typeahead.current.timer), []);\n\n function findByTyping(key: string) {\n const state = typeahead.current;\n window.clearTimeout(state.timer);\n state.text += key.toLowerCase();\n state.timer = window.setTimeout(() => {\n state.text = \"\";\n }, typeaheadResetMs);\n const from = isOpen ? activeIndex : selectedIndex;\n // A repeated single letter cycles through the matches.\n const repeated = state.text.length > 1 && [...state.text].every((letter) => letter === state.text[0]);\n const search = repeated ? state.text[0]! : state.text;\n const start = repeated || state.text.length === 1 ? from + 1 : from;\n for (let offset = 0; offset < flat.length; offset += 1) {\n const index = (Math.max(start, 0) + offset) % flat.length;\n const option = flat[index]!;\n if (!option.disabled && textOf(option).toLowerCase().startsWith(search)) {\n if (isOpen) setActiveIndex(index);\n else if (option.value !== value) onChange(option.value);\n return;\n }\n }\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n if (disabled) return;\n const { key } = event;\n\n if (!isOpen) {\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Enter\" || key === \" \") {\n event.preventDefault();\n open(key === \"ArrowUp\" && selectedIndex < 0 ? \"last\" : undefined);\n } else if (key.length === 1 && !event.metaKey && !event.ctrlKey) {\n findByTyping(key);\n }\n return;\n }\n\n switch (key) {\n case \"ArrowDown\": {\n event.preventDefault();\n const next = enabledFrom(activeIndex + 1, 1);\n if (next >= 0) setActiveIndex(next);\n return;\n }\n case \"ArrowUp\": {\n event.preventDefault();\n const previous = enabledFrom(activeIndex - 1, -1);\n if (previous >= 0) setActiveIndex(previous);\n return;\n }\n case \"Home\":\n case \"PageUp\":\n event.preventDefault();\n setActiveIndex(enabledFrom(0, 1));\n return;\n case \"End\":\n case \"PageDown\":\n event.preventDefault();\n setActiveIndex(enabledFrom(flat.length - 1, -1));\n return;\n case \"Enter\":\n event.preventDefault();\n choose(activeIndex);\n return;\n case \" \":\n event.preventDefault();\n if (typeahead.current.text) findByTyping(\" \");\n else choose(activeIndex);\n return;\n case \"Escape\":\n // Close the menu, not the dialog around it.\n event.preventDefault();\n event.stopPropagation();\n close();\n return;\n case \"Tab\":\n close();\n return;\n default:\n if (key.length === 1 && !event.metaKey && !event.ctrlKey) findByTyping(key);\n }\n }\n\n let flatIndex = -1;\n\n const renderOption = (option: SelectOption) => {\n flatIndex += 1;\n const index = flatIndex;\n const isSelected = index === selectedIndex;\n const isActive = index === activeIndex;\n return (\n <div\n key={`${option.value}-${index}`}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": isActive && !option.disabled,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerMove={() => {\n if (!option.disabled && activeIndex !== index) setActiveIndex(index);\n }}\n // Keep focus on the trigger.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => choose(index)}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n <span className=\"ow-option__text\">\n <span className={cx(\"ow-option__label\", valueClassName)}>{option.label}</span>\n {option.description ? <span className=\"ow-option__description\">{option.description}</span> : null}\n </span>\n </div>\n );\n };\n\n return (\n <>\n <button\n ref={triggerRef}\n id={id}\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listboxId : undefined}\n aria-activedescendant={isOpen && activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n title={selected ? textOf(selected) : undefined}\n className={cx(\"ow-select\", `ow-select--${size}`, { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen }, className)}\n onClick={() => (isOpen ? close() : open())}\n onKeyDown={onKeyDown}\n onBlur={(event) => {\n if (!menuRef.current?.contains(event.relatedTarget as Node)) close();\n }}\n >\n <span className={cx(\"ow-select__value\", !selected && \"ow-select__value--placeholder\", valueClassName)}>\n {selected ? selected.label : placeholder}\n </span>\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className=\"ow-select__chevron\" />\n </button>\n {mounted ? (\n <div\n ref={menuRef}\n {...manualPopover}\n data-state={state}\n id={listboxId}\n role=\"listbox\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabIndex={-1}\n className={cx(\"ow-listbox\", \"ow-floating\", `ow-listbox--${size}`)}\n style={floatingStyle}\n >\n {options.map((item, groupIndex) =>\n isGroup(item) ? (\n <div key={`group-${item.label}-${groupIndex}`} role=\"group\" aria-label={item.label} className=\"ow-listbox__group\">\n <div className=\"ow-listbox__group-label\" aria-hidden=\"true\">\n {item.label}\n </div>\n {item.options.map(renderOption)}\n </div>\n ) : (\n renderOption(item)\n ),\n )}\n {flat.length === 0 ? <div className=\"ow-listbox__empty\">No options</div> : null}\n </div>\n ) : null}\n </>\n );\n}\n", "import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { CheckIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport type { SelectOption } from \"@/components/Select/Select\";\nimport type { ListBoxGroup, ListBoxItem, ListBoxModeProps, ListBoxOption, ListBoxProps, ListBoxSelectionMode } from \"./ListBox.types\";\nexport type { ListBoxGroup, ListBoxItem, ListBoxModeProps, ListBoxOption, ListBoxProps, ListBoxSelectionMode } from \"./ListBox.types\";\n\nconst typeaheadResetMs = 600;\n\nfunction isGroup(item: ListBoxItem): item is ListBoxGroup {\n return \"options\" in item;\n}\n\nfunction textOf(option: ListBoxOption): string {\n return option.textValue ?? (typeof option.label === \"string\" ? option.label : option.value);\n}\n\nfunction sameValues(a: Set<string>, b: Set<string>) {\n return a.size === b.size && [...a].every((value) => b.has(value));\n}\n\n/**\n * Select's list of options, standing on the page in a bordered surface: a choice in a settings panel, a picker beside\n * other content. One option or any number; arrows, Home/End and type-to-find move, Space or Enter selects, and in\n * multiple mode Shift extends the selection and Ctrl/\u2318+A selects everything.\n */\nfunction ListBoxWithRef<Mode extends ListBoxSelectionMode = \"single\">(\n {\n options,\n selectionMode,\n value,\n defaultValue,\n onChange,\n disallowEmptySelection = false,\n emptyMessage = \"No options\",\n maxHeight,\n size = \"md\",\n isInvalid = false,\n isReadOnly = false,\n disabled = false,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n }: ListBoxModeProps<Mode>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const multiple = selectionMode === \"multiple\";\n const [current, setCurrent] = useControllableState<string | string[]>(\n value as string | string[] | undefined,\n (defaultValue as string | string[] | undefined) ?? (multiple ? [] : \"\"),\n onChange as ((next: string | string[]) => void) | undefined,\n );\n const listRef = useRef<HTMLDivElement | null>(null);\n const optionIdPrefix = useId();\n const emptyId = useId();\n const optionId = (index: number) => `${optionIdPrefix}-${index}`;\n const typeahead = useRef({ text: \"\", timer: 0 });\n // Where a Shift selection grows from, and what was selected before it started.\n const anchor = useRef<{ index: number; base: Set<string> } | null>(null);\n const pointerDown = useRef(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const [focus, setFocus] = useState<\"none\" | \"pointer\" | \"keyboard\">(\"none\");\n const [fieldLabelId, setFieldLabelId] = useState<string>();\n\n const flat = useMemo(() => options.flatMap((item) => (isGroup(item) ? item.options : [item])), [options]);\n const selected = useMemo(() => new Set(Array.isArray(current) ? current : current ? [current] : []), [current]);\n const canSelect = !disabled && !isReadOnly;\n\n function enabledFrom(start: number, step: 1 | -1): number {\n for (let index = start; index >= 0 && index < flat.length; index += step) {\n if (!flat[index]!.disabled) return index;\n }\n return -1;\n }\n\n // Until something is highlighted, focus lands on the first selected option, or else the first option.\n const active = useMemo(() => {\n if (activeIndex >= 0 && activeIndex < flat.length && !flat[activeIndex]!.disabled) return activeIndex;\n const firstSelected = flat.findIndex((option) => !option.disabled && selected.has(option.value));\n return firstSelected >= 0 ? firstSelected : flat.findIndex((option) => !option.disabled);\n }, [activeIndex, flat, selected]);\n\n const setRefs = useCallback(\n (element: HTMLDivElement | null) => {\n listRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n [ref],\n );\n\n // Field labels its control with <label for>, which only names native form controls, so name the list by the label's\n // id instead, and let a click on the label focus the list as it would an input.\n useEffect(() => {\n const list = listRef.current;\n if (!id || ariaLabel || ariaLabelledBy || !list) return;\n const root = list.getRootNode() as Document | ShadowRoot;\n const label = [...(root.querySelectorAll?.(\"label\") ?? [])].find((element) => element.htmlFor === id);\n if (!label) return;\n if (!label.id) label.id = `${id}-label`;\n setFieldLabelId(label.id);\n const focusList = () => listRef.current?.focus();\n label.addEventListener(\"click\", focusList);\n return () => label.removeEventListener(\"click\", focusList);\n }, [id, ariaLabel, ariaLabelledBy]);\n\n // Keep the highlighted option in view while moving with the keyboard (not on a click, which would scroll under the pointer).\n useEffect(() => {\n if (focus !== \"keyboard\" || active < 0) return;\n document.getElementById(optionId(active))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable for this component.\n }, [focus, active]);\n\n useEffect(() => () => window.clearTimeout(typeahead.current.timer), []);\n\n function commit(next: Set<string>) {\n if (!canSelect || sameValues(next, selected) || (disallowEmptySelection && next.size === 0)) return;\n if (!multiple) {\n setCurrent([...next][0] ?? \"\");\n return;\n }\n // Report values in the options' order, keeping any the options don't list.\n const listed = new Set(flat.map((option) => option.value));\n setCurrent([\n ...new Set([...flat.filter((option) => next.has(option.value)).map((option) => option.value), ...[...next].filter((v) => !listed.has(v))]),\n ]);\n }\n\n function toggle(index: number) {\n const option = flat[index];\n if (!option || option.disabled) return;\n const isSelected = selected.has(option.value);\n if (!multiple) {\n commit(new Set(isSelected ? [] : [option.value]));\n return;\n }\n const next = new Set(selected);\n if (isSelected) next.delete(option.value);\n else next.add(option.value);\n commit(next);\n anchor.current = { index, base: next };\n }\n\n /** Selects from the anchor to `index`, on top of what was selected before the anchor was set. */\n function extendTo(index: number, anchorIfNone: number) {\n if (!anchor.current) anchor.current = { index: anchorIfNone, base: new Set(selected) };\n const { index: from, base } = anchor.current;\n const next = new Set(base);\n for (let i = Math.min(from, index); i <= Math.max(from, index); i += 1) {\n const option = flat[i];\n if (option && !option.disabled) next.add(option.value);\n }\n commit(next);\n }\n\n function toggleAll() {\n const enabled = flat.filter((option) => !option.disabled).map((option) => option.value);\n const next = new Set(selected);\n const allSelected = enabled.every((v) => selected.has(v));\n for (const v of enabled) {\n if (allSelected) next.delete(v);\n else next.add(v);\n }\n commit(next);\n anchor.current = null;\n }\n\n function findByTyping(key: string) {\n const state = typeahead.current;\n window.clearTimeout(state.timer);\n state.text += key.toLowerCase();\n state.timer = window.setTimeout(() => {\n state.text = \"\";\n }, typeaheadResetMs);\n // A repeated single letter cycles through the matches.\n const repeated = state.text.length > 1 && [...state.text].every((letter) => letter === state.text[0]);\n const search = repeated ? state.text[0]! : state.text;\n const start = repeated || state.text.length === 1 ? active + 1 : active;\n for (let offset = 0; offset < flat.length; offset += 1) {\n const index = (Math.max(start, 0) + offset) % flat.length;\n const option = flat[index]!;\n if (!option.disabled && textOf(option).toLowerCase().startsWith(search)) {\n setActiveIndex(index);\n return;\n }\n }\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n if (disabled || event.altKey) return;\n const { key, shiftKey } = event;\n const extending = multiple && shiftKey && canSelect;\n const modifier = event.metaKey || event.ctrlKey;\n let target = -1;\n let anchorIfNone = -1;\n\n switch (key) {\n case \"ArrowDown\":\n target = enabledFrom(active + 1, 1);\n anchorIfNone = target;\n break;\n case \"ArrowUp\":\n target = active < 0 ? enabledFrom(flat.length - 1, -1) : enabledFrom(active - 1, -1);\n anchorIfNone = target;\n break;\n case \"Home\":\n case \"PageUp\":\n target = enabledFrom(0, 1);\n anchorIfNone = active;\n break;\n case \"End\":\n case \"PageDown\":\n target = enabledFrom(flat.length - 1, -1);\n anchorIfNone = active;\n break;\n case \" \":\n case \"Enter\":\n event.preventDefault();\n setFocus(\"keyboard\");\n if (key === \" \" && typeahead.current.text) findByTyping(\" \");\n else if (active < 0) return;\n else if (extending) extendTo(active, active);\n else toggle(active);\n return;\n default:\n if (modifier && key.toLowerCase() === \"a\" && multiple) {\n event.preventDefault();\n toggleAll();\n } else if (key.length === 1 && !modifier) {\n setFocus(\"keyboard\");\n findByTyping(key);\n }\n return;\n }\n\n // An arrow, Home or End.\n event.preventDefault();\n setFocus(\"keyboard\");\n if (target < 0) return;\n setActiveIndex(target);\n if (extending) extendTo(target, anchorIfNone < 0 ? target : anchorIfNone);\n }\n\n function onFocus(event: FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n setFocus(pointerDown.current ? \"pointer\" : \"keyboard\");\n pointerDown.current = false;\n // Pin where focus landed, so it doesn't follow the selection as that changes.\n setActiveIndex((previous) => (previous >= 0 && previous < flat.length && !flat[previous]!.disabled ? previous : active));\n }\n\n function onBlur(event: FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n setFocus(\"none\");\n setActiveIndex(-1);\n pointerDown.current = false;\n typeahead.current.text = \"\";\n }\n\n let flatIndex = -1;\n\n const renderOption = (option: ListBoxOption) => {\n flatIndex += 1;\n const index = flatIndex;\n const isSelected = selected.has(option.value);\n return (\n <div\n key={`${option.value}-${index}`}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": focus === \"keyboard\" && index === active,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerDown={() => {\n if (!disabled && !option.disabled) setActiveIndex(index);\n }}\n onClick={(event) => {\n if (disabled || option.disabled) return;\n setActiveIndex(index);\n if (multiple && event.shiftKey && canSelect) extendTo(index, index);\n else toggle(index);\n }}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n {option.icon ? (\n <span className=\"ow-option__icon\" aria-hidden=\"true\">\n {option.icon}\n </span>\n ) : null}\n <span className=\"ow-option__text\">\n <span className=\"ow-option__label\">{option.label}</span>\n {option.description ? <span className=\"ow-option__description\">{option.description}</span> : null}\n </span>\n </div>\n );\n };\n\n const isEmpty = flat.length === 0;\n const describedBy = ariaDescribedBy;\n\n return (\n <div\n ref={setRefs}\n id={id}\n role=\"listbox\"\n tabIndex={disabled ? undefined : 0}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ?? (ariaLabel ? undefined : fieldLabelId)}\n aria-describedby={describedBy}\n aria-multiselectable={multiple || undefined}\n aria-activedescendant={!disabled && active >= 0 ? optionId(active) : undefined}\n aria-invalid={isInvalid || undefined}\n aria-readonly={isReadOnly || undefined}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-listbox\",\n \"ow-listbox--standalone\",\n `ow-listbox--${size}`,\n {\n \"ow-listbox--focus-visible\": focus === \"keyboard\",\n \"ow-listbox--invalid\": isInvalid,\n \"ow-listbox--readonly\": isReadOnly,\n \"ow-listbox--disabled\": disabled,\n },\n className,\n )}\n style={maxHeight === undefined ? undefined : { maxHeight }}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n onPointerDown={() => {\n pointerDown.current = true;\n if (focus === \"keyboard\") setFocus(\"pointer\");\n }}\n >\n {options.map((item, groupIndex) =>\n isGroup(item) ? (\n <div key={`group-${item.label}-${groupIndex}`} role=\"group\" aria-label={item.label} className=\"ow-listbox__group\">\n <div className=\"ow-listbox__group-label\" aria-hidden=\"true\">\n {item.label}\n </div>\n {item.options.map(renderOption)}\n </div>\n ) : (\n renderOption(item)\n ),\n )}\n {isEmpty ? (\n // A listbox holds options, so an empty one says so with one that can't be chosen.\n <div id={emptyId} className=\"ow-listbox__empty\" role=\"option\" aria-disabled=\"true\" aria-selected=\"false\">\n {emptyMessage}\n </div>\n ) : null}\n </div>\n );\n}\n\nconst ForwardedListBox = /* @__PURE__ */ Object.assign(/* @__PURE__ */ forwardRef(ListBoxWithRef), { displayName: \"ListBox\" });\n\n// forwardRef drops the generic that ties `value` and `onChange` to `selectionMode`, so the cast puts it back.\n/**\n * Select's list of options on its own: a choice that stays on the page. `selectionMode=\"multiple\"` makes `value` an array.\n */\nexport const ListBox = ForwardedListBox as <Mode extends ListBoxSelectionMode = \"single\">(\n props: ListBoxModeProps<Mode> & RefAttributes<HTMLDivElement>,\n) => ReactElement | null;\n", "import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { CheckIcon, ChevronDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface ComboboxOption {\n value: string;\n /** The text shown and matched. */\n label: string;\n /** A muted line under the label; also matched. */\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface ComboboxProps {\n options: ComboboxOption[];\n /** The chosen option's value, or \"\" for none. */\n value?: string;\n /** @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** Called as the person types, to load options from a server. */\n onInputChange?(text: string): void;\n /** @default \"Search\u2026\" */\n placeholder?: string;\n /** Shown when nothing matches.\n * @default \"No matches\" */\n emptyMessage?: ReactNode;\n /** Keep what was typed even if it isn't an option; onChange gets the text.\n * @default false */\n allowCustomValue?: boolean;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default false */\n isInvalid?: boolean;\n disabled?: boolean;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n className?: string;\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A text field that suggests options as you type: pick a country, a repository, a person.\n * Down opens the list, Up and Down move, Enter picks, Escape closes then clears.\n */\nexport const Combobox = /* @__PURE__ */ forwardRef<HTMLInputElement, ComboboxProps>(function Combobox(\n {\n options,\n value,\n defaultValue = \"\",\n onChange,\n onInputChange,\n placeholder = \"Search\u2026\",\n emptyMessage = \"No matches\",\n allowCustomValue = false,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n ...aria\n },\n ref,\n) {\n const [selected, setSelected] = useControllableState(value, defaultValue, onChange);\n const labelOf = (v: string) => options.find((option) => option.value === v)?.label ?? (allowCustomValue ? v : \"\");\n const [text, setText] = useState(() => labelOf(selected));\n const [isOpen, setOpen] = useState(false);\n const [typed, setTyped] = useState(false);\n const [active, setActive] = useState(-1);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const fieldRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const listId = useId();\n const optionId = (index: number) => `${listId}-${index}`;\n\n const results = useMemo(() => {\n const query = text.trim().toLowerCase();\n if (!typed || !query) return options;\n return options.filter(\n (option) =>\n option.label.toLowerCase().includes(query) ||\n (typeof option.description === \"string\" && option.description.toLowerCase().includes(query)),\n );\n }, [options, text, typed]);\n\n // Show the chosen option's label when the value changes from outside.\n useEffect(() => {\n if (!isOpen) setText(labelOf(selected));\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only when the value or options change.\n }, [selected, options]);\n\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: fieldRef, floatingRef: listRef, matchWidth: true, maxHeight: 288 });\n\n function open() {\n if (disabled || isOpen) return;\n setOpen(true);\n const index = results.findIndex((option) => option.value === selected);\n setActive(index >= 0 ? index : results.findIndex((option) => !option.disabled));\n }\n\n function close(restore = true) {\n setOpen(false);\n setTyped(false);\n if (!restore) return;\n if (allowCustomValue) {\n if (text !== labelOf(selected)) {\n const match = options.find((option) => option.label.toLowerCase() === text.trim().toLowerCase());\n setSelected(match ? match.value : text);\n }\n } else if (text.trim() === \"\") setSelected(\"\");\n else setText(labelOf(selected));\n }\n\n useDismiss(isOpen, [fieldRef, listRef], () => close());\n\n function choose(option: ComboboxOption | undefined) {\n if (!option || option.disabled) return;\n setSelected(option.value);\n setText(option.label);\n setOpen(false);\n setTyped(false);\n }\n\n function move(step: 1 | -1) {\n if (!results.length) return;\n let next = active;\n for (let tries = 0; tries < results.length; tries += 1) {\n next = (next + step + results.length) % results.length;\n if (!results[next]!.disabled) break;\n }\n setActive(next);\n }\n\n useEffect(() => {\n if (isOpen && active >= 0) document.getElementById(optionId(active))?.scrollIntoView({ block: \"nearest\" });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- optionId is stable.\n }, [active, isOpen]);\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!isOpen) open();\n else move(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n if (!isOpen) open();\n else move(-1);\n break;\n case \"Enter\":\n if (isOpen && active >= 0) {\n event.preventDefault();\n choose(results[active]);\n } else if (isOpen) close();\n break;\n case \"Escape\":\n if (isOpen) return; // useDismiss closes it.\n if (text) {\n event.preventDefault();\n setText(\"\");\n setSelected(\"\");\n }\n break;\n case \"Tab\":\n if (isOpen) close();\n break;\n }\n }\n\n return (\n <>\n <div\n ref={fieldRef}\n className={cx(\n \"ow-input-group\",\n \"ow-combobox\",\n size === \"sm\" && \"ow-input-group--sm\",\n isInvalid && \"ow-input-group--invalid\",\n disabled && \"ow-input-group--disabled\",\n className,\n )}\n >\n <input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n className=\"ow-input-group__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && active >= 0 ? optionId(active) : undefined}\n aria-invalid={isInvalid || undefined}\n autoComplete=\"off\"\n disabled={disabled}\n placeholder={placeholder}\n value={text}\n onChange={(event) => {\n setText(event.target.value);\n setTyped(true);\n onInputChange?.(event.target.value);\n if (!isOpen) setOpen(true);\n setActive(0);\n }}\n onClick={open}\n onKeyDown={onKeyDown}\n {...aria}\n />\n <button\n type=\"button\"\n className=\"ow-combobox__toggle\"\n tabIndex={-1}\n aria-label={isOpen ? \"Hide options\" : \"Show options\"}\n disabled={disabled}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n if (isOpen) close();\n else {\n open();\n inputRef.current?.focus();\n }\n }}\n >\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className={cx(\"ow-select__chevron\", isOpen && \"ow-combobox__chevron--open\")} />\n </button>\n </div>\n {mounted ? (\n <div\n ref={listRef}\n {...manualPopover}\n data-state={state}\n id={listId}\n role=\"listbox\"\n aria-label={aria[\"aria-label\"]}\n aria-labelledby={aria[\"aria-labelledby\"]}\n className={cx(\"ow-listbox\", \"ow-floating\", `ow-listbox--${size}`)}\n style={style}\n >\n {results.map((option, index) => {\n const isSelected = option.value === selected;\n return (\n <div\n key={option.value}\n id={optionId(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled || undefined}\n className={cx(\"ow-option\", {\n \"ow-option--active\": index === active && !option.disabled,\n \"ow-option--selected\": isSelected,\n \"ow-option--disabled\": Boolean(option.disabled),\n })}\n onPointerMove={() => !option.disabled && setActive(index)}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => choose(option)}\n >\n <span className=\"ow-option__check\">{isSelected ? <CheckIcon size={14} /> : null}</span>\n <span className=\"ow-option__text\">\n <span className=\"ow-option__label\">{option.label}</span>\n {option.description ? (\n <span className=\"ow-option__description\">{option.description}</span>\n ) : null}\n </span>\n </div>\n );\n })}\n {results.length === 0 ? (\n <div className=\"ow-listbox__empty\" role=\"presentation\">\n {emptyMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </>\n );\n});\n", "import { createContext, useContext, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { Fieldset } from \"../Checkbox/Checkbox\";\n\ninterface RadioGroupContextValue {\n name: string;\n value: string;\n select(value: string): void;\n disabled: boolean;\n}\n\nconst RadioGroupContext = /* @__PURE__ */ createContext<RadioGroupContextValue | null>(null);\n\nexport interface RadioGroupProps {\n /** The question, shown as the group's legend. */\n label: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n value?: string;\n /** The starting choice when uncontrolled.\n * @default \"\" */\n defaultValue?: string;\n onChange?(value: string): void;\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** `default` is a dot and a label; `cards` turns each option into a bordered card, for choices that need a description.\n * @default \"default\" */\n variant?: \"default\" | \"cards\";\n /** An error under the options. */\n error?: ReactNode;\n disabled?: boolean;\n /** The form field name. Generated when left out. */\n name?: string;\n /** Radio options. */\n children: ReactNode;\n className?: string;\n}\n\n/** One choice from a few visible options. The arrow keys move between them, as with any radio group. */\nexport function RadioGroup({\n label,\n description,\n value,\n defaultValue = \"\",\n onChange,\n orientation = \"vertical\",\n variant = \"default\",\n error,\n disabled = false,\n name,\n children,\n className,\n}: RadioGroupProps) {\n const [current, select] = useControllableState(value, defaultValue, onChange);\n const generatedName = useId();\n return (\n <RadioGroupContext.Provider value={{ name: name ?? generatedName, value: current, select, disabled }}>\n <Fieldset\n legend={label}\n description={description}\n error={error}\n className={cx(\n \"ow-radio-group\",\n orientation === \"horizontal\" && \"ow-fieldset--horizontal\",\n variant === \"cards\" && \"ow-radio-group--cards\",\n className,\n )}\n >\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"value\" | \"size\"> {\n value: string;\n /** The label. */\n children: ReactNode;\n /** A muted line under the label. */\n description?: ReactNode;\n}\n\n/** One option in a RadioGroup. */\nexport function Radio({ value, children, description, disabled, className, ...inputProps }: RadioProps) {\n const group = useContext(RadioGroupContext);\n const descriptionId = useId();\n if (!group) throw new Error(\"Radio must be inside <RadioGroup>.\");\n const isDisabled = disabled || group.disabled;\n return (\n <label className={cx(\"ow-check-label\", \"ow-radio-label\", isDisabled && \"ow-check-label--disabled\", className)}>\n <span className=\"ow-radio\">\n <input\n type=\"radio\"\n className=\"ow-radio__input\"\n name={group.name}\n value={value}\n checked={group.value === value}\n disabled={isDisabled}\n aria-describedby={description ? descriptionId : undefined}\n onChange={() => group.select(value)}\n {...inputProps}\n />\n </span>\n <span className=\"ow-check-label__text\">\n <span>{children}</span>\n {description ? (\n <span id={descriptionId} className=\"ow-check-label__description\">\n {description}\n </span>\n ) : null}\n </span>\n </label>\n );\n}\n", "import { forwardRef, type ButtonHTMLAttributes } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onChange\" | \"value\" | \"type\" | \"role\"> {\n checked: boolean;\n onChange(checked: boolean): void;\n /** What it turns on, for screen readers. Leave it out only when aria-labelledby names it. */\n label?: string;\n}\n\n/** A small on/off switch for settings rows; it takes effect at once, with no save button. */\nexport const Switch = /* @__PURE__ */ forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n { checked, onChange, label, className, disabled, ...buttonProps },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={label}\n disabled={disabled}\n className={cx(\"ow-switch\", checked && \"ow-switch--on\", className)}\n onClick={() => onChange(!checked)}\n {...buttonProps}\n >\n <span className=\"ow-switch__knob\" />\n </button>\n );\n});\n", "import { useId, type CSSProperties, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\n\ntype SliderValue = number | [number, number];\n\nexport interface SliderProps<V extends SliderValue = number> {\n /** A number, or a [low, high] pair for a range with two handles. */\n value?: V;\n defaultValue?: V;\n onChange?(value: NoInfer<V>): void;\n /** Called when the person lets go, for work too slow to do on every move. */\n onChangeEnd?(value: NoInfer<V>): void;\n /** @default 0 */\n min?: number;\n /** @default 100 */\n max?: number;\n /** @default 1 */\n step?: number;\n /** Shown above the track, and names the slider for screen readers. */\n label?: ReactNode;\n /** Shows the current value at the right of the label.\n * @default true */\n showValue?: boolean;\n /** Turns a number into the text shown and read out, e.g. (v) => `${v}%`. */\n formatValue?(value: number): string;\n /** Names the slider when there's no visible label. */\n \"aria-label\"?: string;\n /** Names the slider by another element's id, such as a Field's label. */\n \"aria-labelledby\"?: string;\n /** Ids of the hint or error that describe it; Field sets this. */\n \"aria-describedby\"?: string;\n /** The id of the (first) handle's input, so a Field's label points at it; Field sets this. */\n id?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Picks a number, or a range, by dragging. It's built on native range inputs, so the arrow keys,\n * PageUp, PageDown, Home and End work as people expect.\n */\nexport function Slider<V extends SliderValue = number>({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n min = 0,\n max = 100,\n step = 1,\n label,\n showValue = true,\n formatValue = String,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n disabled,\n className,\n}: SliderProps<V>) {\n const [current, setCurrent] = useControllableState<V>(value, (defaultValue ?? min) as V, onChange);\n const labelId = useId();\n const isRange = Array.isArray(current);\n const [low, high] = isRange ? (current as [number, number]) : [min, current as number];\n const pct = (n: number) => ((n - min) / (max - min || 1)) * 100;\n const style = { \"--ow-slider-from\": `${isRange ? pct(low) : 0}%`, \"--ow-slider-to\": `${pct(high)}%` } as CSSProperties;\n const display = isRange ? `${formatValue(low)} \u2013 ${formatValue(high)}` : formatValue(high);\n const end = () => onChangeEnd?.(current);\n\n const input = (which: \"low\" | \"high\") => {\n const own = which === \"low\" ? low : high;\n return (\n <input\n type=\"range\"\n className={cx(\"ow-slider__input\", isRange && `ow-slider__input--${which}`)}\n // When the handles meet near the top, the low one must be on top to be draggable back down.\n style={which === \"low\" && low === high && pct(low) > 50 ? { zIndex: 3 } : undefined}\n min={min}\n max={max}\n step={step}\n value={own}\n disabled={disabled}\n id={which === (isRange ? \"low\" : \"high\") ? id : undefined}\n aria-describedby={ariaDescribedBy}\n aria-labelledby={label ? labelId : ariaLabelledBy}\n aria-label={label ? undefined : isRange ? `${ariaLabel ?? \"Range\"}, ${which === \"low\" ? \"minimum\" : \"maximum\"}` : ariaLabel}\n aria-valuetext={formatValue(own)}\n onChange={(event) => {\n const n = Number(event.target.value);\n if (!isRange) setCurrent(n as V);\n else if (which === \"low\") setCurrent([Math.min(n, high), high] as V);\n else setCurrent([low, Math.max(n, low)] as V);\n }}\n onPointerUp={end}\n onKeyUp={end}\n />\n );\n };\n\n return (\n <div className={cx(\"ow-slider\", disabled && \"ow-slider--disabled\", className)}>\n {label || showValue ? (\n <div className=\"ow-slider__header\">\n {label ? (\n <span id={labelId} className=\"ow-slider__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? (\n <output className=\"ow-slider__value\" aria-hidden=\"true\">\n {display}\n </output>\n ) : null}\n </div>\n ) : null}\n <div className=\"ow-slider__control\" style={style}>\n <span className=\"ow-slider__track\" aria-hidden=\"true\">\n <span className=\"ow-slider__fill\" />\n </span>\n {isRange ? input(\"low\") : null}\n {input(\"high\")}\n </div>\n </div>\n );\n}\n", "import { useEffect, useId, useRef, useState, type DragEvent, type ReactNode } from \"react\";\n\nimport { UploadIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface FileDropZoneProps {\n /** Called with the accepted files, whether dropped or picked. */\n onFiles(files: File[]): void;\n /** File types to accept, as for <input accept>: \".png,.jpg\", \"image/*\". */\n accept?: string;\n /** @default false */\n multiple?: boolean;\n /** The largest file accepted, in bytes. */\n maxSize?: number;\n /** @default \"Drop files here, or browse\" */\n label?: ReactNode;\n /** A muted line under the label: what's accepted, how big. */\n hint?: ReactNode;\n /** An error to show in place of the hint, such as a failed upload. */\n error?: ReactNode;\n /** A 20px icon on the tile.\n * @default <UploadIcon /> */\n icon?: ReactNode;\n disabled?: boolean;\n /** The form field name for the file input. A form submits the files from the last accepted pick or drop. */\n name?: string;\n className?: string;\n}\n\nfunction matches(file: File, accept: string | undefined) {\n if (!accept) return true;\n return accept.split(\",\").some((rule) => {\n const pattern = rule.trim().toLowerCase();\n if (!pattern) return false;\n if (pattern.startsWith(\".\")) return file.name.toLowerCase().endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return file.type.toLowerCase().startsWith(pattern.slice(0, -1));\n return file.type.toLowerCase() === pattern;\n });\n}\n\nconst formatSize = (bytes: number) =>\n bytes >= 1_048_576 ? `${Math.round(bytes / 104_857.6) / 10} MB` : `${Math.round(bytes / 1024)} KB`;\n\n/**\n * A drop zone for files: drop them on it, or press it to pick them.\n * It checks the type and size and says what was wrong.\n */\nexport function FileDropZone({\n onFiles,\n accept,\n multiple = false,\n maxSize,\n label = \"Drop files here, or browse\",\n hint,\n error,\n icon,\n disabled = false,\n name,\n className,\n}: FileDropZoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const depth = useRef(0);\n const [isDragging, setIsDragging] = useState(false);\n const [problem, setProblem] = useState<string>();\n const hintId = useId();\n // The files a form will submit: the last accepted pick or drop, put back in the input after each change.\n const kept = useRef<File[]>([]);\n\n function keep(files: File[]) {\n kept.current = files;\n const input = inputRef.current;\n if (!input) return;\n try {\n const transfer = new DataTransfer();\n files.forEach((file) => transfer.items.add(file));\n input.files = transfer.files;\n } catch {\n // Browsers without a DataTransfer constructor: the files still reach onFiles, just not a plain form post.\n }\n }\n\n // The input is emptied as the picker opens, so choosing the same file again still counts as a change;\n // closing the picker without choosing puts the kept files back.\n useEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n const restore = () => keep(kept.current);\n input.addEventListener(\"cancel\", restore);\n return () => input.removeEventListener(\"cancel\", restore);\n }, []);\n\n function take(list: FileList | null) {\n if (!list || disabled) return;\n const files = [...list].slice(0, multiple ? undefined : 1);\n const wrongType = files.find((file) => !matches(file, accept));\n const tooBig = maxSize ? files.find((file) => file.size > maxSize) : undefined;\n if (!multiple && list.length > 1) setProblem(\"Drop one file at a time.\");\n else if (wrongType) setProblem(`\u201C${wrongType.name}\u201D isn't a file this accepts.`);\n else if (tooBig && maxSize) setProblem(`\u201C${tooBig.name}\u201D is over ${formatSize(maxSize)}.`);\n else {\n setProblem(undefined);\n if (files.length) {\n keep(files);\n onFiles(files);\n return;\n }\n }\n keep(kept.current);\n }\n\n const hasFiles = (event: DragEvent) => event.dataTransfer.types.includes(\"Files\");\n\n return (\n <label\n className={cx(\n \"ow-dropzone\",\n isDragging && \"ow-dropzone--dragging\",\n Boolean(error || problem) && \"ow-dropzone--invalid\",\n disabled && \"ow-dropzone--disabled\",\n className,\n )}\n onDragEnter={(event) => {\n if (!hasFiles(event) || disabled) return;\n event.preventDefault();\n depth.current += 1;\n setIsDragging(true);\n }}\n onDragOver={(event) => {\n if (!hasFiles(event) || disabled) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }}\n onDragLeave={() => {\n depth.current = Math.max(0, depth.current - 1);\n if (depth.current === 0) setIsDragging(false);\n }}\n onDrop={(event) => {\n if (!hasFiles(event)) return;\n event.preventDefault();\n depth.current = 0;\n setIsDragging(false);\n take(event.dataTransfer.files);\n }}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className=\"ow-visually-hidden\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n name={name}\n aria-describedby={hintId}\n onClick={(event) => {\n event.currentTarget.value = \"\";\n }}\n onChange={(event) => take(event.target.files)}\n />\n <span className=\"ow-dropzone__icon\">{icon ?? <UploadIcon size={20} />}</span>\n <span className=\"ow-dropzone__label\">{isDragging ? \"Drop to add\" : label}</span>\n <span id={hintId} className=\"ow-dropzone__hint\" aria-live=\"polite\">\n {error ?? problem ?? hint}\n </span>\n </label>\n );\n}\n", "import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, type KeyboardEvent, type Ref } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { addDays, addMonths, clampDate, formatDate, monthIndex, monthWeeks, parseISO, startOfMonth, todayISO, toISO, weekday, type ISODate } from \"./dates\";\n\nexport interface CalendarProps {\n /** The chosen date as \"YYYY-MM-DD\", or \"\" for none. */\n value?: ISODate;\n /** @default \"\" */\n defaultValue?: ISODate;\n onChange?(value: ISODate): void;\n /** The earliest date that can be chosen, \"YYYY-MM-DD\". */\n min?: ISODate;\n /** The latest date that can be chosen. */\n max?: ISODate;\n /** Return true for dates that can't be chosen, such as weekends. */\n isDateDisabled?(date: ISODate): boolean;\n /** Month and day names follow this locale, e.g. \"en-IE\", \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** 1 starts weeks on Monday, 0 on Sunday.\n * @default 1 */\n weekStartsOn?: 0 | 1;\n /** Focus the chosen (or today's) date on mount, for use in a popover.\n * @default false */\n autoFocus?: boolean;\n className?: string;\n}\n\nexport interface CalendarHandle {\n focus(): void;\n}\n\n/**\n * A month grid for picking a date. Arrow keys move by day and week, PageUp and PageDown by month\n * (with Shift, by year), Home and End to the week's ends. Today is marked with a brass dot.\n */\nexport const Calendar = /* @__PURE__ */ forwardRef<CalendarHandle, CalendarProps>(function Calendar(\n { value, defaultValue = \"\", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className },\n ref,\n) {\n const [selected, setSelected] = useControllableState(value, defaultValue, onChange);\n const today = todayISO();\n const [focused, setFocused] = useState<ISODate>(() => selected || clampDate(today, min, max));\n const [shouldFocus, setShouldFocus] = useState(autoFocus);\n const gridRef = useRef<HTMLTableElement>(null);\n\n useImperativeHandle(ref, () => ({ focus: () => setShouldFocus(true) }), []);\n\n useEffect(() => {\n if (selected) setFocused(selected);\n }, [selected]);\n\n const focusFrame = useRef(0);\n useEffect(() => {\n if (!shouldFocus) return;\n setShouldFocus(false);\n const focusDay = () => gridRef.current?.querySelector<HTMLButtonElement>('button[tabindex=\"0\"]')?.focus();\n focusDay();\n // A popover (DatePicker's) is hidden for its first frame while it's placed, and can't take focus until it shows.\n if (!gridRef.current?.contains(document.activeElement)) focusFrame.current = requestAnimationFrame(focusDay);\n }, [shouldFocus, focused]);\n useEffect(() => () => cancelAnimationFrame(focusFrame.current), []);\n\n const { year, month } = parseISO(focused);\n const first = toISO(year, month, 1);\n const slide = useSlide(monthIndex(first));\n\n const isDisabled = (date: ISODate) => (min !== undefined && date < min) || (max !== undefined && date > max) || Boolean(isDateDisabled?.(date));\n\n function moveTo(date: ISODate) {\n setFocused(clampDate(date, min, max));\n setShouldFocus(true);\n }\n\n function choose(date: ISODate) {\n if (isDisabled(date)) return;\n setSelected(date);\n setFocused(date);\n }\n\n return (\n <div className={cx(\"ow-calendar\", className)}>\n <MonthHeader\n month={first}\n locale={locale}\n slide={slide}\n previous={{ disabled: !canShowBefore(first, min), onClick: () => setFocused(clampDate(addMonths(focused, -1), min, max)) }}\n next={{ disabled: !canShowAfter(first, max), onClick: () => setFocused(clampDate(addMonths(focused, 1), min, max)) }}\n />\n <MonthGrid\n gridRef={gridRef}\n month={first}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n slide={slide}\n isDisabled={isDisabled}\n isSelected={(date) => date === selected}\n isFilled={(date) => date === selected}\n onChoose={choose}\n onDayKeyDown={(event, date) => {\n const target = dateForKey(event, date, weekStartsOn);\n if (target === undefined) return;\n event.preventDefault();\n moveTo(target);\n }}\n onDayFocus={(date) => date !== focused && setFocused(date)}\n />\n </div>\n );\n});\n\n// The pieces below are shared with RangeCalendar, which shows the same month grid.\n\n/** Whether the month before `first` has a day on or after `min`. */\nexport function canShowBefore(first: ISODate, min: ISODate | undefined): boolean {\n return !min || addDays(first, -1) >= min;\n}\n\n/** Whether the month after `last` (the first of the last month shown) has a day on or before `max`. */\nexport function canShowAfter(last: ISODate, max: ISODate | undefined): boolean {\n return !max || addMonths(last, 1) <= max;\n}\n\n/** Where a key moves the focus from `date`: a day, a week, the week's ends, a month (with Shift, a year). */\nexport function dateForKey(event: KeyboardEvent<HTMLElement>, date: ISODate, weekStartsOn: 0 | 1): ISODate | undefined {\n const day = (weekday(date) - weekStartsOn + 7) % 7;\n const moves: Record<string, () => ISODate> = {\n ArrowLeft: () => addDays(date, -1),\n ArrowRight: () => addDays(date, 1),\n ArrowUp: () => addDays(date, -7),\n ArrowDown: () => addDays(date, 7),\n Home: () => addDays(date, -day),\n End: () => addDays(date, 6 - day),\n PageUp: () => addMonths(date, event.shiftKey ? -12 : -1),\n PageDown: () => addMonths(date, event.shiftKey ? 12 : 1),\n };\n return moves[event.key]?.();\n}\n\n/** Which way the month changed since the last render, so the new one slides in from that side. */\nexport function useSlide(month: number): \"next\" | \"previous\" | undefined {\n const slide = useRef<{ month: number; direction?: \"next\" | \"previous\" }>({ month });\n if (slide.current.month !== month) {\n slide.current = { month, direction: month > slide.current.month ? \"next\" : \"previous\" };\n }\n return slide.current.direction;\n}\n\ninterface MonthNavButton {\n disabled: boolean;\n onClick(): void;\n}\n\nexport interface MonthHeaderProps {\n /** The first day of the month shown. */\n month: ISODate;\n locale?: string;\n slide?: \"next\" | \"previous\";\n /** The previous-month button, or null for an empty space of the same size. */\n previous: MonthNavButton | null;\n /** The next-month button, or null for an empty space of the same size. */\n next: MonthNavButton | null;\n}\n\n/** The month's name between the previous- and next-month buttons. */\nexport function MonthHeader({ month, locale, slide, previous, next }: MonthHeaderProps) {\n const monthLabel = (date: ISODate) => formatDate(date, locale, { month: \"long\", year: \"numeric\" });\n return (\n <div className=\"ow-calendar__header\">\n {previous ? (\n <button\n type=\"button\"\n className=\"ow-calendar__nav\"\n aria-label={`Previous month, ${monthLabel(addMonths(month, -1))}`}\n disabled={previous.disabled}\n onClick={previous.onClick}\n >\n <ChevronLeftIcon size={16} />\n </button>\n ) : (\n <span className=\"ow-calendar__nav-space\" />\n )}\n <h2 className=\"ow-calendar__title\" aria-live=\"polite\">\n <span key={monthIndex(month)} className={cx(\"ow-calendar__title-text\", slide && `ow-calendar__slide--${slide}`)}>\n {monthLabel(month)}\n </span>\n </h2>\n {next ? (\n <button\n type=\"button\"\n className=\"ow-calendar__nav\"\n aria-label={`Next month, ${monthLabel(addMonths(month, 1))}`}\n disabled={next.disabled}\n onClick={next.onClick}\n >\n <ChevronRightIcon size={16} />\n </button>\n ) : (\n <span className=\"ow-calendar__nav-space\" />\n )}\n </div>\n );\n}\n\nexport interface MonthGridProps {\n /** The first day of the month shown. */\n month: ISODate;\n /** The day that takes Tab focus (roving tabindex). */\n focused: ISODate;\n today: ISODate;\n locale?: string;\n weekStartsOn: 0 | 1;\n slide?: \"next\" | \"previous\";\n /** Leaves the days of the months either side empty, for months shown side by side. */\n hideOutsideDays?: boolean;\n isDisabled(date: ISODate): boolean;\n /** aria-selected on the day's cell. */\n isSelected(date: ISODate): boolean;\n /** Fills the day with the primary colour. */\n isFilled(date: ISODate): boolean;\n /** Extra classes for a day's cell; `column` is 0 to 6 across the week. */\n cellClassName?(date: ISODate, column: number): string | undefined;\n /** Extra classes for a day's button. */\n dayClassName?(date: ISODate): string | undefined;\n /** Extra attributes for a day's button. */\n dayProps?(date: ISODate): { \"aria-describedby\"?: string };\n onChoose(date: ISODate): void;\n onDayKeyDown(event: KeyboardEvent<HTMLButtonElement>, date: ISODate): void;\n onDayFocus(date: ISODate): void;\n onDayPointerEnter?(date: ISODate): void;\n gridRef?: Ref<HTMLTableElement>;\n}\n\n/** One month as a grid of day buttons: six weeks, weekday names above, each day read out in full. */\nexport function MonthGrid({\n month,\n focused,\n today,\n locale,\n weekStartsOn,\n slide,\n hideOutsideDays = false,\n isDisabled,\n isSelected,\n isFilled,\n cellClassName,\n dayClassName,\n dayProps,\n onChoose,\n onDayKeyDown,\n onDayFocus,\n onDayPointerEnter,\n gridRef,\n}: MonthGridProps) {\n const first = startOfMonth(month);\n const { month: monthNumber } = parseISO(first);\n const weeks = useMemo(() => monthWeeks(first, weekStartsOn), [first, weekStartsOn]);\n const weekdayNames = weeks[0]!.map((date) => ({\n short: formatDate(date, locale, { weekday: \"short\" }),\n long: formatDate(date, locale, { weekday: \"long\" }),\n }));\n\n return (\n <table ref={gridRef} role=\"grid\" className=\"ow-calendar__grid\" aria-label={formatDate(first, locale, { month: \"long\", year: \"numeric\" })}>\n <thead>\n <tr>\n {weekdayNames.map((name) => (\n <th key={name.long} scope=\"col\" abbr={name.long} className=\"ow-calendar__weekday\">\n {name.short.slice(0, 2)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody key={monthIndex(first)} className={cx(slide && `ow-calendar__slide--${slide}`)}>\n {weeks.map((week) => (\n <tr key={week[0]}>\n {week.map((date, column) => {\n const inMonth = parseISO(date).month === monthNumber;\n if (!inMonth && hideOutsideDays) return <td key={date} role=\"gridcell\" className=\"ow-calendar__cell\" />;\n const selected = isSelected(date);\n const disabled = isDisabled(date);\n return (\n <td key={date} role=\"gridcell\" aria-selected={selected} className={cx(\"ow-calendar__cell\", cellClassName?.(date, column))}>\n <button\n type=\"button\"\n tabIndex={date === focused ? 0 : -1}\n aria-label={formatDate(date, locale, { dateStyle: \"full\" })}\n aria-current={date === today ? \"date\" : undefined}\n aria-disabled={disabled || undefined}\n {...dayProps?.(date)}\n className={cx(\n \"ow-calendar__day\",\n {\n \"ow-calendar__day--outside\": !inMonth,\n \"ow-calendar__day--selected\": isFilled(date),\n \"ow-calendar__day--today\": date === today,\n \"ow-calendar__day--disabled\": disabled,\n },\n dayClassName?.(date),\n )}\n onClick={() => onChoose(date)}\n onKeyDown={(event) => onDayKeyDown(event, date)}\n // A day from the next or previous month doesn't turn the page when it takes focus from a click,\n // or the button would move out from under the pointer and the click would be lost; choosing it does.\n onFocus={() => inMonth && onDayFocus(date)}\n onPointerEnter={onDayPointerEnter ? () => onDayPointerEnter(date) : undefined}\n >\n {parseISO(date).day}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n", "import { forwardRef, useCallback, useId, useRef, useState, type ForwardedRef } from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { CalendarIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { Calendar, type CalendarProps } from \"./Calendar\";\nimport { formatDate, type ISODate } from \"./dates\";\nimport type { DatePickerProps } from \"./DatePicker.types\";\nexport type { DatePickerProps } from \"./DatePicker.types\";\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A field that opens a Calendar. Choosing a date closes it; Escape closes it without changing anything. */\nexport const DatePicker = /* @__PURE__ */ forwardRef<HTMLButtonElement, DatePickerProps>(function DatePicker(\n {\n value,\n defaultValue = \"\",\n onChange,\n placeholder = \"Pick a date\",\n formatOptions = { dateStyle: \"medium\" },\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n locale,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...calendarProps\n },\n ref,\n) {\n const [date, setDate] = useControllableState<ISODate>(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement: \"bottom-start\", offset: 6 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, triggerRef], close);\n\n const label = date ? formatDate(date, locale, formatOptions) : placeholder;\n\n return (\n <>\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\n \"ow-select\",\n \"ow-date-picker\",\n `ow-select--${size}`,\n { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen },\n className,\n )}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <CalendarIcon size={size === \"sm\" ? 14 : 16} className=\"ow-date-picker__icon\" />\n <span id={`${panelId}-value`} className={cx(\"ow-select__value\", !date && \"ow-select__value--placeholder\")}>\n {label}\n </span>\n </button>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a date\"\n className=\"ow-popover ow-floating ow-date-picker__panel\"\n style={style}\n >\n <Calendar\n {...calendarProps}\n locale={locale}\n value={date}\n autoFocus\n onChange={(next) => {\n setDate(next);\n close();\n }}\n />\n </div>\n ) : null}\n </>\n );\n});\n", "import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { cx } from \"../../utils/cx\";\nimport { canShowAfter, canShowBefore, dateForKey, MonthGrid, MonthHeader, useSlide, type CalendarHandle } from \"./Calendar\";\nimport { addDays, addMonths, clampDate, formatDate, formatDateRange, monthIndex, parseISO, startOfMonth, todayISO, type ISODate } from \"./dates\";\n\n/** A range of days, both ends included, as \"YYYY-MM-DD\". */\nexport interface DateRange {\n start: ISODate;\n end: ISODate;\n}\n\nexport interface RangeCalendarProps {\n /** The chosen range, or null for none. */\n value?: DateRange | null;\n /** @default null */\n defaultValue?: DateRange | null;\n /** Called once both ends are picked, with the earlier day as the start. */\n onChange?(range: DateRange | null): void;\n /** The earliest day either end can be, \"YYYY-MM-DD\". */\n min?: ISODate;\n /** The latest day either end can be. */\n max?: ISODate;\n /** Return true for days that can't be an end of the range, such as weekends. A range can still run across them. */\n isDateDisabled?(date: ISODate): boolean;\n /** Month and day names follow this locale, e.g. \"en-IE\", \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** 1 starts weeks on Monday, 0 on Sunday.\n * @default 1 */\n weekStartsOn?: 0 | 1;\n /** How many months show side by side. Two stack when there isn't room for both.\n * @default 1 */\n visibleMonths?: 1 | 2;\n /** Focus the range's start (or today) on mount, for use in a popover.\n * @default false */\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * Month grids for picking a range of days. The first pick sets the start and the range follows the pointer or the\n * focus until the second pick sets the end; Escape drops a half-picked range. The keys move as in Calendar.\n */\nexport const RangeCalendar = /* @__PURE__ */ forwardRef<CalendarHandle, RangeCalendarProps>(function RangeCalendar(\n { value, defaultValue = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className },\n ref,\n) {\n const months = visibleMonths;\n const [range, setRange] = useControllableState<DateRange | null>(value, defaultValue, onChange);\n const today = todayISO();\n const [focused, setFocused] = useState<ISODate>(() => (range ? ordered(range.start, range.end).start : clampDate(today, min, max)));\n const [firstMonth, setFirstMonth] = useState<ISODate>(() => fitMonths(startOfMonth(focused), months, min, max));\n // The first pick, while the second is still to come.\n const [anchor, setAnchor] = useState<ISODate | null>(null);\n const [hovered, setHovered] = useState<ISODate | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n const [shouldFocus, setShouldFocus] = useState(autoFocus);\n const rootRef = useRef<HTMLDivElement>(null);\n // The range this calendar last picked, so picking it doesn't move the view as a new value from outside does.\n const picked = useRef<DateRange | null>(null);\n const rangeId = useId();\n\n useImperativeHandle(ref, () => ({ focus: () => setShouldFocus(true) }), []);\n\n const start = range?.start;\n const end = range?.end;\n useEffect(() => {\n if (!start || !end || (picked.current?.start === start && picked.current.end === end)) return;\n picked.current = null;\n const first = ordered(start, end).start;\n setAnchor(null);\n setFocused(first);\n setFirstMonth((current) => monthsShowing(first, current, months, min, max));\n // Only a new range from outside moves the view; min and max don't.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [start, end]);\n\n // Going from two months to one (a phone turned upright) keeps the focused day in view.\n useEffect(() => {\n setFirstMonth((current) => monthsShowing(focused, current, months, min, max));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [months]);\n\n const focusFrame = useRef(0);\n useEffect(() => {\n if (!shouldFocus) return;\n setShouldFocus(false);\n const focusDay = () => rootRef.current?.querySelector<HTMLButtonElement>('.ow-calendar__day[tabindex=\"0\"]')?.focus();\n focusDay();\n // A popover is hidden for its first frame while it's placed, and can't take focus until it shows.\n if (!rootRef.current?.contains(document.activeElement)) focusFrame.current = requestAnimationFrame(focusDay);\n }, [shouldFocus, focused, firstMonth]);\n useEffect(() => () => cancelAnimationFrame(focusFrame.current), []);\n\n const isDisabled = (date: ISODate) => (min !== undefined && date < min) || (max !== undefined && date > max) || Boolean(isDateDisabled?.(date));\n\n const shown = anchor ? ordered(anchor, hovered ?? focused) : range ? ordered(range.start, range.end) : null;\n const inShown = (date: ISODate) => Boolean(shown && date >= shown.start && date <= shown.end);\n const slide = useSlide(monthIndex(firstMonth));\n const fullDate = (date: ISODate) => formatDate(date, locale, { dateStyle: \"full\" });\n const fullRange = (dates: DateRange) => formatDateRange(dates.start, dates.end, locale, { dateStyle: \"full\" });\n\n function moveTo(date: ISODate) {\n const next = clampDate(date, min, max);\n setFocused(next);\n setFirstMonth((current) => monthsShowing(next, current, months, min, max));\n setHovered(null);\n setShouldFocus(true);\n }\n\n function showMonths(delta: 1 | -1) {\n const first = addMonths(firstMonth, delta);\n let next = clampDate(addMonths(focused, delta), min, max);\n const offset = monthIndex(next) - monthIndex(first);\n if (offset < 0 || offset >= months) next = clampDate(offset < 0 ? first : addMonths(first, months - 1), min, max);\n setFirstMonth(first);\n setFocused(next);\n }\n\n function choose(date: ISODate) {\n if (isDisabled(date)) return;\n setFocused(date);\n setHovered(null);\n if (!anchor) {\n setAnchor(date);\n setAnnouncement(`Start: ${fullDate(date)}. Pick the end date.`);\n return;\n }\n const next = ordered(anchor, date);\n setAnchor(null);\n picked.current = next;\n setRange(next);\n setAnnouncement(`Selected ${fullRange(next)}`);\n }\n\n function cellClassName(date: ISODate, column: number) {\n if (!shown || shown.start === shown.end || !inShown(date)) return undefined;\n const { day } = parseISO(date);\n // Side by side, a month's first and last days end the band too: the days beyond them are blank.\n const monthStart = months > 1 && day === 1;\n const monthEnd = months > 1 && parseISO(addDays(date, 1)).day === 1;\n return cx(\"ow-range-calendar__cell--in-range\", {\n \"ow-range-calendar__cell--start\": date === shown.start,\n \"ow-range-calendar__cell--end\": date === shown.end,\n \"ow-range-calendar__cell--row-start\": column === 0 || monthStart,\n \"ow-range-calendar__cell--row-end\": column === 6 || monthEnd,\n });\n }\n\n return (\n <div\n ref={rootRef}\n className={cx(\"ow-range-calendar\", className)}\n onPointerLeave={() => setHovered(null)}\n onKeyDown={(event) => {\n if (event.key !== \"Escape\" || !anchor) return;\n // Drop the half-picked range, not the popover or dialog around it.\n event.preventDefault();\n event.stopPropagation();\n setAnchor(null);\n setHovered(null);\n setAnnouncement(range ? `Start date cleared. Selected ${fullRange(ordered(range.start, range.end))}` : \"Start date cleared\");\n }}\n >\n {Array.from({ length: months }, (_, index) => {\n const month = addMonths(firstMonth, index);\n return (\n <div key={index} className=\"ow-calendar ow-range-calendar__month\">\n <MonthHeader\n month={month}\n locale={locale}\n slide={slide}\n previous={index === 0 ? { disabled: !canShowBefore(firstMonth, min), onClick: () => showMonths(-1) } : null}\n next={index === months - 1 ? { disabled: !canShowAfter(month, max), onClick: () => showMonths(1) } : null}\n />\n <MonthGrid\n month={month}\n focused={focused}\n today={today}\n locale={locale}\n weekStartsOn={weekStartsOn}\n slide={slide}\n hideOutsideDays={months > 1}\n isDisabled={isDisabled}\n isSelected={inShown}\n isFilled={(date) => date === shown?.start || date === shown?.end}\n cellClassName={cellClassName}\n dayClassName={(date) =>\n inShown(date) && date !== shown?.start && date !== shown?.end ? \"ow-range-calendar__day--in-range\" : undefined\n }\n dayProps={(date) => (!anchor && range && (date === shown?.start || date === shown?.end) ? { \"aria-describedby\": rangeId } : {})}\n onChoose={choose}\n onDayKeyDown={(event, date) => {\n const target = dateForKey(event, date, weekStartsOn);\n if (target === undefined) return;\n event.preventDefault();\n moveTo(target);\n }}\n onDayFocus={(date) => date !== focused && setFocused(date)}\n onDayPointerEnter={(date) => anchor && !isDisabled(date) && setHovered(date)}\n />\n </div>\n );\n })}\n {range ? (\n <span id={rangeId} hidden>\n {`Selected range: ${fullRange(ordered(range.start, range.end))}`}\n </span>\n ) : null}\n <div className=\"ow-visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </div>\n </div>\n );\n});\n\nfunction ordered(a: ISODate, b: ISODate): DateRange {\n return a <= b ? { start: a, end: b } : { start: b, end: a };\n}\n\n/** Moves the first month shown back so no month wholly after max shows, and forward so none wholly before min does. */\nfunction fitMonths(first: ISODate, months: number, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n let result = first;\n if (max && result > addMonths(startOfMonth(max), 1 - months)) result = addMonths(startOfMonth(max), 1 - months);\n if (min && result < startOfMonth(min)) result = startOfMonth(min);\n return result;\n}\n\n/** The first month to show so that `date` is in view, moving as little as it can from `current`. */\nfunction monthsShowing(date: ISODate, current: ISODate, months: number, min: ISODate | undefined, max: ISODate | undefined): ISODate {\n const offset = monthIndex(date) - monthIndex(current);\n if (offset < 0) return fitMonths(startOfMonth(date), months, min, max);\n if (offset >= months) return fitMonths(addMonths(startOfMonth(date), 1 - months), months, min, max);\n return current;\n}\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { CalendarIcon, CheckIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { CloseButton } from \"@/components/Button/ButtonGroup\";\nimport { formatDateRange } from \"./dates\";\nimport { RangeCalendar, type DateRange, type RangeCalendarProps } from \"./RangeCalendar\";\nimport type { DateRangePickerProps, DateRangePreset } from \"./DateRangePicker.types\";\nexport type { DateRangePickerProps, DateRangePreset } from \"./DateRangePicker.types\";\n\n// Two months and the presets need about 740px; below this, the calendar shows one month.\nconst twoMonthsQuery = \"(min-width: 768px)\";\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\nfunction useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(() => typeof window !== \"undefined\" && Boolean(window.matchMedia?.(query).matches));\n useEffect(() => {\n const list = window.matchMedia?.(query);\n if (!list) return undefined;\n const update = () => setMatches(list.matches);\n update();\n list.addEventListener(\"change\", update);\n return () => list.removeEventListener(\"change\", update);\n }, [query]);\n return matches;\n}\n\n/**\n * A field that opens a two-month RangeCalendar, with optional presets beside it. Picking the second day, or a preset,\n * closes it; Escape closes it without changing anything. Once there's a range, a clear button empties it.\n */\nexport const DateRangePicker = /* @__PURE__ */ forwardRef<HTMLButtonElement, DateRangePickerProps>(function DateRangePicker(\n {\n value,\n defaultValue = null,\n onChange,\n presets,\n visibleMonths = 2,\n placeholder = \"Pick dates\",\n formatOptions = { dateStyle: \"medium\" },\n size = \"md\",\n isInvalid = false,\n disabled = false,\n id,\n className,\n locale,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...calendarProps\n },\n ref,\n) {\n const [range, setRange] = useControllableState<DateRange | null>(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const fieldRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const roomForTwo = useMediaQuery(twoMonthsQuery);\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement: \"bottom-start\", offset: 6, maxHeight: 640 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, fieldRef], close);\n\n useEffect(() => {\n if (disabled) setOpen(false);\n }, [disabled]);\n\n const label = range ? formatDateRange(range.start, range.end, locale, formatOptions) : placeholder;\n\n function onPresetKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n const buttons = Array.from(event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\"button\") ?? []);\n const index = buttons.indexOf(event.currentTarget);\n const moves: Record<string, number> = { ArrowDown: index + 1, ArrowUp: index - 1, Home: 0, End: buttons.length - 1 };\n const target = moves[event.key];\n if (target === undefined) return;\n event.preventDefault();\n buttons[(target + buttons.length) % buttons.length]?.focus();\n }\n\n return (\n <>\n <div\n ref={fieldRef}\n className={cx(\"ow-date-range-picker\", `ow-date-range-picker--${size}`, range && !disabled && \"ow-date-range-picker--clearable\", className)}\n >\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\"ow-select\", \"ow-date-range-picker__trigger\", `ow-select--${size}`, {\n \"ow-select--open\": isOpen,\n \"ow-select--invalid\": isInvalid && !isOpen,\n })}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <CalendarIcon size={size === \"sm\" ? 14 : 16} className=\"ow-date-range-picker__icon\" />\n <span id={`${panelId}-value`} className={cx(\"ow-select__value\", !range && \"ow-select__value--placeholder\")}>\n {label}\n </span>\n </button>\n {range && !disabled ? (\n <CloseButton\n size=\"sm\"\n label=\"Clear dates\"\n className=\"ow-date-range-picker__clear\"\n onClick={() => {\n setRange(null);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n ) : null}\n </div>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose dates\"\n className={cx(\"ow-popover\", \"ow-floating\", \"ow-date-range-picker__panel\")}\n style={style}\n onBlur={(event) => {\n // Tabbing out of the panel closes it, as a click outside does.\n const next = event.relatedTarget as Node | null;\n if (isOpen && next && !panelRef.current?.contains(next)) setOpen(false);\n }}\n >\n {presets?.length ? (\n <div role=\"group\" aria-label=\"Presets\" className=\"ow-date-range-picker__presets\">\n {presets.map((preset) => {\n const isCurrent = range?.start === preset.range.start && range.end === preset.range.end;\n return (\n <button\n key={preset.label}\n type=\"button\"\n aria-current={isCurrent || undefined}\n className={cx(\"ow-date-range-picker__preset\", isCurrent && \"ow-date-range-picker__preset--current\")}\n onKeyDown={onPresetKeyDown}\n onClick={() => {\n setRange(preset.range);\n close();\n }}\n >\n <span className=\"ow-date-range-picker__preset-label\">{preset.label}</span>\n {isCurrent ? <CheckIcon size={14} className=\"ow-date-range-picker__preset-check\" /> : null}\n </button>\n );\n })}\n </div>\n ) : null}\n <RangeCalendar\n {...calendarProps}\n locale={locale}\n value={range}\n visibleMonths={roomForTwo ? visibleMonths : 1}\n autoFocus\n onChange={(next) => {\n setRange(next);\n close();\n }}\n />\n </div>\n ) : null}\n </>\n );\n});\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** `active` is for work in progress, so it isn't confused with `warning` (something needs you). */\nexport type BadgeVariant = \"neutral\" | \"active\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** A 12px icon before the text. */\n icon?: ReactNode;\n /** @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"neutral\" */\n variant?: BadgeVariant;\n}\n\n/** A pill-shaped status label: one or two words, with an optional icon. */\nexport function Badge({ children, className, icon, size = \"md\", variant = \"neutral\", ...spanProps }: BadgeProps) {\n return (\n <span className={cx(\"ow-badge\", `ow-badge--${size}`, `ow-badge--${variant}`, className)} {...spanProps}>\n {icon ? <span className=\"ow-badge__icon\">{icon}</span> : null}\n <span>{children}</span>\n </span>\n );\n}\n", "import { useId, type CSSProperties, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport type ProgressTone = \"primary\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ProgressBarProps {\n /** How far along, from 0 to max. Leave out for work of unknown length. */\n value?: number;\n /** @default 100 */\n max?: number;\n /** Shown above the bar, and names it for screen readers. */\n label?: ReactNode;\n /** Shows the value at the right of the label.\n * @default true */\n showValue?: boolean;\n /** The text shown and read out for the value, e.g. \"3 of 8 stages\". Defaults to a percentage. */\n valueLabel?: string;\n /** sm is 4px, for a pipeline bar; md is 8px.\n * @default \"sm\" */\n size?: \"sm\" | \"md\";\n /** @default \"primary\" */\n tone?: ProgressTone;\n \"aria-label\"?: string;\n className?: string;\n}\n\n/** How far a task has got: a thin bar, or a sliding segment when the length isn't known. */\nexport function ProgressBar({\n value,\n max = 100,\n label,\n showValue = true,\n valueLabel,\n size = \"sm\",\n tone = \"primary\",\n \"aria-label\": ariaLabel,\n className,\n}: ProgressBarProps) {\n const labelId = useId();\n const indeterminate = value === undefined;\n const pct = indeterminate ? 0 : Math.min(100, Math.max(0, (value / max) * 100));\n const text = valueLabel ?? `${Math.round(pct)}%`;\n return (\n <div className={cx(\"ow-progress\", `ow-progress--${size}`, `ow-progress--${tone}`, className)}>\n {label || (showValue && !indeterminate) ? (\n <div className=\"ow-progress__header\">\n {label ? (\n <span id={labelId} className=\"ow-progress__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue && !indeterminate ? <span className=\"ow-progress__value\">{text}</span> : null}\n </div>\n ) : null}\n <div\n role=\"progressbar\"\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : ariaLabel}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={indeterminate ? undefined : value}\n aria-valuetext={indeterminate ? undefined : text}\n className={cx(\"ow-progress__track\", indeterminate && \"ow-progress__track--indeterminate\")}\n >\n <div className=\"ow-progress__fill\" style={indeterminate ? undefined : { width: `${pct}%` }} />\n </div>\n </div>\n );\n}\n\nexport interface ProgressCircleProps {\n /** From 0 to max. Leave out to spin, for work of unknown length. */\n value?: number;\n /** @default 100 */\n max?: number;\n /** sm 16px, md 24px, lg 48px (lg shows the percentage inside).\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"primary\" */\n tone?: ProgressTone;\n /** Names it for screen readers.\n * @default \"Progress\" */\n \"aria-label\"?: string;\n className?: string;\n}\n\nconst circleSizes = { sm: { box: 16, stroke: 2.5 }, md: { box: 24, stroke: 3 }, lg: { box: 48, stroke: 4 } };\n\n/** Progress as a ring, for tight spaces: a row in a list, a file being uploaded. */\nexport function ProgressCircle({\n value,\n max = 100,\n size = \"md\",\n tone = \"primary\",\n \"aria-label\": ariaLabel = \"Progress\",\n className,\n}: ProgressCircleProps) {\n const { box, stroke } = circleSizes[size];\n const radius = (box - stroke) / 2;\n const circumference = 2 * Math.PI * radius;\n const indeterminate = value === undefined;\n const pct = indeterminate ? 25 : Math.min(100, Math.max(0, (value / max) * 100));\n return (\n <span\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={indeterminate ? undefined : value}\n className={cx(\n \"ow-progress-circle\",\n `ow-progress--${tone}`,\n indeterminate && \"ow-progress-circle--indeterminate\",\n className,\n )}\n style={{ width: box, height: box } as CSSProperties}\n >\n <svg width={box} height={box} viewBox={`0 0 ${box} ${box}`} aria-hidden=\"true\">\n <circle className=\"ow-progress-circle__track\" cx={box / 2} cy={box / 2} r={radius} strokeWidth={stroke} fill=\"none\" />\n <circle\n className=\"ow-progress-circle__fill\"\n cx={box / 2}\n cy={box / 2}\n r={radius}\n strokeWidth={stroke}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={circumference * (1 - pct / 100)}\n transform={`rotate(-90 ${box / 2} ${box / 2})`}\n />\n </svg>\n {size === \"lg\" && !indeterminate ? <span className=\"ow-progress-circle__value\">{Math.round(pct)}%</span> : null}\n </span>\n );\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport type { ProgressTone } from \"../Progress/Progress\";\n\nexport interface MeterProps {\n /** The amount measured, from min to max. */\n value: number;\n /** @default 0 */\n min?: number;\n /** @default 100 */\n max?: number;\n /** Shown above the bar, and names it for screen readers. */\n label?: ReactNode;\n /** Shows the value label at the right of the label.\n * @default true */\n showValue?: boolean;\n /**\n * The text shown and read out for the value: a string (\"Strong\"), or a function given the value, min and max\n * formatted with `formatOptions`, such as `({ value, max }) => \\`${value} of ${max}\\``. Defaults to the formatted value.\n */\n valueLabel?: string | ((formatted: { value: string; min: string; max: string }) => string);\n /**\n * How the value is written, as Intl.NumberFormat options. The percent style shows where the value sits in the range;\n * any other formats the value itself, such as `{ style: \"unit\", unit: \"gigabyte\" }`.\n * @default { style: \"percent\" }\n */\n formatOptions?: Intl.NumberFormatOptions;\n /** The locale numbers are written in, such as \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** The fill's colour. Leave it out to work it out from `low`, `high` and `optimum`; with none of those, it's primary. */\n tone?: ProgressTone;\n /** Values below this are in the low range, as on the meter element.\n * @default min */\n low?: number;\n /** Values above this are in the high range.\n * @default max */\n high?: number;\n /**\n * The best value. The range it's in is good (success), the middle range otherwise middling (warning), and the range\n * at the far end bad (danger). With optimum between low and high, both outer ranges are middling.\n * @default halfway between min and max\n */\n optimum?: number;\n /** sm is 4px; md is 8px.\n * @default \"sm\" */\n size?: \"sm\" | \"md\";\n /** Draws the bar as this many separate blocks, such as 4 for a password's strength. */\n segments?: number;\n id?: string;\n /** Names the meter for screen readers when there's no `label`. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n className?: string;\n}\n\nconst clamp = (value: number, low: number, high: number) => Math.min(high, Math.max(low, value));\n\n/** The meter element's gauge regions: the optimum's region is good, its neighbour middling, the far one bad. */\nfunction toneOf(value: number, min: number, max: number, low = min, high = max, optimum = (min + max) / 2): ProgressTone {\n const lowEdge = clamp(low, min, max);\n const highEdge = clamp(high, lowEdge, max);\n const best = clamp(optimum, min, max);\n const region = value < lowEdge ? 0 : value > highEdge ? 2 : 1;\n const bestRegion = best < lowEdge ? 0 : best > highEdge ? 2 : 1;\n const distance = Math.abs(region - bestRegion);\n return distance === 0 ? \"success\" : distance === 1 ? \"warning\" : \"danger\";\n}\n\n/**\n * An amount within a known range: storage used, runs against a plan's limit, a password's strength. Unlike ProgressBar,\n * it doesn't mean something will finish.\n */\nexport function Meter({\n value,\n min = 0,\n max = 100,\n label,\n showValue = true,\n valueLabel,\n formatOptions = { style: \"percent\" },\n locale,\n tone,\n low,\n high,\n optimum,\n size = \"sm\",\n segments,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n}: MeterProps) {\n const labelId = useId();\n const current = clamp(value, min, Math.max(min, max));\n const fraction = max > min ? (current - min) / (max - min) : 0;\n\n const formatter = new Intl.NumberFormat(locale, formatOptions);\n const asPercent = formatOptions.style === \"percent\";\n const formatted = {\n value: formatter.format(asPercent ? fraction : current),\n min: formatter.format(asPercent ? 0 : min),\n max: formatter.format(asPercent ? 1 : max),\n };\n const text = typeof valueLabel === \"function\" ? valueLabel(formatted) : (valueLabel ?? formatted.value);\n\n const hasThresholds = low !== undefined || high !== undefined || optimum !== undefined;\n const resolvedTone = tone ?? (hasThresholds ? toneOf(current, min, max, low, high, optimum) : \"primary\");\n const blocks = segments && segments > 1 ? Math.round(segments) : 0;\n\n return (\n <div className={cx(\"ow-meter\", `ow-meter--${size}`, `ow-meter--${resolvedTone}`, className)}>\n {label || showValue ? (\n <div className=\"ow-meter__header\">\n {label ? (\n <span id={labelId} className=\"ow-meter__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? <span className=\"ow-meter__value\">{text}</span> : null}\n </div>\n ) : null}\n <div\n id={id}\n role=\"meter\"\n aria-labelledby={ariaLabelledBy ?? (label ? labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : ariaLabel}\n aria-describedby={ariaDescribedBy}\n aria-valuenow={current}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={text}\n className={cx(\"ow-meter__track\", blocks > 0 && \"ow-meter__track--segmented\")}\n >\n {blocks > 0 ? (\n Array.from({ length: blocks }, (_, index) => (\n <span key={index} className=\"ow-meter__segment\">\n <span className=\"ow-meter__fill\" style={{ width: `${clamp(fraction * blocks - index, 0, 1) * 100}%` }} />\n </span>\n ))\n ) : (\n <span className=\"ow-meter__fill\" style={{ width: `${fraction * 100}%` }} />\n )}\n </div>\n </div>\n );\n}\n", "import { useEffect, useState, type CSSProperties } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface SkeletonProps {\n /** CSS width, e.g. \"40%\" or 120. Default 100%. */\n width?: CSSProperties[\"width\"];\n /** CSS height. Default 14px. */\n height?: CSSProperties[\"height\"];\n /** The lighter grey, for second lines and control shapes. */\n soft?: boolean;\n /** `bar` has round ends; `block` has the field corners, for control placeholders. */\n shape?: \"bar\" | \"block\";\n className?: string;\n}\n\n/** One grey placeholder bar. Wrap a group of them in something with role=\"status\" and a label. */\nexport function Skeleton({ width = \"100%\", height = 14, soft = false, shape = \"bar\", className }: SkeletonProps) {\n return (\n <span\n className={cx(\"ow-skeleton\", soft && \"ow-skeleton--soft\", shape === \"block\" && \"ow-skeleton--block\", className)}\n style={{ width, height }}\n aria-hidden=\"true\"\n />\n );\n}\n\nexport interface SkeletonRowsProps {\n /** Read out by screen readers while it's showing. Default \"Loading\". */\n label?: string;\n rows?: number;\n /** Waits this long before appearing, so content that loads quickly never flashes it. Default 150. */\n delayMs?: number;\n}\n\n/**\n * A placeholder in the shape of settings rows (a label and description on the left, a control on the right),\n * so a panel keeps its layout while it loads.\n */\nexport function SkeletonRows({ label = \"Loading\", rows = 4, delayMs = 150 }: SkeletonRowsProps) {\n const [isVisible, setIsVisible] = useState(delayMs === 0);\n\n useEffect(() => {\n if (delayMs === 0) return;\n const timer = window.setTimeout(() => setIsVisible(true), delayMs);\n return () => window.clearTimeout(timer);\n }, [delayMs]);\n\n return (\n <div role=\"status\" aria-label={label} aria-busy=\"true\">\n {isVisible ? (\n <div className=\"ow-skeleton-rows\" aria-hidden=\"true\">\n {Array.from({ length: rows }, (_, index) => (\n <div key={index} className=\"ow-skeleton-rows__row\">\n <div className=\"ow-skeleton-rows__text\">\n <Skeleton width={`${28 + ((index * 17) % 22)}%`} height={14} />\n <Skeleton width={`${46 + ((index * 23) % 30)}%`} height={12} soft />\n </div>\n <Skeleton width={96} height={32} soft shape=\"block\" />\n </div>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n", "import { useEffect, useRef } from \"react\";\nimport { Toaster as SonnerToaster, toast, type ExternalToast, type ToasterProps as SonnerToasterProps } from \"sonner\";\n\nimport { manualPopover } from \"../../hooks/useFloating\";\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Spinner } from \"../Spinner/Spinner\";\n\n/**\n * Shows a toast; needs one <Toaster /> on the page. This is sonner's `toast`:\n * `toast(\"Copied\")`, `toast.success(\"Saved\", { description })`, `toast.error(\u2026)`, `toast.warning(\u2026)`, `toast.info(\u2026)`,\n * `toast.loading(\"Deploying\u2026\")`, `toast.promise(save(), { loading, success, error })`, `toast.dismiss(id)`.\n * Pass `action: { label: \"Undo\", onClick }` for a button, and reuse an `id` to replace a toast.\n */\nexport { toast };\n\n/** Everything a toast takes besides its message: description, action, cancel, id, duration, icon, onDismiss\u2026 */\nexport type ToastOptions = ExternalToast;\n\nexport interface ToasterProps {\n /** @default \"bottom-center\" */\n position?: SonnerToasterProps[\"position\"];\n /** Shows every toast in full, instead of a stack that fans out on hover.\n * @default false */\n expand?: boolean;\n /** How many show at once; the rest wait their turn.\n * @default 3 */\n visibleToasts?: number;\n /** Milliseconds before a toast goes. A toast's own `duration` wins; Infinity keeps it until closed.\n * @default 6000 */\n duration?: number;\n /** A \u2715 on each toast.\n * @default true */\n closeButton?: boolean;\n /** Distance from the edge of the window, in pixels.\n * @default 16 */\n offset?: number;\n /** Gap between toasts when the stack is open, in pixels.\n * @default 10 */\n gap?: number;\n /** For a second toaster that only shows toasts sent with the same `toasterId`. */\n id?: string;\n className?: string;\n}\n\nconst icons = {\n success: <CircleCheckIcon size={16} />,\n error: <CircleAlertIcon size={16} />,\n warning: <TriangleAlertIcon size={16} />,\n info: <InfoIcon size={16} />,\n loading: <Spinner size=\"sm\" label=\"\" />,\n close: <XIcon size={12} />,\n};\n\n/**\n * Where toasts appear: sonner's toaster in Openware's look. New toasts stack on top of each other; hovering\n * fans the stack out, a swipe dismisses one, and they pause while hovered or focused. Render one near the\n * root of the app. It keeps itself above modal dialogs, so a toast fired from a dialog shows over it.\n */\nexport function Toaster({\n position = \"bottom-center\",\n expand = false,\n visibleToasts = 3,\n duration = 6000,\n closeButton = true,\n offset = 16,\n gap = 10,\n id,\n className,\n}: ToasterProps) {\n const layerRef = useRef<HTMLDivElement>(null);\n\n // The toaster lives in the browser's top layer, and moves back to the top of it whenever a dialog opens,\n // so modal dialogs and their backdrop never cover it.\n useEffect(() => {\n const layer = layerRef.current;\n if (!layer || typeof layer.showPopover !== \"function\") return undefined;\n const raise = () => {\n try {\n if (layer.matches(\":popover-open\")) layer.hidePopover();\n layer.showPopover();\n } catch {\n // Not connected yet, or no popover support: it still shows as a fixed layer.\n }\n };\n raise();\n const observer = new MutationObserver((records) => {\n if (records.some((record) => record.target instanceof HTMLDialogElement && record.target.open)) raise();\n });\n observer.observe(document.body, { subtree: true, attributes: true, attributeFilter: [\"open\"] });\n return () => observer.disconnect();\n }, []);\n\n return (\n <div ref={layerRef} {...manualPopover} className=\"ow-toaster-layer\">\n <SonnerToaster\n id={id}\n position={position}\n expand={expand}\n visibleToasts={visibleToasts}\n duration={duration}\n closeButton={closeButton}\n offset={offset}\n mobileOffset={offset}\n gap={gap}\n icons={icons}\n className={cx(\"ow-toaster\", className)}\n containerAriaLabel=\"Notifications\"\n toastOptions={{ className: \"ow-toast\" }}\n />\n </div>\n );\n}\n", "import { useId, useState, type FormEvent, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { TrashIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface DialogProps {\n open: boolean;\n /** Called when the person dismisses it (Escape, the backdrop) unless `dismissible` is false. Set `open` to false here. */\n onClose(): void;\n title: ReactNode;\n /** A muted line or two under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Buttons at the bottom right, cancel first, the main action last. */\n actions?: ReactNode;\n /** Pixels. Default 420. */\n width?: number;\n /** False while saving, so Escape and the backdrop can't close it mid-way. Default true. */\n dismissible?: boolean;\n /** Makes the dialog a form; its submit button submits it. */\n onSubmit?(event: FormEvent<HTMLFormElement>): void;\n className?: string;\n}\n\n/**\n * A modal dialog on the native <dialog> element: it traps focus, sits above everything, closes with Escape\n * or a click on the backdrop, and fades and rises in.\n */\nexport function Dialog({\n open,\n onClose,\n title,\n description,\n children,\n actions,\n width = 420,\n dismissible = true,\n onSubmit,\n className,\n}: DialogProps) {\n const titleId = useId();\n const descriptionId = useId();\n const { dialogRef, mounted } = useModalDialog(open, () => {\n if (dismissible) onClose();\n });\n\n if (!mounted) return null;\n\n const body = (\n <>\n <div className=\"ow-dialog__header\">\n <h2 id={titleId} className=\"ow-dialog__title\">\n {title}\n </h2>\n {description ? (\n <div id={descriptionId} className=\"ow-dialog__description\">\n {description}\n </div>\n ) : null}\n </div>\n {children}\n {actions ? <div className=\"ow-dialog__actions\">{actions}</div> : null}\n </>\n );\n\n return (\n <dialog\n ref={dialogRef}\n className={cx(\"ow-dialog\", className)}\n style={{ width: `min(${width}px, calc(100% - 32px))` }}\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n >\n {onSubmit ? (\n <form\n className=\"ow-dialog__body\"\n onSubmit={(event) => {\n event.preventDefault();\n onSubmit(event);\n }}\n >\n {body}\n </form>\n ) : (\n <div className=\"ow-dialog__body\">{body}</div>\n )}\n </dialog>\n );\n}\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onClose(): void;\n title: ReactNode;\n description: ReactNode;\n /** The verb on the confirm button: \"Delete project\", not \"OK\". */\n confirmLabel: string;\n /** Styles the confirm button and icon as a destructive action. */\n destructive?: boolean;\n /** Keeps the confirm button disabled, e.g. until a typed confirmation matches. */\n confirmDisabled?: boolean;\n /** Runs the action. The dialog closes when it resolves and shows the error's message when it throws. */\n onConfirm(): Promise<void> | void;\n /** Extra content between the description and the buttons, such as an option checkbox. */\n children?: ReactNode;\n}\n\n/** Asks before an action: a title, what will happen, Cancel and the action. Cancel has focus first. */\nexport function ConfirmDialog({\n open,\n onClose,\n title,\n description,\n confirmLabel,\n destructive = false,\n confirmDisabled = false,\n onConfirm,\n children,\n}: ConfirmDialogProps) {\n const [isWorking, setIsWorking] = useState(false);\n const [error, setError] = useState(\"\");\n\n async function confirm() {\n setIsWorking(true);\n setError(\"\");\n try {\n await onConfirm();\n onClose();\n } catch (confirmError) {\n setError(\n confirmError instanceof Error && confirmError.message\n ? confirmError.message\n : \"That didn't work. Try again.\",\n );\n } finally {\n setIsWorking(false);\n }\n }\n\n return (\n <Dialog\n open={open}\n onClose={onClose}\n dismissible={!isWorking}\n width={380}\n className=\"ow-dialog--confirm\"\n title={\n <>\n {destructive ? (\n <span className=\"ow-dialog__danger-icon\" aria-hidden=\"true\">\n <TrashIcon size={18} />\n </span>\n ) : null}\n {title}\n </>\n }\n description={description}\n onSubmit={() => {\n if (!confirmDisabled && !isWorking) void confirm();\n }}\n actions={\n <>\n <Button type=\"button\" disabled={isWorking} autoFocus onClick={onClose}>\n Cancel\n </Button>\n <Button\n type=\"submit\"\n variant={destructive ? \"danger\" : \"primary\"}\n disabled={isWorking || confirmDisabled}\n >\n {isWorking ? \"Working\u2026\" : confirmLabel}\n </Button>\n </>\n }\n >\n {children}\n {error ? (\n <span role=\"alert\" className=\"ow-dialog__error\">\n {error}\n </span>\n ) : null}\n </Dialog>\n );\n}\n", "import { useEffect, useRef, useState } from \"react\";\n\n/** Matches the dialog exit transition in dialog.css. */\nconst closeAnimationMs = 160;\n\n/**\n * Shows a <dialog> as a modal while `open` is true, and keeps it mounted long enough for its exit animation\n * once `open` turns false. Escape and a click on the backdrop fire the dialog's `cancel` event; the hook turns\n * that into `onCancel`, so a dialog that must stay open while it works can ignore it.\n */\nexport function useModalDialog(open: boolean, onCancel: () => void) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const onCancelRef = useRef(onCancel);\n const [mounted, setMounted] = useState(open);\n\n onCancelRef.current = onCancel;\n\n useEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open) {\n if (!dialog.open) dialog.showModal();\n return;\n }\n\n if (dialog.open) dialog.close();\n const reduceMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n const timer = window.setTimeout(() => setMounted(false), reduceMotion ? 0 : closeAnimationMs);\n return () => window.clearTimeout(timer);\n }, [open, mounted]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || !mounted) return;\n\n const onCancelEvent = (event: Event) => {\n event.preventDefault();\n onCancelRef.current();\n };\n\n // A click on the backdrop (outside the dialog's box) counts as Escape. Both the press and the release\n // must be outside, so selecting text and dragging out doesn't close it.\n const isOutside = (event: MouseEvent) => {\n const rect = dialog.getBoundingClientRect();\n return (\n event.clientX < rect.left ||\n event.clientX > rect.right ||\n event.clientY < rect.top ||\n event.clientY > rect.bottom\n );\n };\n let pressedOutside = false;\n const onPointerDown = (event: PointerEvent) => {\n pressedOutside = event.target === dialog && isOutside(event);\n };\n const onClick = (event: MouseEvent) => {\n if (\n pressedOutside &&\n event.target === dialog &&\n isOutside(event) &&\n // Clicks from the keyboard (Enter on a button) report 0,0.\n event.detail > 0\n )\n dialog.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\n pressedOutside = false;\n };\n\n dialog.addEventListener(\"cancel\", onCancelEvent);\n dialog.addEventListener(\"pointerdown\", onPointerDown);\n dialog.addEventListener(\"click\", onClick);\n return () => {\n dialog.removeEventListener(\"cancel\", onCancelEvent);\n dialog.removeEventListener(\"pointerdown\", onPointerDown);\n dialog.removeEventListener(\"click\", onClick);\n };\n }, [mounted]);\n\n return { dialogRef, mounted };\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { cx } from \"../../utils/cx\";\nimport { CloseButton } from \"../Button/ButtonGroup\";\n\nexport interface DrawerProps {\n open: boolean;\n /** Called on Escape, the backdrop or the \u2715, unless `dismissible` is false. Set `open` to false here. */\n onClose(): void;\n title: ReactNode;\n /** A muted line under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Buttons pinned to the bottom: Cancel first, the main action last. */\n footer?: ReactNode;\n /** Which edge it slides in from.\n * @default \"right\" */\n side?: \"right\" | \"left\" | \"bottom\";\n /** Width (or height, from the bottom) in pixels.\n * @default 420 */\n size?: number;\n /** @default true */\n dismissible?: boolean;\n className?: string;\n}\n\n/** A panel that slides in from an edge over the page, for details or a form beside what the person was doing. */\nexport function Drawer({\n open,\n onClose,\n title,\n description,\n children,\n footer,\n side = \"right\",\n size = 420,\n dismissible = true,\n className,\n}: DrawerProps) {\n const titleId = useId();\n const descriptionId = useId();\n const { dialogRef, mounted } = useModalDialog(open, () => {\n if (dismissible) onClose();\n });\n\n if (!mounted) return null;\n\n const sizeStyle = side === \"bottom\" ? { height: `min(${size}px, 90dvh)` } : { width: `min(${size}px, 100vw - 24px)` };\n\n return (\n <dialog\n ref={dialogRef}\n className={cx(\"ow-drawer\", `ow-drawer--${side}`, className)}\n style={sizeStyle}\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n >\n <header className=\"ow-drawer__header\">\n <div className=\"ow-drawer__titles\">\n <h2 id={titleId} className=\"ow-drawer__title\">\n {title}\n </h2>\n {description ? (\n <p id={descriptionId} className=\"ow-drawer__description\">\n {description}\n </p>\n ) : null}\n </div>\n {dismissible ? <CloseButton onClick={onClose} /> : null}\n </header>\n <div className=\"ow-drawer__body\">{children}</div>\n {footer ? <footer className=\"ow-drawer__footer\">{footer}</footer> : null}\n </dialog>\n );\n}\n", "import {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useId,\n useRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating, type Placement } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface PopoverProps {\n /** The button that opens it. Popover adds the click handler and aria attributes. */\n trigger: ReactElement;\n children: ReactNode;\n open?: boolean;\n /** @default false */\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /** Where it opens relative to the trigger; it flips when there's no room.\n * @default \"bottom-start\" */\n placement?: Placement;\n /** A heading at the top that also names the popover for screen readers. */\n title?: ReactNode;\n /** Names the popover when there's no title. */\n \"aria-label\"?: string;\n /** Pixels, or any CSS width.\n * @default 280 */\n width?: number | string;\n /** Moves focus into the popover when it opens.\n * @default true */\n autoFocus?: boolean;\n className?: string;\n}\n\n/**\n * A small panel attached to a button, for a few controls or details that don't need a dialog.\n * Escape, a click outside or the trigger closes it, and focus goes back to the trigger.\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen = false,\n onOpenChange,\n placement = \"bottom-start\",\n title,\n \"aria-label\": ariaLabel,\n width = 280,\n autoFocus = true,\n className,\n}: PopoverProps) {\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const triggerRef = useRef<HTMLElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const anchorRef = useRef<HTMLSpanElement>(null);\n const id = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef, floatingRef: panelRef, placement, offset: 8, maxHeight: 640 });\n\n const close = useCallback(\n (reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n },\n [setOpen],\n );\n useDismiss(isOpen, [panelRef, anchorRef], close);\n\n useEffect(() => {\n triggerRef.current = anchorRef.current?.firstElementChild as HTMLElement | null;\n });\n\n useEffect(() => {\n if (!isOpen || !autoFocus) return;\n const frame = requestAnimationFrame(() => {\n const panel = panelRef.current;\n // The first control Tab would reach: not one taken out of the tab order (a radio group's other options), a\n // hidden input or anything disabled, so a group lands on its chosen option.\n const first = panel?.querySelector<HTMLElement>(\n [\n 'input:not([type=\"hidden\"]):not([disabled]):not([tabindex=\"-1\"])',\n 'select:not([disabled]):not([tabindex=\"-1\"])',\n 'textarea:not([disabled]):not([tabindex=\"-1\"])',\n 'button:not([disabled]):not([tabindex=\"-1\"])',\n '[href]:not([tabindex=\"-1\"])',\n '[tabindex]:not([tabindex=\"-1\"])',\n ].join(\", \"),\n );\n (first ?? panel)?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [isOpen, autoFocus]);\n\n const triggerElement = isValidElement<HTMLAttributes<HTMLElement>>(trigger)\n ? cloneElement(trigger, {\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? id : undefined,\n onClick: (event: MouseEvent<HTMLElement>) => {\n trigger.props.onClick?.(event);\n if (!event.defaultPrevented) setOpen(!isOpen);\n },\n })\n : trigger;\n\n return (\n <>\n <span ref={anchorRef} className=\"ow-popover-anchor\">\n {triggerElement}\n </span>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={id}\n role=\"dialog\"\n aria-label={title ? undefined : ariaLabel}\n aria-labelledby={title ? `${id}-title` : undefined}\n tabIndex={-1}\n className={cx(\"ow-popover\", \"ow-floating\", className)}\n style={{ ...style, width }}\n // Focus leaving for anything but the trigger (Tab past the last control) closes it.\n onBlur={(event) => {\n const next = event.relatedTarget as Node | null;\n if (next && !panelRef.current?.contains(next) && !anchorRef.current?.contains(next)) setOpen(false);\n }}\n >\n {title ? (\n <div id={`${id}-title`} className=\"ow-popover__title\">\n {title}\n </div>\n ) : null}\n {children}\n </div>\n ) : null}\n </>\n );\n}\n", "import {\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport { manualPopover, useFloating } from \"../../hooks/useFloating\";\nimport { useMenuKeyboard } from \"../../hooks/useMenuKeyboard\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { cx } from \"../../utils/cx\";\n\nconst MenuContext = /* @__PURE__ */ createContext<{ close(): void } | null>(null);\n\nexport interface MenuProps {\n /** The button that opens it, usually a Button. Menu adds the click handler and the aria attributes. */\n trigger: ReactElement;\n /** MenuItem, MenuLabel and MenuSeparator. */\n children: ReactNode;\n /** Names the menu for screen readers. */\n label: string;\n /** Which edge of the trigger it lines up with.\n * @default \"start\" */\n align?: \"start\" | \"end\";\n /** Prefers opening upward. Either way it flips when there's no room.\n * @default false */\n above?: boolean;\n /** CSS width; default fits the items, at least 200px. */\n width?: number | string;\n /** Starts open, for documentation and tests. */\n defaultOpen?: boolean;\n className?: string;\n}\n\n/**\n * A dropdown menu of actions under a button. Opening it focuses the first item; the arrow keys, Home and End\n * move; Escape closes it and returns focus to the button; a click outside or Tab closes it.\n */\nexport function Menu({ trigger, children, label, align = \"start\", above = false, width, defaultOpen = false, className }: MenuProps) {\n const [open, setOpen] = useState(defaultOpen);\n const rootRef = useRef<HTMLSpanElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const menuId = useId();\n const close = () => setOpen(false);\n const onMenuKeyDown = useMenuKeyboard({ open, menuRef, triggerRef, onClose: close });\n const { mounted, state } = usePresence(open);\n const floatingStyle = useFloating({\n open: mounted,\n anchorRef: rootRef,\n floatingRef: menuRef,\n placement: `${above ? \"top\" : \"bottom\"}-${align}`,\n offset: 8,\n });\n\n useEffect(() => {\n triggerRef.current = rootRef.current?.firstElementChild as HTMLElement | null;\n });\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n if (!rootRef.current?.contains(event.target as Node)) setOpen(false);\n };\n document.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => document.removeEventListener(\"pointerdown\", onPointerDown, true);\n }, [open]);\n\n const triggerElement = isValidElement<ButtonHTMLAttributes<HTMLElement>>(trigger)\n ? cloneElement(trigger, {\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": open,\n \"aria-controls\": open ? menuId : undefined,\n onClick: (event: MouseEvent<HTMLElement>) => {\n trigger.props.onClick?.(event);\n if (!event.defaultPrevented) setOpen((current) => !current);\n },\n })\n : trigger;\n\n return (\n <span ref={rootRef} className=\"ow-menu\">\n {triggerElement}\n {mounted ? (\n <MenuContext.Provider\n value={{\n close() {\n setOpen(false);\n triggerRef.current?.focus();\n },\n }}\n >\n <div\n ref={menuRef}\n {...manualPopover}\n data-state={state}\n id={menuId}\n role=\"menu\"\n aria-label={label}\n className={cx(\"ow-menu__panel\", \"ow-floating\", className)}\n style={width === undefined ? floatingStyle : { ...floatingStyle, width }}\n onKeyDown={onMenuKeyDown}\n >\n {children}\n </div>\n </MenuContext.Provider>\n ) : null}\n </span>\n );\n}\n\nexport interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onSelect\"> {\n /** A 15px lucide-react icon before the label. */\n icon?: ReactNode;\n /** Runs the action; the menu then closes. */\n onSelect?(): void;\n /** Red, for actions that delete or can't be undone. */\n destructive?: boolean;\n /** Shown on the right, e.g. \"\u2318,\". Only a shortcut that actually works. */\n shortcut?: string;\n}\n\n/** One action in a Menu. */\nexport const MenuItem = /* @__PURE__ */ forwardRef<HTMLButtonElement, MenuItemProps>(function MenuItem(\n { icon, onSelect, destructive = false, shortcut, className, children, onClick, ...buttonProps },\n ref,\n) {\n const menu = useContext(MenuContext);\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n className={cx(\"ow-menu__item\", destructive && \"ow-menu__item--destructive\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n menu?.close();\n onSelect?.();\n }}\n {...buttonProps}\n >\n {icon ? <span className=\"ow-menu__icon\">{icon}</span> : null}\n <span className=\"ow-menu__label\">{children}</span>\n {shortcut ? <kbd className=\"ow-menu__shortcut\">{shortcut}</kbd> : null}\n </button>\n );\n});\n\n/** A small uppercase heading for a group of items. */\nexport function MenuLabel({ children }: { children: ReactNode }) {\n return (\n <div className=\"ow-menu__group-label\" role=\"presentation\">\n {children}\n </div>\n );\n}\n\n/** A hairline between groups of items. */\nexport function MenuSeparator() {\n return <div className=\"ow-menu__separator\" role=\"separator\" />;\n}\n", "import { useEffect, type KeyboardEvent, type RefObject } from \"react\";\n\nconst itemSelector =\n '[role=\"menuitem\"]:not([disabled]):not([aria-disabled=\"true\"]), [role=\"menuitemradio\"]:not([disabled]), [role=\"menuitemcheckbox\"]:not([disabled])';\n\nfunction items(menu: HTMLElement | null): HTMLElement[] {\n return menu ? [...menu.querySelectorAll<HTMLElement>(itemSelector)] : [];\n}\n\n/**\n * Keyboard use for a `role=\"menu\"` popup, as people expect from menus: opening it moves focus to its first item,\n * the arrow keys (and Home and End) move between items, wrapping round, and Escape closes it and puts focus\n * back on the button that opened it. Attach the returned handler to the menu's `onKeyDown`.\n */\nexport function useMenuKeyboard({\n open,\n menuRef,\n triggerRef,\n onClose,\n}: {\n open: boolean;\n menuRef: RefObject<HTMLElement | null>;\n triggerRef?: RefObject<HTMLElement | null> | undefined;\n onClose(): void;\n}): (event: KeyboardEvent<HTMLElement>) => void {\n useEffect(() => {\n if (!open) return;\n const frame = window.requestAnimationFrame(() => {\n const menu = menuRef.current;\n // Something inside already has focus (e.g. a field at the top of the menu): leave it there.\n if (menu?.contains(document.activeElement)) return;\n items(menu)[0]?.focus();\n });\n return () => window.cancelAnimationFrame(frame);\n }, [open, menuRef]);\n\n return (event) => {\n const list = items(menuRef.current);\n const index = list.indexOf(document.activeElement as HTMLElement);\n const move = (next: number) => {\n event.preventDefault();\n list[(next + list.length) % list.length]?.focus();\n };\n switch (event.key) {\n case \"ArrowDown\":\n move(index + 1);\n break;\n case \"ArrowUp\":\n move(index < 0 ? list.length - 1 : index - 1);\n break;\n case \"Home\":\n move(0);\n break;\n case \"End\":\n move(list.length - 1);\n break;\n case \"Escape\":\n event.preventDefault();\n event.stopPropagation();\n onClose();\n triggerRef?.current?.focus();\n break;\n case \"Tab\":\n // Leaving the menu closes it; focus moves on as usual.\n onClose();\n break;\n }\n };\n}\n", "import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nimport { useModalDialog } from \"../../hooks/useModalDialog\";\nimport { CornerDownLeftIcon, SearchIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { filterCommands } from \"./filterCommands\";\n\nexport interface Command {\n /** Unique in the list, e.g. \"project.new\". */\n id: string;\n title: string;\n /** Commands with the same group are listed together under its name (when nothing is typed). */\n group?: string;\n icon?: ReactNode;\n /** Extra words that should find this command, e.g. \"start go\" for Run. */\n keywords?: string;\n /** Shown on the right, e.g. a folder or \"Running\". */\n hint?: string;\n /** Shortcut shown on the right, e.g. \"\u2318,\". */\n shortcut?: string;\n /** Why it can't run right now; the command still shows, greyed out, with this as its hint. */\n disabled?: string;\n run(): void;\n}\n\nexport interface CommandPaletteProps {\n open: boolean;\n onClose(): void;\n commands: Command[];\n /** Default \"Search commands\u2026\". */\n placeholder?: string;\n}\n\n/** \u2318K: search every action and run it from the keyboard. Arrow keys (or Ctrl+N and Ctrl+P) move, Enter runs. */\nexport function CommandPalette({ open, onClose, commands, placeholder = \"Search commands\u2026\" }: CommandPaletteProps) {\n const { dialogRef, mounted } = useModalDialog(open, onClose);\n const [query, setQuery] = useState(\"\");\n const [activeIndex, setActiveIndex] = useState(0);\n const listRef = useRef<HTMLUListElement>(null);\n const listId = useId();\n const results = useMemo(() => filterCommands(commands, query), [commands, query]);\n const active = results[Math.min(activeIndex, results.length - 1)];\n\n useEffect(() => setActiveIndex(0), [query]);\n useEffect(() => {\n if (open) setQuery(\"\");\n }, [open]);\n useEffect(() => {\n listRef.current?.querySelector(\"[aria-selected=true]\")?.scrollIntoView({ block: \"nearest\" });\n }, [activeIndex, results]);\n\n if (!mounted) return null;\n\n function run(command: Command | undefined) {\n if (!command || command.disabled) return;\n onClose();\n // After the palette has closed, so dialogs the command opens get focus.\n window.setTimeout(() => command.run(), 0);\n }\n\n function move(step: number) {\n if (!results.length) return;\n setActiveIndex((index) => (Math.min(index, results.length - 1) + step + results.length) % results.length);\n }\n\n return (\n <dialog ref={dialogRef} className=\"ow-dialog ow-palette\" aria-label=\"Command palette\">\n <div className=\"ow-palette__search\">\n <SearchIcon size={16} className=\"ow-palette__search-icon\" />\n <input\n autoFocus\n className=\"ow-palette__input\"\n placeholder={placeholder}\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-activedescendant={active ? `${listId}-${active.id}` : undefined}\n aria-autocomplete=\"list\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" || (event.ctrlKey && event.key === \"n\")) {\n event.preventDefault();\n move(1);\n } else if (event.key === \"ArrowUp\" || (event.ctrlKey && event.key === \"p\")) {\n event.preventDefault();\n move(-1);\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n run(active);\n }\n }}\n />\n <kbd className=\"ow-palette__esc\">esc</kbd>\n </div>\n <ul ref={listRef} id={listId} role=\"listbox\" aria-label=\"Commands\" className=\"ow-palette__list\">\n {results.length ? (\n results.map((command, index) => {\n const showGroup =\n !query.trim() && command.group && command.group !== results[index - 1]?.group;\n const isActive = command === active;\n return (\n <li key={command.id} role=\"presentation\">\n {showGroup ? <div className=\"ow-palette__group\">{command.group}</div> : null}\n <div\n id={`${listId}-${command.id}`}\n role=\"option\"\n aria-selected={isActive}\n aria-disabled={Boolean(command.disabled)}\n title={command.disabled}\n className={cx(\"ow-palette__option\", {\n \"ow-palette__option--active\": isActive,\n \"ow-palette__option--disabled\": Boolean(command.disabled),\n })}\n onMouseMove={() => setActiveIndex(index)}\n onClick={() => run(command)}\n >\n <span className=\"ow-palette__icon\" aria-hidden=\"true\">\n {command.icon}\n </span>\n <span className=\"ow-palette__title\">{command.title}</span>\n {command.disabled && isActive ? (\n <span className=\"ow-palette__hint\">{command.disabled}</span>\n ) : command.hint ? (\n <span className=\"ow-palette__hint\">{command.hint}</span>\n ) : null}\n {command.shortcut ? (\n <kbd className=\"ow-palette__shortcut\">{command.shortcut}</kbd>\n ) : null}\n {isActive && !command.disabled ? (\n <CornerDownLeftIcon size={13} className=\"ow-palette__enter\" />\n ) : null}\n </div>\n </li>\n );\n })\n ) : (\n <li className=\"ow-palette__empty\">No commands match “{query}”.</li>\n )}\n </ul>\n </dialog>\n );\n}\n", "import type { Command } from \"./CommandPalette\";\n\n/** How well a query matches some text: prefix and word-start matches beat letters in order; 0 = no match. */\nfunction score(query: string, text: string, loose = true): number {\n const haystack = text.toLowerCase();\n if (haystack.startsWith(query)) return 100 - Math.min(haystack.length, 50) / 10;\n const wordStart = haystack.indexOf(` ${query}`);\n if (wordStart >= 0) return 80 - wordStart / 10;\n const anywhere = haystack.indexOf(query);\n if (anywhere >= 0) return 60 - anywhere / 10;\n if (!loose) return 0;\n // Letters in order (\"rnp\" \u2192 \"Run pipeline\"), only against titles: in long keyword text almost anything matches.\n let position = 0;\n let gaps = 0;\n for (const letter of query) {\n const found = haystack.indexOf(letter, position);\n if (found < 0) return 0;\n gaps += found - position;\n position = found + 1;\n }\n return Math.max(1, 40 - gaps);\n}\n\n/** Commands matching every word of the query, best first; with no query, the list as given. */\nexport function filterCommands(commands: Command[], query: string): Command[] {\n const words = query.trim().toLowerCase().split(/\\s+/).filter(Boolean);\n if (!words.length) return commands;\n return commands\n .map((command, index) => {\n const extra = `${command.group ?? \"\"} ${command.keywords ?? \"\"} ${command.hint ?? \"\"}`;\n let total = 0;\n for (const word of words) {\n const best = Math.max(score(word, command.title) * 1.5, score(word, extra, false));\n if (!best) return undefined;\n total += best;\n }\n // Runnable commands first, then the original order among equals.\n return { command, rank: total - (command.disabled ? 50 : 0) - index / 1000 };\n })\n .filter((entry): entry is { command: Command; rank: number } => Boolean(entry))\n .sort((a, b) => b.rank - a.rank)\n .map((entry) => entry.command);\n}\n", "import {\n createContext,\n useContext,\n useId,\n useLayoutEffect,\n useRef,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { useIndicator } from \"../../hooks/useIndicator\";\nimport { cx } from \"../../utils/cx\";\n\ninterface TabsContextValue {\n value: string;\n select(value: string): void;\n baseId: string;\n variant: \"segmented\" | \"line\";\n}\n\nconst TabsContext = /* @__PURE__ */ createContext<TabsContextValue | null>(null);\n\nfunction useTabs(component: string) {\n const context = useContext(TabsContext);\n if (!context) throw new Error(`${component} must be inside <Tabs>.`);\n return context;\n}\n\nconst idPart = (value: string) => value.replace(/[^\\w-]/g, \"_\");\n\nexport interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /** The selected tab's value. Leave out to let Tabs keep its own state. */\n value?: string;\n /** The tab selected first when uncontrolled. */\n defaultValue?: string;\n onValueChange?(value: string): void;\n /** `segmented` raises the chosen tab in a well; `line` underlines it.\n * @default \"segmented\" */\n variant?: \"segmented\" | \"line\";\n children: ReactNode;\n}\n\n/** Views of the same thing, one at a time: TabList with Tabs, then a TabPanel for each. */\nexport function Tabs({ value, defaultValue = \"\", onValueChange, variant = \"segmented\", className, children, ...props }: TabsProps) {\n const [current, select] = useControllableState(value, defaultValue, onValueChange);\n const baseId = useId();\n return (\n <TabsContext.Provider value={{ value: current, select, baseId, variant }}>\n <div className={cx(\"ow-tabs\", `ow-tabs--${variant}`, className)} {...props}>\n {children}\n </div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the set of tabs for screen readers. */\n \"aria-label\"?: string;\n}\n\n/** The row of tabs. The arrow keys, Home and End move between them and select. */\nexport function TabList({ className, onKeyDown, children, ...props }: TabListProps) {\n const { value, select } = useTabs(\"TabList\");\n const listRef = useRef<HTMLDivElement>(null);\n useIndicator(listRef, '[role=\"tab\"][aria-selected=\"true\"]', value);\n\n // No tab matches the value (no defaultValue given): select the first one.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!list || list.querySelector('[role=\"tab\"][aria-selected=\"true\"]')) return;\n const first = list.querySelector<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)');\n if (first?.dataset.value) select(first.dataset.value);\n }, [value, select]);\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index < 0) return;\n const moves: Record<string, number> = { ArrowRight: index + 1, ArrowLeft: index - 1, Home: 0, End: tabs.length - 1 };\n if (!(event.key in moves)) return;\n event.preventDefault();\n const next = tabs[(moves[event.key]! + tabs.length) % tabs.length]!;\n next.focus();\n if (next.dataset.value) select(next.dataset.value);\n }\n\n return (\n <div ref={listRef} role=\"tablist\" className={cx(\"ow-tabs__list\", className)} onKeyDown={handleKeyDown} {...props}>\n {children}\n <span className=\"ow-indicator\" aria-hidden=\"true\" />\n </div>\n );\n}\n\nexport interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"value\"> {\n value: string;\n /** A 16px icon before the label. */\n icon?: ReactNode;\n}\n\n/** One tab. Its `value` matches a TabPanel's. */\nexport function Tab({ value, icon, className, children, onClick, ...props }: TabProps) {\n const { value: current, select, baseId } = useTabs(\"Tab\");\n const selected = current === value;\n return (\n <button\n type=\"button\"\n role=\"tab\"\n id={`${baseId}-tab-${idPart(value)}`}\n aria-selected={selected}\n aria-controls={`${baseId}-panel-${idPart(value)}`}\n tabIndex={selected ? 0 : -1}\n data-value={value}\n className={cx(\"ow-tab\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) select(value);\n }}\n {...props}\n >\n {icon ? <span className=\"ow-tab__icon\">{icon}</span> : null}\n {children}\n </button>\n );\n}\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n value: string;\n /** Keep the panel in the page while hidden, so its state survives switching tabs.\n * @default false */\n keepMounted?: boolean;\n}\n\n/** The content for one tab. */\nexport function TabPanel({ value, keepMounted = false, className, children, ...props }: TabPanelProps) {\n const { value: current, baseId } = useTabs(\"TabPanel\");\n const selected = current === value;\n if (!selected && !keepMounted) return null;\n return (\n <div\n role=\"tabpanel\"\n id={`${baseId}-panel-${idPart(value)}`}\n aria-labelledby={`${baseId}-tab-${idPart(value)}`}\n tabIndex={0}\n hidden={!selected}\n className={cx(\"ow-tabs__panel\", className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n", "import {\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\ninterface DisclosureViewProps {\n open: boolean;\n onToggle(): void;\n title: ReactNode;\n subtitle?: ReactNode;\n icon?: ReactNode;\n actions?: ReactNode;\n headingLevel: 2 | 3 | 4 | 5 | 6;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n item?: boolean;\n}\n\nfunction DisclosureView({\n open,\n onToggle,\n title,\n subtitle,\n icon,\n actions,\n headingLevel,\n disabled,\n children,\n className,\n item,\n}: DisclosureViewProps) {\n const id = useId();\n const panelRef = useRef<HTMLDivElement>(null);\n const Heading = `h${headingLevel}` as \"h3\";\n\n // Closed content can't be tabbed into or read out.\n useEffect(() => {\n if (panelRef.current) panelRef.current.inert = !open;\n }, [open]);\n\n return (\n <div className={cx(item ? \"ow-accordion__item\" : \"ow-disclosure\", className)} data-open={open}>\n <div className=\"ow-disclosure__header\">\n <Heading className=\"ow-disclosure__heading\">\n <button\n type=\"button\"\n id={`${id}-trigger`}\n className=\"ow-disclosure__trigger\"\n aria-expanded={open}\n aria-controls={`${id}-panel`}\n disabled={disabled}\n data-accordion-trigger={item ? \"\" : undefined}\n onClick={onToggle}\n >\n <ChevronRightIcon size={14} className=\"ow-disclosure__chevron\" />\n {icon ? <span className=\"ow-disclosure__icon\">{icon}</span> : null}\n <span className=\"ow-disclosure__titles\">\n <span className=\"ow-disclosure__title\">{title}</span>\n {subtitle ? <span className=\"ow-disclosure__subtitle\">{subtitle}</span> : null}\n </span>\n </button>\n </Heading>\n {actions ? <div className=\"ow-disclosure__actions\">{actions}</div> : null}\n </div>\n <div\n ref={panelRef}\n id={`${id}-panel`}\n role=\"region\"\n aria-labelledby={`${id}-trigger`}\n className=\"ow-disclosure__panel\"\n >\n <div className=\"ow-disclosure__clip\">\n <div className=\"ow-disclosure__content\">{children}</div>\n </div>\n </div>\n </div>\n );\n}\n\nexport interface DisclosureProps {\n title: ReactNode;\n /** A muted line under the title. */\n subtitle?: ReactNode;\n /** A 15px icon between the chevron and the title. */\n icon?: ReactNode;\n /** Controls on the right of the header, outside the toggle (a ghost Button). */\n actions?: ReactNode;\n open?: boolean;\n /** @default false */\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /** `card` is a bordered surface; `plain` is just the toggle and its content, for \"Show details\".\n * @default \"card\" */\n variant?: \"card\" | \"plain\";\n /** The heading level of the title, to fit the page's outline.\n * @default 3 */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** A section that opens and closes under its title, like \"3 files changed\" in a code review. */\nexport function Disclosure({\n open,\n defaultOpen = false,\n onOpenChange,\n variant = \"card\",\n headingLevel = 3,\n className,\n ...props\n}: DisclosureProps) {\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n return (\n <DisclosureView\n {...props}\n open={isOpen}\n onToggle={() => setOpen(!isOpen)}\n headingLevel={headingLevel}\n className={cx(variant === \"plain\" && \"ow-disclosure--plain\", className)}\n />\n );\n}\n\ninterface AccordionContextValue {\n isOpen(value: string): boolean;\n toggle(value: string): void;\n headingLevel: 2 | 3 | 4 | 5 | 6;\n}\n\nconst AccordionContext = /* @__PURE__ */ createContext<AccordionContextValue | null>(null);\n\nexport interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\"> {\n /** `single` keeps one item open at a time; `multiple` lets any number be open.\n * @default \"single\" */\n type?: \"single\" | \"multiple\";\n /** The open items' values. */\n value?: string[];\n /** @default [] */\n defaultValue?: string[];\n onValueChange?(value: string[]): void;\n /** `bordered` puts the items in one card with hairlines between; `separated` gives each its own card.\n * @default \"bordered\" */\n variant?: \"bordered\" | \"separated\";\n /** @default 3 */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n children: ReactNode;\n}\n\n/** A stack of Disclosures, such as an FAQ. Up and Down move between the headers. */\nexport function Accordion({\n type = \"single\",\n value,\n defaultValue = [],\n onValueChange,\n variant = \"bordered\",\n headingLevel = 3,\n className,\n children,\n onKeyDown,\n ...props\n}: AccordionProps) {\n const [openValues, setOpenValues] = useControllableState(value, defaultValue, onValueChange);\n\n function toggle(item: string) {\n const isOpen = openValues.includes(item);\n if (type === \"single\") setOpenValues(isOpen ? [] : [item]);\n else setOpenValues(isOpen ? openValues.filter((open) => open !== item) : [...openValues, item]);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const triggers = [\n ...event.currentTarget.querySelectorAll<HTMLButtonElement>(\"[data-accordion-trigger]:not(:disabled)\"),\n ];\n const index = triggers.indexOf(document.activeElement as HTMLButtonElement);\n if (index < 0) return;\n const moves: Record<string, number> = { ArrowDown: index + 1, ArrowUp: index - 1, Home: 0, End: triggers.length - 1 };\n if (!(event.key in moves)) return;\n event.preventDefault();\n triggers[(moves[event.key]! + triggers.length) % triggers.length]?.focus();\n }\n\n return (\n <AccordionContext.Provider value={{ isOpen: (item) => openValues.includes(item), toggle, headingLevel }}>\n <div className={cx(\"ow-accordion\", `ow-accordion--${variant}`, className)} onKeyDown={handleKeyDown} {...props}>\n {children}\n </div>\n </AccordionContext.Provider>\n );\n}\n\nexport interface AccordionItemProps {\n value: string;\n title: ReactNode;\n subtitle?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n children: ReactNode;\n className?: string;\n}\n\n/** One section of an Accordion. */\nexport function AccordionItem({ value, ...props }: AccordionItemProps) {\n const context = useContext(AccordionContext);\n if (!context) throw new Error(\"AccordionItem must be inside <Accordion>.\");\n return (\n <DisclosureView\n {...props}\n item\n open={context.isOpen(value)}\n onToggle={() => context.toggle(value)}\n headingLevel={context.headingLevel}\n />\n );\n}\n", "import { forwardRef, type AnchorHTMLAttributes, type MouseEvent, type ReactNode } from \"react\";\n\nimport { ArrowUpRightIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Where it goes. The last item is the current page and isn't a link. */\n href?: string;\n onClick?(event: MouseEvent<HTMLElement>): void;\n}\n\nexport interface BreadcrumbsProps {\n items: BreadcrumbItem[];\n /** @default \"chevron\" */\n separator?: \"chevron\" | \"slash\";\n /** Names the trail for screen readers.\n * @default \"Breadcrumb\" */\n label?: string;\n className?: string;\n}\n\n/** Where the current page sits: a trail of links from the top level down. */\nexport function Breadcrumbs({ items, separator = \"chevron\", label = \"Breadcrumb\", className }: BreadcrumbsProps) {\n return (\n <nav aria-label={label} className={cx(\"ow-breadcrumbs\", className)}>\n <ol className=\"ow-breadcrumbs__list\">\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n return (\n <li key={index} className=\"ow-breadcrumbs__item\">\n {isLast ? (\n <span className=\"ow-breadcrumbs__current\" aria-current=\"page\">\n {item.label}\n </span>\n ) : item.href ? (\n <a className=\"ow-breadcrumbs__link\" href={item.href} onClick={item.onClick}>\n {item.label}\n </a>\n ) : (\n <button type=\"button\" className=\"ow-breadcrumbs__link\" onClick={item.onClick}>\n {item.label}\n </button>\n )}\n {isLast ? null : (\n <span className=\"ow-breadcrumbs__separator\" aria-hidden=\"true\">\n {separator === \"slash\" ? \"/\" : <ChevronRightIcon size={14} />}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n\nexport interface LinkStyleOptions {\n /** `default` underlines in a hairline and turns brass on hover; `muted` is quieter, for footnotes; `standalone` has no underline until hovered, for lists of links.\n * @default \"default\" */\n variant?: \"default\" | \"muted\" | \"standalone\";\n}\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>, LinkStyleOptions {\n /** Opens in a new tab with an \u2197 arrow, for links that leave your site.\n * @default false */\n external?: boolean;\n children?: ReactNode;\n}\n\n/** The class names of a link, for a router's own <Link>: `<RouterLink className={linkClassName()}>`. */\nexport function linkClassName({ variant = \"default\" }: LinkStyleOptions = {}): string {\n return cx(\"ow-link\", `ow-link--${variant}`);\n}\n\n/** A text link. Its hover turns brass, the one place brass is text on a light ground. */\nexport const Link = /* @__PURE__ */ forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { variant = \"default\", external = false, className, children, target, rel, ...props },\n ref,\n) {\n return (\n <a\n ref={ref}\n className={cx(linkClassName({ variant }), className)}\n target={external ? (target ?? \"_blank\") : target}\n rel={external ? (rel ?? \"noopener noreferrer\") : rel}\n {...props}\n >\n {children}\n {external ? (\n <>\n <ArrowUpRightIcon size={13} className=\"ow-link__external\" />\n <span className=\"ow-visually-hidden\"> (opens in a new tab)</span>\n </>\n ) : null}\n </a>\n );\n});\n", "import { ChevronLeftIcon, ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface PaginationProps {\n /** The current page, starting at 1. */\n page: number;\n pageCount: number;\n onPageChange(page: number): void;\n /** Pages shown either side of the current one.\n * @default 1 */\n siblingCount?: number;\n /** Pages always shown at each end.\n * @default 1 */\n boundaryCount?: number;\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** Names the control for screen readers.\n * @default \"Pagination\" */\n label?: string;\n className?: string;\n}\n\ntype Item = number | \"start-gap\" | \"end-gap\";\n\n/** The page numbers to show, with gaps where pages are skipped. */\nexport function paginationItems(page: number, pageCount: number, siblingCount = 1, boundaryCount = 1): Item[] {\n const range = (from: number, to: number) => Array.from({ length: Math.max(0, to - from + 1) }, (_, i) => from + i);\n const startPages = range(1, Math.min(boundaryCount, pageCount));\n const endPages = range(Math.max(pageCount - boundaryCount + 1, boundaryCount + 1), pageCount);\n const siblingsStart = Math.max(\n Math.min(page - siblingCount, pageCount - boundaryCount - siblingCount * 2 - 1),\n boundaryCount + 2,\n );\n const siblingsEnd = Math.min(\n Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2),\n endPages.length > 0 ? endPages[0]! - 2 : pageCount - 1,\n );\n return [\n ...startPages,\n ...(siblingsStart > boundaryCount + 2\n ? ([\"start-gap\"] as Item[])\n : boundaryCount + 1 < pageCount - boundaryCount\n ? [boundaryCount + 1]\n : []),\n ...range(siblingsStart, siblingsEnd),\n ...(siblingsEnd < pageCount - boundaryCount - 1\n ? ([\"end-gap\"] as Item[])\n : pageCount - boundaryCount > boundaryCount\n ? [pageCount - boundaryCount]\n : []),\n ...endPages,\n ];\n}\n\n/** Moves through pages of results: previous, numbered pages with gaps, next. */\nexport function Pagination({\n page,\n pageCount,\n onPageChange,\n siblingCount = 1,\n boundaryCount = 1,\n size = \"md\",\n label = \"Pagination\",\n className,\n}: PaginationProps) {\n const items = paginationItems(page, pageCount, siblingCount, boundaryCount);\n const go = (next: number) => onPageChange(Math.min(Math.max(1, next), pageCount));\n return (\n <nav aria-label={label} className={cx(\"ow-pagination\", `ow-pagination--${size}`, className)}>\n <ul className=\"ow-pagination__list\">\n <li>\n <button\n type=\"button\"\n className=\"ow-pagination__button ow-pagination__step\"\n aria-label=\"Previous page\"\n disabled={page <= 1}\n onClick={() => go(page - 1)}\n >\n <ChevronLeftIcon size={16} />\n </button>\n </li>\n {items.map((item) =>\n typeof item === \"number\" ? (\n <li key={item}>\n <button\n type=\"button\"\n className=\"ow-pagination__button\"\n aria-current={item === page ? \"page\" : undefined}\n aria-label={`Page ${item}`}\n onClick={() => go(item)}\n >\n {item}\n </button>\n </li>\n ) : (\n <li key={item} className=\"ow-pagination__gap\" aria-hidden=\"true\">\n \u2026\n </li>\n ),\n )}\n <li>\n <button\n type=\"button\"\n className=\"ow-pagination__button ow-pagination__step\"\n aria-label=\"Next page\"\n disabled={page >= pageCount}\n onClick={() => go(page + 1)}\n >\n <ChevronRightIcon size={16} />\n </button>\n </li>\n </ul>\n </nav>\n );\n}\n", "import { useId, type ReactNode } from \"react\";\n\nimport { CheckIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface StepItem {\n title: ReactNode;\n /** A line under the title. Hidden once the step is done, in the vertical layout. */\n description?: ReactNode;\n /** A control on the right of the step while it's the current one, such as a small Button. Other steps don't show it. */\n action?: ReactNode;\n /** Overrides the status worked out from `current`. */\n status?: \"done\" | \"current\" | \"upcoming\";\n}\n\nexport interface StepsProps {\n items: StepItem[];\n /** The index of the step in progress. Steps before it are done. Use items.length when every step is done.\n * @default 0 */\n current?: number;\n /** `vertical` is a first-run checklist; `horizontal` is a compact progress strip.\n * @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** A heading above a vertical list, with a \"2 of 4 done\" count beside it. */\n title?: ReactNode;\n /** Names the list for screen readers when there's no title.\n * @default \"Steps\" */\n label?: string;\n className?: string;\n}\n\n/** Numbered steps toward a goal. The current one is raised; finished ones are checked off. */\nexport function Steps({ items, current = 0, orientation = \"vertical\", title, label = \"Steps\", className }: StepsProps) {\n const statuses = items.map((item, index) => item.status ?? (index < current ? \"done\" : index === current ? \"current\" : \"upcoming\"));\n const doneCount = statuses.filter((status) => status === \"done\").length;\n const headingId = useId();\n\n const list = (\n <ol className=\"ow-steps__list\">\n {items.map((item, index) => {\n const status = statuses[index]!;\n return (\n <li\n key={index}\n className={cx(\"ow-steps__item\", `ow-steps__item--${status}`)}\n aria-current={status === \"current\" ? \"step\" : undefined}\n >\n <span className=\"ow-steps__marker\">\n {status === \"done\" ? <CheckIcon size={14} strokeWidth={3} /> : index + 1}\n </span>\n <span className=\"ow-steps__text\">\n <span className=\"ow-steps__title\">\n {status === \"done\" ? <span className=\"ow-visually-hidden\">Done: </span> : null}\n {item.title}\n </span>\n {item.description && (orientation === \"horizontal\" || status !== \"done\") ? (\n <span className=\"ow-steps__description\">{item.description}</span>\n ) : null}\n </span>\n {item.action && status === \"current\" && orientation === \"vertical\" ? (\n <span className=\"ow-steps__action\">{item.action}</span>\n ) : null}\n </li>\n );\n })}\n </ol>\n );\n\n return (\n <section\n className={cx(\"ow-steps\", `ow-steps--${orientation}`, className)}\n aria-labelledby={title && orientation === \"vertical\" ? headingId : undefined}\n aria-label={title && orientation === \"vertical\" ? undefined : label}\n >\n {title && orientation === \"vertical\" ? (\n <div className=\"ow-steps__header\">\n <h3 id={headingId} className=\"ow-steps__heading\">\n {title}\n </h3>\n <span className=\"ow-steps__count\">\n {doneCount} of {items.length} done\n </span>\n </div>\n ) : null}\n {list}\n </section>\n );\n}\n", "import { forwardRef, useContext, type AnchorHTMLAttributes, type Ref } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { AppShellContext } from \"../AppShell/AppShell.context\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport type { NavItemProps, NavListProps } from \"./NavList.types\";\n\nexport type { NavItemProps, NavListProps } from \"./NavList.types\";\n\n/** A list of places to go, the way a settings dialog's sidebar lists its sections. Place it on ow-canvas. */\nexport function NavList({ label, heading, orientation = \"vertical\", children, className }: NavListProps) {\n return (\n <nav aria-label={label} className={cx(\"ow-nav\", `ow-nav--${orientation}`, className)}>\n {heading && orientation === \"vertical\" ? <span className=\"ow-nav__heading\">{heading}</span> : null}\n {children}\n </nav>\n );\n}\n\n/**\n * One place in a NavList: a button, or a link when given an href. In a folded AppShell sidebar it shows only its\n * icon, with its label as a tooltip (and still read out by screen readers).\n */\nexport const NavItem = /* @__PURE__ */ forwardRef<HTMLElement, NavItemProps>(function NavItem(\n { icon, active = false, className, children, type = \"button\", href, end, ...buttonProps },\n ref,\n) {\n const collapsed = useContext(AppShellContext)?.collapsed ?? false;\n const content = (\n <>\n {icon ? <span className=\"ow-nav__icon\">{icon}</span> : null}\n <span className=\"ow-nav__label\">{children}</span>\n {end !== undefined ? <span className=\"ow-nav__end\">{end}</span> : null}\n </>\n );\n const shared = {\n \"aria-current\": active ? (\"page\" as const) : undefined,\n className: cx(\"ow-nav__item\", active && \"ow-nav__item--active\", className),\n };\n const item =\n href !== undefined ? (\n <a ref={ref as Ref<HTMLAnchorElement>} href={href} {...shared} {...(buttonProps as AnchorHTMLAttributes<HTMLAnchorElement>)}>\n {content}\n </a>\n ) : (\n <button ref={ref as Ref<HTMLButtonElement>} type={type} {...shared} {...buttonProps}>\n {content}\n </button>\n );\n return collapsed ? (\n <Tooltip label={children} placement=\"right\">\n {item}\n </Tooltip>\n ) : (\n item\n );\n});\n", "import { createContext, useContext } from \"react\";\n\nexport interface AppShellState {\n /** The sidebar is folded down to its icons (wide screens only; the phone drawer is never folded). */\n collapsed: boolean;\n setCollapsed(collapsed: boolean): void;\n toggleCollapsed(): void;\n /** Whether the sidebar can fold at all: AppShell's `collapsible`. */\n collapsible: boolean;\n /** True inside the phone drawer, false in the sidebar beside the page. */\n inDrawer: boolean;\n /** Opens and closes the phone drawer. Choosing a NavItem closes it by itself. */\n openNavigation(): void;\n closeNavigation(): void;\n /** The sidebar's id, for aria-controls. */\n sidebarId: string;\n}\n\nexport const AppShellContext = /* @__PURE__ */ createContext<AppShellState | null>(null);\n\n/**\n * The shell around the component: whether the sidebar is folded, and ways to fold it or open and close the phone\n * drawer. Null outside an AppShell.\n */\nexport function useAppShell(): AppShellState | null {\n return useContext(AppShellContext);\n}\n", "import { useCallback, useId, useMemo, useState, type MouseEvent } from \"react\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { MenuIcon, PanelLeftCloseIcon, PanelLeftOpenIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { Button } from \"../Button/Button\";\nimport { Drawer } from \"../Drawer/Drawer\";\nimport { ScrollShadow } from \"../Layout/Layout\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { AppShellContext, useAppShell, type AppShellState } from \"./AppShell.context\";\nimport type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from \"./AppShell.types\";\n\nexport { useAppShell } from \"./AppShell.context\";\nexport type { AppShellState } from \"./AppShell.context\";\nexport type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from \"./AppShell.types\";\n\n/**\n * An app's frame: a sidebar down the left and the page beside it. When the shell is narrower than its breakpoint\n * (900px by default) the sidebar folds into a drawer behind a bar at the top. With `collapsible`, people can fold the sidebar to its icons.\n */\nexport function AppShell({\n sidebar,\n children,\n variant = \"inset\",\n collapsible = false,\n collapsed,\n defaultCollapsed = false,\n onCollapsedChange,\n breakpoint = \"md\",\n topbar,\n topbarActions,\n labels = {},\n className,\n ...props\n}: AppShellProps) {\n const sidebarId = useId();\n const [ownCollapsed, setOwnCollapsed] = useControllableState(collapsed, defaultCollapsed, onCollapsedChange);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const folded = collapsible && ownCollapsed;\n\n const openNavigation = useCallback(() => setDrawerOpen(true), []);\n const closeNavigation = useCallback(() => setDrawerOpen(false), []);\n const shared = useMemo(\n () => ({\n collapsible,\n setCollapsed: setOwnCollapsed,\n toggleCollapsed: () => setOwnCollapsed((previous) => !previous),\n openNavigation,\n closeNavigation,\n sidebarId,\n }),\n [collapsible, setOwnCollapsed, openNavigation, closeNavigation, sidebarId],\n );\n const beside: AppShellState = useMemo(() => ({ ...shared, collapsed: folded, inDrawer: false }), [shared, folded]);\n const inDrawer: AppShellState = useMemo(() => ({ ...shared, collapsed: false, inDrawer: true }), [shared]);\n\n // Choosing a place in the drawer closes it, so the page shows.\n const closeOnChoice = (event: MouseEvent<HTMLDivElement>) => {\n if ((event.target as Element).closest(\".ow-nav__item, [data-closes-navigation]\")) setDrawerOpen(false);\n };\n\n return (\n <div\n className={cx(\"ow-app-shell\", `ow-app-shell--${variant}`, `ow-app-shell--${breakpoint}`, folded && \"ow-app-shell--collapsed\", className)}\n {...props}\n >\n <div className=\"ow-app-shell__frame\">\n <AppShellContext.Provider value={beside}>\n <aside id={sidebarId} className=\"ow-app-shell__sidebar\" aria-label={labels.navigation ?? \"Main navigation\"}>\n <div className=\"ow-sidebar\">{sidebar}</div>\n </aside>\n </AppShellContext.Provider>\n\n <div className=\"ow-app-shell__body\">\n <header className=\"ow-app-shell__topbar\">\n <Button variant=\"ghost\" iconOnly aria-label={labels.openNavigation ?? \"Open navigation\"} onClick={openNavigation}>\n <MenuIcon size={18} />\n </Button>\n <div className=\"ow-app-shell__topbar-start\">{topbar}</div>\n {topbarActions ? <div className=\"ow-app-shell__topbar-end\">{topbarActions}</div> : null}\n </header>\n <main className=\"ow-app-shell__main\">{children}</main>\n </div>\n </div>\n\n <Drawer open={drawerOpen} onClose={closeNavigation} side=\"left\" size={300} title={labels.menu ?? \"Menu\"} className=\"ow-app-shell__drawer\">\n <AppShellContext.Provider value={inDrawer}>\n <div className=\"ow-sidebar ow-sidebar--drawer\" onClick={closeOnChoice}>\n {sidebar}\n </div>\n </AppShellContext.Provider>\n </Drawer>\n </div>\n );\n}\n\n/** The top of the sidebar: the logo, a workspace switcher, a search button. It stays put while the content scrolls. */\nexport function SidebarHeader({ className, ...props }: SidebarSectionProps) {\n return <div className={cx(\"ow-sidebar__header\", className)} {...props} />;\n}\n\n/** The middle of the sidebar, usually NavLists. It scrolls when it's taller than the screen. */\nexport function SidebarContent({ className, children, ...props }: SidebarSectionProps) {\n return (\n <ScrollShadow className={cx(\"ow-sidebar__content\", className)} {...props}>\n {children}\n </ScrollShadow>\n );\n}\n\n/** The bottom of the sidebar: the account, help, a SidebarToggle. */\nexport function SidebarFooter({ className, ...props }: SidebarSectionProps) {\n return <div className={cx(\"ow-sidebar__footer\", className)} {...props} />;\n}\n\n/** Folds the sidebar to its icons and back. It shows only beside the page in a `collapsible` AppShell, not in the phone drawer. */\nexport function SidebarToggle({ labels = {}, className }: SidebarToggleProps) {\n const shell = useAppShell();\n if (!shell?.collapsible || shell.inDrawer) return null;\n const label = shell.collapsed ? (labels.expand ?? \"Expand sidebar\") : (labels.collapse ?? \"Collapse sidebar\");\n const Icon = shell.collapsed ? PanelLeftOpenIcon : PanelLeftCloseIcon;\n return (\n <Tooltip label={label} placement=\"right\">\n <Button\n variant=\"ghost\"\n iconOnly\n size=\"sm\"\n aria-label={label}\n aria-expanded={!shell.collapsed}\n aria-controls={shell.sidebarId}\n className={cx(\"ow-sidebar__toggle\", className)}\n onClick={shell.toggleCollapsed}\n >\n <Icon size={16} />\n </Button>\n </Tooltip>\n );\n}\n", "import {\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport type SpaceToken = \"none\" | \"3xs\" | \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n\nconst space = (token: SpaceToken) => (token === \"none\" ? \"0\" : `var(--ow-space-${token})`);\n\nexport interface StackProps extends HTMLAttributes<HTMLElement> {\n /** @default \"column\" */\n direction?: \"row\" | \"column\";\n /** The space between children, from the spacing scale.\n * @default \"md\" */\n gap?: SpaceToken;\n /** Cross-axis alignment. */\n align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\n /** Main-axis alignment. */\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n /** Lets a row wrap onto more lines.\n * @default false */\n wrap?: boolean;\n /** The element to render.\n * @default \"div\" */\n as?: keyof JSX.IntrinsicElements;\n children?: ReactNode;\n}\n\nconst alignments = { start: \"flex-start\", center: \"center\", end: \"flex-end\", stretch: \"stretch\", baseline: \"baseline\", between: \"space-between\" };\n\n/** Lays children out in a row or a column with a gap from the spacing scale. */\nexport function Stack({\n direction = \"column\",\n gap = \"md\",\n align,\n justify,\n wrap = false,\n as = \"div\",\n className,\n style,\n children,\n ...props\n}: StackProps) {\n const Element = as as \"div\";\n return (\n <Element\n className={cx(\"ow-stack\", className)}\n style={{\n flexDirection: direction,\n gap: space(gap),\n alignItems: align ? alignments[align] : undefined,\n justifyContent: justify ? alignments[justify] : undefined,\n flexWrap: wrap ? \"wrap\" : undefined,\n ...style,\n }}\n {...props}\n >\n {children}\n </Element>\n );\n}\n\nexport interface SeparatorProps {\n /** @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Text in the middle of a horizontal line, such as \"or\". */\n label?: ReactNode;\n /** Space before and after, from the spacing scale.\n * @default \"none\" */\n spacing?: SpaceToken;\n className?: string;\n}\n\n/** A hairline between groups of content. Prefer space; use a line when space alone doesn't separate. */\nexport function Separator({ orientation = \"horizontal\", label, spacing = \"none\", className }: SeparatorProps) {\n const margin = orientation === \"horizontal\" ? `${space(spacing)} 0` : `0 ${space(spacing)}`;\n if (label && orientation === \"horizontal\") {\n return (\n <div role=\"separator\" className={cx(\"ow-separator-label\", className)} style={{ margin }}>\n <span className=\"ow-separator-label__text\">{label}</span>\n </div>\n );\n }\n return (\n <div\n role=\"separator\"\n aria-orientation={orientation}\n className={cx(\"ow-separator\", `ow-separator--${orientation}`, className)}\n style={{ margin }}\n />\n );\n}\n\nexport interface ScrollShadowProps extends HTMLAttributes<HTMLDivElement> {\n /** @default \"vertical\" */\n orientation?: \"vertical\" | \"horizontal\";\n /** How far the fade reaches, in pixels.\n * @default 32 */\n size?: number;\n /** Its height (vertical) or width; it scrolls past this. */\n maxSize?: number | string;\n /** Names the area; with it, the area becomes a focusable region so keyboards can scroll it. */\n \"aria-label\"?: string;\n children: ReactNode;\n}\n\n/** A scrolling area whose edges fade out where there's more to scroll, so nothing looks cut off. */\nexport function ScrollShadow({\n orientation = \"vertical\",\n size = 32,\n maxSize,\n className,\n style,\n children,\n \"aria-label\": ariaLabel,\n ...props\n}: ScrollShadowProps) {\n const ref = useRef<HTMLDivElement>(null);\n const [edges, setEdges] = useState({ start: false, end: false });\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const update = () => {\n const position = orientation === \"vertical\" ? element.scrollTop : element.scrollLeft;\n const extent = orientation === \"vertical\" ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;\n setEdges({ start: position > 1, end: position < extent - 1 });\n };\n update();\n element.addEventListener(\"scroll\", update, { passive: true });\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(update);\n observer?.observe(element);\n if (element.firstElementChild) observer?.observe(element.firstElementChild);\n return () => {\n element.removeEventListener(\"scroll\", update);\n observer?.disconnect();\n };\n }, [orientation]);\n\n return (\n <div\n ref={ref}\n className={cx(\"ow-scroll-shadow\", `ow-scroll-shadow--${orientation}`, className)}\n data-start={edges.start || undefined}\n data-end={edges.end || undefined}\n tabIndex={ariaLabel ? 0 : undefined}\n role={ariaLabel ? \"region\" : undefined}\n aria-label={ariaLabel}\n style={\n {\n \"--ow-scroll-shadow\": `${size}px`,\n [orientation === \"vertical\" ? \"maxHeight\" : \"maxWidth\"]: maxSize,\n ...style,\n } as CSSProperties\n }\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** Hides content visually but keeps it for screen readers: extra context for an icon, a table caption. */\nexport function VisuallyHidden({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return <span className={cx(\"ow-visually-hidden\", className)} {...props} />;\n}\n", "import { useMemo, type Key, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Checkbox } from \"../Checkbox/Checkbox\";\n\nexport interface TableColumn<Row> {\n /** Unique; also the row field shown when there's no `render`. */\n key: string;\n header: ReactNode;\n /** Numbers and amounts go at the end, so their digits line up.\n * @default \"start\" */\n align?: \"start\" | \"center\" | \"end\";\n /** A CSS width, e.g. 120 or \"30%\". */\n width?: number | string;\n /** Lets the person sort by this column. */\n sortable?: boolean;\n /** What the cell shows. Defaults to the row's field named by `key`. */\n render?(row: Row): ReactNode;\n /** The value sorted by, when it isn't the field itself. */\n sortValue?(row: Row): string | number;\n}\n\nexport interface TableSort {\n key: string;\n direction: \"ascending\" | \"descending\";\n}\n\nexport interface TableProps<Row> {\n columns: Array<TableColumn<Row>>;\n rows: Row[];\n /** A field name or function giving each row a unique key.\n * @default \"id\" */\n rowKey?: keyof Row | ((row: Row) => Key);\n /** Describes the table for screen readers; shown above it unless `hideCaption`. */\n caption?: ReactNode;\n /** @default false */\n hideCaption?: boolean;\n sort?: TableSort;\n defaultSort?: TableSort;\n onSortChange?(sort: TableSort): void;\n /** Sort the rows yourself (e.g. on a server) and only show the arrows.\n * @default false */\n manualSort?: boolean;\n /** Adds a checkbox column.\n * @default \"none\" */\n selectionMode?: \"none\" | \"multiple\";\n selectedKeys?: Key[];\n defaultSelectedKeys?: Key[];\n onSelectionChange?(keys: Key[]): void;\n /**\n * Names a row for its checkbox, read out as \"Select \u2026\": the person, the file, the project. Defaults to the\n * first column's value when it's text or a number, else \"row 3\".\n */\n rowLabel?(row: Row): string;\n /** Shown in place of the rows when there are none, such as an EmptyState. */\n emptyContent?: ReactNode;\n /** `compact` rows are 36px; `comfortable` 44px.\n * @default \"comfortable\" */\n density?: \"compact\" | \"comfortable\";\n /** Keeps the header in view while the table scrolls; use with maxHeight. */\n stickyHeader?: boolean;\n maxHeight?: number | string;\n className?: string;\n}\n\nfunction compare(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\n/** Rows of records with sortable columns and optional selection, in a bordered card. */\nexport function Table<Row extends object>({\n columns,\n rows,\n rowKey = \"id\" as keyof Row,\n caption,\n hideCaption = false,\n sort,\n defaultSort,\n onSortChange,\n manualSort = false,\n selectionMode = \"none\",\n selectedKeys,\n defaultSelectedKeys = [],\n onSelectionChange,\n rowLabel,\n emptyContent = \"Nothing here yet.\",\n density = \"comfortable\",\n stickyHeader = false,\n maxHeight,\n className,\n}: TableProps<Row>) {\n const [currentSort, setSort] = useControllableState<TableSort | undefined>(sort, defaultSort, onSortChange as (sort: TableSort | undefined) => void);\n const [selected, setSelected] = useControllableState(selectedKeys, defaultSelectedKeys, onSelectionChange);\n const keyOf = (row: Row): Key => (typeof rowKey === \"function\" ? rowKey(row) : (row[rowKey] as Key));\n const labelOf = (row: Row, index: number): string => {\n if (rowLabel) return rowLabel(row);\n const first = columns[0] ? (row as Record<string, unknown>)[columns[0].key] : undefined;\n return typeof first === \"string\" || typeof first === \"number\" ? String(first) : `row ${index + 1}`;\n };\n const field = (row: Row, key: string) => (row as Record<string, unknown>)[key];\n\n const sorted = useMemo(() => {\n if (!currentSort || manualSort) return rows;\n const column = columns.find((c) => c.key === currentSort.key);\n if (!column) return rows;\n const value = (row: Row) => (column.sortValue ? column.sortValue(row) : (field(row, column.key) as string | number));\n const result = [...rows].sort((a, b) => compare(value(a), value(b)));\n return currentSort.direction === \"descending\" ? result.reverse() : result;\n }, [rows, columns, currentSort, manualSort]);\n\n const allKeys = sorted.map(keyOf);\n const selectedCount = allKeys.filter((key) => selected.includes(key)).length;\n\n function toggleSort(key: string) {\n setSort(\n currentSort?.key === key\n ? { key, direction: currentSort.direction === \"ascending\" ? \"descending\" : \"ascending\" }\n : { key, direction: \"ascending\" },\n );\n }\n\n const selectable = selectionMode === \"multiple\";\n\n return (\n <div\n className={cx(\"ow-table-wrap\", stickyHeader && \"ow-table-wrap--sticky\", className)}\n style={maxHeight ? { maxHeight } : undefined}\n tabIndex={maxHeight ? 0 : undefined}\n >\n <table className={cx(\"ow-table\", `ow-table--${density}`)}>\n {caption ? <caption className={cx(\"ow-table__caption\", hideCaption && \"ow-visually-hidden\")}>{caption}</caption> : null}\n <thead>\n <tr>\n {selectable ? (\n <th className=\"ow-table__select\" scope=\"col\">\n <Checkbox\n size=\"sm\"\n aria-label=\"Select all rows\"\n checked={sorted.length > 0 && selectedCount === sorted.length}\n indeterminate={selectedCount > 0 && selectedCount < sorted.length}\n onChange={(event) =>\n setSelected(\n event.target.checked\n ? [...new Set([...selected, ...allKeys])]\n : selected.filter((key) => !allKeys.includes(key)),\n )\n }\n />\n </th>\n ) : null}\n {columns.map((column) => {\n const direction = currentSort?.key === column.key ? currentSort.direction : undefined;\n return (\n <th\n key={column.key}\n scope=\"col\"\n aria-sort={direction ?? (column.sortable ? \"none\" : undefined)}\n className={cx(`ow-table__cell--${column.align ?? \"start\"}`)}\n style={column.width !== undefined ? { width: column.width } : undefined}\n >\n {column.sortable ? (\n <button type=\"button\" className=\"ow-table__sort\" onClick={() => toggleSort(column.key)}>\n {column.header}\n <span className={cx(\"ow-table__sort-icon\", direction && \"ow-table__sort-icon--active\")}>\n {direction === \"ascending\" ? (\n <ArrowUpIcon size={12} />\n ) : direction === \"descending\" ? (\n <ArrowDownIcon size={12} />\n ) : (\n <ChevronsUpDownIcon size={12} />\n )}\n </span>\n </button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {sorted.length === 0 ? (\n <tr>\n <td className=\"ow-table__empty\" colSpan={columns.length + (selectable ? 1 : 0)}>\n {emptyContent}\n </td>\n </tr>\n ) : (\n sorted.map((row, index) => {\n const key = keyOf(row);\n const isSelected = selected.includes(key);\n return (\n <tr key={key} className={cx(isSelected && \"ow-table__row--selected\")}>\n {selectable ? (\n <td className=\"ow-table__select\">\n <Checkbox\n size=\"sm\"\n aria-label={`Select ${labelOf(row, index)}`}\n checked={isSelected}\n onChange={(event) =>\n setSelected(\n event.target.checked ? [...selected, key] : selected.filter((k) => k !== key),\n )\n }\n />\n </td>\n ) : null}\n {columns.map((column) => (\n <td key={column.key} className={cx(`ow-table__cell--${column.align ?? \"start\"}`)}>\n {column.render ? column.render(row) : (field(row, column.key) as ReactNode)}\n </td>\n ))}\n </tr>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { ArrowDownIcon, ArrowUpIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface StatProps {\n /** What's measured, in a few words: \"Tokens this week\". */\n label: ReactNode;\n /** The number, formatted: \"1.2M\", \"\u20AC48.20\". */\n value: ReactNode;\n /** A 14px icon on a small tile beside the label. */\n icon?: ReactNode;\n /** The change since last time, as text: \"+12%\", \"\u22123\". */\n change?: string;\n /** Whether the change is good or bad. Worked out from a leading + or \u2212 when left out; costs going up are negative, so set it. */\n changeTone?: \"positive\" | \"negative\" | \"neutral\";\n /** A muted line under the value: \"vs last week\". */\n description?: ReactNode;\n /** Recent values for a small line chart under the number. */\n trend?: number[];\n className?: string;\n}\n\nfunction Sparkline({ values }: { values: number[] }) {\n const max = Math.max(...values);\n const min = Math.min(...values);\n const span = max - min || 1;\n const points = values.map((value, index) => {\n const x = (index / (values.length - 1)) * 100;\n const y = 36 - ((value - min) / span) * 32;\n return [x, y] as const;\n });\n const line = points.map(([x, y], index) => `${index ? \"L\" : \"M\"}${x.toFixed(2)} ${y.toFixed(2)}`).join(\" \");\n const [lastX, lastY] = points[points.length - 1]!;\n return (\n <div className=\"ow-stat__trend\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 100 40\" preserveAspectRatio=\"none\">\n <path d={`${line} L100 40 L0 40 Z`} className=\"ow-stat__trend-area\" />\n <path d={line} className=\"ow-stat__trend-line\" vectorEffect=\"non-scaling-stroke\" />\n </svg>\n {/* The end point is HTML, so the stretched chart doesn't stretch it into an oval. */}\n <span className=\"ow-stat__trend-end\" style={{ left: `${lastX}%`, top: `${(lastY / 40) * 100}%` }} />\n </div>\n );\n}\n\n/** One headline number with its label, change and trend, for overview cards. */\nexport function Stat({ label, value, icon, change, changeTone, description, trend, className }: StatProps) {\n const tone = changeTone ?? (change?.startsWith(\"+\") ? \"positive\" : /^[-\u2212]/.test(change ?? \"\") ? \"negative\" : \"neutral\");\n const rising = change ? !/^[-\u2212]/.test(change) : false;\n return (\n <div className={cx(\"ow-stat\", className)}>\n <div className=\"ow-stat__label\">\n {icon ? <span className=\"ow-stat__icon\">{icon}</span> : null}\n <span>{label}</span>\n </div>\n <div className=\"ow-stat__row\">\n <span className=\"ow-stat__value\">{value}</span>\n {change ? (\n <span className={cx(\"ow-stat__change\", `ow-stat__change--${tone}`)}>\n {tone === \"neutral\" ? null : rising ? <ArrowUpIcon size={12} /> : <ArrowDownIcon size={12} />}\n {change}\n </span>\n ) : null}\n </div>\n {description ? <div className=\"ow-stat__description\">{description}</div> : null}\n {trend && trend.length > 1 ? <Sparkline values={trend} /> : null}\n </div>\n );\n}\n", "import { useState, type KeyboardEvent, type PointerEvent } from \"react\";\n\nimport { cx } from \"@/utils/cx\";\nimport { defaultIndex, defaultTick, defaultValue, niceTicks, seriesColors, textWidth, useWidth, valueOf } from \"./chartUtils\";\nimport { ChartLegend, ChartTable } from \"./ChartParts\";\nimport type { BarChartProps, LineChartProps } from \"./Chart.types\";\n\ntype Props = (LineChartProps & { kind: \"line\" }) | (BarChartProps & { kind: \"bar\" });\n\nconst gap = 2;\nconst maxBar = 24;\nconst radius = 4;\n\n/** A bar with rounded corners at its data end and square ones at the baseline. */\nfunction barPath(x: number, top: number, width: number, bottom: number, round: boolean) {\n const height = bottom - top;\n if (height <= 0 || width <= 0) return \"\";\n const r = round ? Math.min(radius, width / 2, height) : 0;\n return `M${x} ${bottom}V${top + r}${r ? `Q${x} ${top} ${x + r} ${top}` : \"\"}H${x + width - r}${r ? `Q${x + width} ${top} ${x + width} ${top + r}` : \"\"}V${bottom}Z`;\n}\n\n/** A line through the points; with `curved`, a monotone curve that never overshoots a point (Fritsch\u2013Carlson). */\nfunction linePath(points: Array<[number, number]>, curved: boolean) {\n if (!points.length) return \"\";\n const fixed = (n: number) => n.toFixed(1);\n if (!curved || points.length < 3) return points.map(([x, y], i) => `${i ? \"L\" : \"M\"}${fixed(x)} ${fixed(y)}`).join(\"\");\n const n = points.length;\n const slopes = points.slice(0, -1).map(([x, y], i) => (points[i + 1]![1] - y) / (points[i + 1]![0] - x || 1));\n const tangents = points.map((_, i) => {\n if (i === 0) return slopes[0]!;\n if (i === n - 1) return slopes[n - 2]!;\n const a = slopes[i - 1]!;\n const b = slopes[i]!;\n return a * b <= 0 ? 0 : (3 * a * b) / (Math.max(a, b) * 2 + Math.min(a, b));\n });\n let d = `M${fixed(points[0]![0])} ${fixed(points[0]![1])}`;\n for (let i = 0; i < n - 1; i++) {\n const [x0, y0] = points[i]!;\n const [x1, y1] = points[i + 1]!;\n const h = (x1 - x0) / 3;\n d += `C${fixed(x0 + h)} ${fixed(y0 + tangents[i]! * h)} ${fixed(x1 - h)} ${fixed(y1 - tangents[i + 1]! * h)} ${fixed(x1)} ${fixed(y1)}`;\n }\n return d;\n}\n\nexport function CartesianChart(props: Props) {\n const {\n kind,\n data,\n index,\n series,\n label,\n height = 240,\n formatValue = defaultValue,\n formatTick = defaultTick,\n formatIndex = defaultIndex,\n legend = series.length > 1,\n className,\n } = props;\n const stacked = kind === \"bar\" && Boolean(props.stacked);\n const area = kind === \"line\" && Boolean(props.area);\n const curved = kind === \"line\" && Boolean(props.curved);\n\n const [plotRef, width] = useWidth<HTMLDivElement>();\n const [active, setActive] = useState<number | null>(null);\n const colors = seriesColors(series);\n const count = data.length;\n\n // The y scale, from zero (or below, for negative numbers) to a round number above the largest.\n const totals = data.map((row) => series.reduce((sum, entry) => sum + Math.max(0, valueOf(row, entry.key)), 0));\n const values = data.flatMap((row) => series.map((entry) => valueOf(row, entry.key)));\n const ticks = niceTicks(Math.min(0, ...values), stacked ? Math.max(0, ...totals) : Math.max(0, ...values));\n const low = ticks[0]!;\n const high = ticks[ticks.length - 1]!;\n const tickLabels = ticks.map(formatTick);\n\n const margin = { top: 8, right: kind === \"line\" ? 10 : 4, bottom: 26, left: Math.ceil(Math.max(...tickLabels.map(textWidth))) + 12 };\n const plotWidth = Math.max(0, width - margin.left - margin.right);\n const plotHeight = Math.max(0, height - margin.top - margin.bottom);\n const y = (value: number) => margin.top + plotHeight - ((value - low) / (high - low || 1)) * plotHeight;\n\n // Lines put the first and last points a little in from the ends; bars take a band each.\n const band = count ? plotWidth / count : 0;\n const inset = 6;\n const step = count > 1 ? (plotWidth - inset * 2) / (count - 1) : 0;\n const x = (i: number) => (kind === \"bar\" ? margin.left + band * (i + 0.5) : count > 1 ? margin.left + inset + i * step : margin.left + plotWidth / 2);\n\n // Enough x labels to fill the axis without touching: every nth, always including the last for lines.\n const indexLabels = data.map((row) => formatIndex(row[index]));\n const spacing = kind === \"bar\" ? band : step || plotWidth;\n const every = Math.max(1, Math.ceil((Math.max(0, ...indexLabels.map(textWidth)) + 14) / (spacing || 1)));\n const labelled = data.map((_, i) => i).filter((i) => (kind === \"line\" ? (count - 1 - i) % every === 0 : i % every === 0));\n\n const pick = (event: PointerEvent<SVGRectElement>) => {\n const left = event.currentTarget.getBoundingClientRect().left - margin.left;\n const position = event.clientX - left;\n const i = kind === \"bar\" ? Math.floor((position - margin.left) / (band || 1)) : Math.round((position - margin.left - inset) / (step || 1));\n setActive(Math.min(count - 1, Math.max(0, i)));\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!count) return;\n const current = active ?? count - 1;\n const moves: Record<string, number> = { ArrowLeft: current - 1, ArrowRight: current + 1, Home: 0, End: count - 1 };\n if (event.key === \"Escape\") return setActive(null);\n if (!(event.key in moves)) return;\n event.preventDefault();\n setActive(Math.min(count - 1, Math.max(0, moves[event.key]!)));\n };\n\n const shown = active === null ? null : Math.min(active, count - 1);\n const describe = (i: number) => `${indexLabels[i]}: ${series.map((entry) => `${entry.label} ${formatValue(valueOf(data[i], entry.key))}`).join(\", \")}.`;\n\n // Bars side by side within their band, each at most 24px wide with a 2px gap.\n const groupSeries = stacked ? 1 : series.length;\n const groupWidth = Math.min(band * 0.72, groupSeries * maxBar + (groupSeries - 1) * gap);\n const barWidth = Math.max(1, (groupWidth - (groupSeries - 1) * gap) / groupSeries);\n\n const bars = () =>\n data.map((row, i) => {\n const start = x(i) - groupWidth / 2;\n if (stacked) {\n let base = 0;\n const parts = series.map((entry, s) => {\n const value = Math.max(0, valueOf(row, entry.key));\n const part = { s, from: base, to: base + value };\n base += value;\n return part;\n });\n const top = [...parts].reverse().find((part) => part.to > part.from)?.s;\n return parts.map(({ s, from, to }) =>\n to > from ? (\n <path key={`${i}-${s}`} d={barPath(start, y(to), barWidth, y(from) - (from > 0 ? gap : 0), s === top)} fill={colors[s]} />\n ) : null,\n );\n }\n return series.map((entry, s) => {\n const value = valueOf(row, entry.key);\n const left = start + s * (barWidth + gap);\n // Below zero the bar hangs down, rounded at its lower end.\n const d = value >= 0 ? barPath(left, y(value), barWidth, y(0), true) : y(value) > y(0) ? flipped(left, y(0), barWidth, y(value)) : \"\";\n return d ? <path key={`${i}-${s}`} d={d} fill={colors[s]} /> : null;\n });\n });\n\n const lines = () =>\n series.map((entry, s) => {\n const points = data.map((row, i) => [x(i), y(valueOf(row, entry.key))] as [number, number]);\n const line = linePath(points, curved);\n return (\n <g key={entry.key}>\n {area && points.length ? (\n <path\n className=\"ow-chart__area\"\n d={`${line}L${points[points.length - 1]![0].toFixed(1)} ${y(Math.max(low, 0))}L${points[0]![0].toFixed(1)} ${y(Math.max(low, 0))}Z`}\n fill={colors[s]}\n />\n ) : null}\n <path className=\"ow-chart__line\" d={line} stroke={colors[s]} />\n {count === 1 ? <circle className=\"ow-chart__point\" cx={points[0]![0]} cy={points[0]![1]} r={4} fill={colors[s]} /> : null}\n </g>\n );\n });\n\n const onRight = shown !== null && x(shown) > width / 2;\n\n return (\n <figure className={cx(\"ow-chart\", `ow-chart--${kind}`, className)}>\n {legend ? (\n <ChartLegend items={series.map((entry, s) => ({ label: entry.label, color: colors[s]! }))} shape={kind === \"line\" ? \"line\" : \"square\"} />\n ) : null}\n <div\n ref={plotRef}\n className=\"ow-chart__plot\"\n style={{ height }}\n tabIndex={count ? 0 : undefined}\n role=\"group\"\n aria-label={`${label}. Use the left and right arrow keys to read each point.`}\n onKeyDown={onKeyDown}\n onFocus={(event) => {\n if (event.target === event.currentTarget) setActive((current) => current ?? count - 1);\n }}\n onBlur={() => setActive(null)}\n >\n {width > 0 ? (\n <svg width={width} height={height} aria-hidden=\"true\" className=\"ow-chart__svg\">\n {ticks.map((tick, t) => (\n <g key={tick}>\n <line\n className={tick === 0 ? \"ow-chart__baseline\" : \"ow-chart__grid\"}\n x1={margin.left}\n x2={width - margin.right}\n y1={Math.round(y(tick)) + 0.5}\n y2={Math.round(y(tick)) + 0.5}\n />\n <text className=\"ow-chart__tick\" x={margin.left - 10} y={y(tick)} dy=\"0.32em\" textAnchor=\"end\">\n {tickLabels[t]}\n </text>\n </g>\n ))}\n {labelled.map((i) => (\n <text\n key={i}\n className=\"ow-chart__tick\"\n x={x(i)}\n y={height - 6}\n textAnchor={\n kind === \"line\" && count > 1 && i === 0 ? \"start\" : kind === \"line\" && count > 1 && i === count - 1 ? \"end\" : \"middle\"\n }\n >\n {indexLabels[i]}\n </text>\n ))}\n {kind === \"bar\" && shown !== null ? (\n <rect className=\"ow-chart__band\" x={x(shown) - band / 2} y={margin.top} width={band} height={plotHeight} rx={6} />\n ) : null}\n {kind === \"bar\" ? bars() : lines()}\n {kind === \"line\" && shown !== null ? (\n <>\n <line className=\"ow-chart__crosshair\" x1={x(shown)} x2={x(shown)} y1={margin.top} y2={margin.top + plotHeight} />\n {series.map((entry, s) => (\n <circle\n key={entry.key}\n className=\"ow-chart__point\"\n cx={x(shown)}\n cy={y(valueOf(data[shown], entry.key))}\n r={4}\n fill={colors[s]}\n />\n ))}\n </>\n ) : null}\n <rect\n className=\"ow-chart__hit\"\n x={margin.left}\n y={margin.top}\n width={plotWidth}\n height={plotHeight}\n onPointerMove={pick}\n onPointerDown={pick}\n onPointerLeave={() => setActive(null)}\n />\n </svg>\n ) : null}\n\n {shown !== null && width > 0 ? (\n <div className=\"ow-chart__readout\" style={onRight ? { right: width - x(shown) + 12 } : { left: x(shown) + 12 }} aria-hidden=\"true\">\n <span className=\"ow-chart__readout-title\">{indexLabels[shown]}</span>\n {series.map((entry, s) => (\n <span key={entry.key} className=\"ow-chart__readout-row\">\n <span className={`ow-chart__key ow-chart__key--${kind === \"line\" ? \"line\" : \"square\"}`} style={{ background: colors[s] }} />\n <span className=\"ow-chart__readout-label\">{entry.label}</span>\n <strong>{formatValue(valueOf(data[shown], entry.key))}</strong>\n </span>\n ))}\n </div>\n ) : null}\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {shown !== null ? describe(shown) : \"\"}\n </span>\n </div>\n <ChartTable\n caption={label}\n head={[\"\", ...series.map((entry) => entry.label)]}\n rows={data.map((row, i) => [indexLabels[i]!, ...series.map((entry) => formatValue(valueOf(row, entry.key)))])}\n />\n </figure>\n );\n}\n\n/** A bar below zero: square at the baseline, rounded at its lower end. */\nfunction flipped(x: number, top: number, width: number, bottom: number) {\n const height = bottom - top;\n const r = Math.min(radius, width / 2, height);\n return `M${x} ${top}V${bottom - r}Q${x} ${bottom} ${x + r} ${bottom}H${x + width - r}Q${x + width} ${bottom} ${x + width} ${bottom - r}V${top}Z`;\n}\n", "import { useLayoutEffect, useRef, useState } from \"react\";\n\nimport type { ChartColor, ChartRow, ChartSeries } from \"./Chart.types\";\n\nexport const colorOf = (color: ChartColor | undefined, index: number) =>\n color === undefined ? `var(--ow-chart-${(index % 8) + 1})` : typeof color === \"number\" ? `var(--ow-chart-${color})` : color;\n\nexport const seriesColors = (series: ChartSeries[]) => series.map((entry, index) => colorOf(entry.color, index));\n\nconst number = new Intl.NumberFormat();\nconst compact = new Intl.NumberFormat(undefined, { notation: \"compact\", maximumFractionDigits: 1 });\nconst day = new Intl.DateTimeFormat(undefined, { day: \"numeric\", month: \"short\" });\n\nexport const defaultValue = (value: number) => number.format(value);\nexport const defaultTick = (value: number) => compact.format(value);\nexport const defaultIndex = (value: unknown) => (value instanceof Date ? day.format(value) : String(value ?? \"\"));\n\nexport const valueOf = (row: ChartRow | undefined, key: string) => {\n const value = row?.[key];\n return typeof value === \"number\" && Number.isFinite(value) ? value : 0;\n};\n\n/** Round gridlines: steps of 1, 2 or 5 times a power of ten, about four of them, always including zero. */\nexport function niceTicks(min: number, max: number) {\n const low = Math.min(0, min);\n const high = Math.max(0, max);\n const rough = (high - low || 1) / 4;\n const power = 10 ** Math.floor(Math.log10(rough));\n const step = [1, 2, 2.5, 5, 10].map((factor) => factor * power).find((candidate) => candidate >= rough)!;\n const start = Math.floor(low / step) * step;\n const end = Math.ceil(high / step) * step || step;\n const ticks: number[] = [];\n for (let tick = start; tick <= end + step / 2; tick += step) ticks.push(Math.round(tick / step) * step);\n return ticks;\n}\n\n/** The element's width, kept up to date. Zero until it's measured, so charts draw on the client only. */\nexport function useWidth<T extends HTMLElement>() {\n const ref = useRef<T>(null);\n const [width, setWidth] = useState(0);\n useLayoutEffect(() => {\n const element = ref.current;\n if (!element) return;\n const measure = () => setWidth(element.clientWidth);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n return [ref, width] as const;\n}\n\n/** Roughly how wide a label is at the axis' 11.5px, to keep labels from colliding without measuring each one. */\nexport const textWidth = (text: string) => text.length * 6.6;\n", "import type { ReactNode } from \"react\";\n\n/** The series' names, each beside its colour, above the plot. */\nexport function ChartLegend({ items, shape }: { items: Array<{ label: ReactNode; color: string; value?: ReactNode }>; shape: \"line\" | \"square\" }) {\n return (\n <ul className=\"ow-chart__legend\">\n {items.map((item, i) => (\n <li key={i} className=\"ow-chart__legend-item\">\n <span className={`ow-chart__key ow-chart__key--${shape}`} style={{ background: item.color }} aria-hidden=\"true\" />\n <span className=\"ow-chart__legend-label\">{item.label}</span>\n {item.value !== undefined ? <span className=\"ow-chart__legend-value\">{item.value}</span> : null}\n </li>\n ))}\n </ul>\n );\n}\n\n/** Every number in the chart as a table, for screen readers: the chart's text alternative. */\nexport function ChartTable({ caption, head, rows }: { caption: string; head: string[]; rows: string[][] }) {\n return (\n <table className=\"ow-visually-hidden\">\n <caption>{caption}</caption>\n <thead>\n <tr>\n {head.map((cell, i) => (\n <th key={i} scope=\"col\">\n {cell}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={r}>\n {row.map((cell, i) =>\n i === 0 ? (\n <th key={i} scope=\"row\">\n {cell}\n </th>\n ) : (\n <td key={i}>{cell}</td>\n ),\n )}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n", "import { CartesianChart } from \"./Cartesian\";\nimport type { LineChartProps } from \"./Chart.types\";\n\n/**\n * Lines over time or another ordered x axis, for trends. Hover, or focus it and use the arrow keys, to read each\n * point; screen readers get every number as a table.\n */\nexport function LineChart(props: LineChartProps) {\n return <CartesianChart kind=\"line\" {...props} />;\n}\n", "import { CartesianChart } from \"./Cartesian\";\nimport type { BarChartProps } from \"./Chart.types\";\n\n/**\n * Bars from a zero baseline, for comparing amounts: side by side, or stacked to show the parts of a whole. Hover,\n * or focus it and use the arrow keys, to read each bar; screen readers get every number as a table.\n */\nexport function BarChart(props: BarChartProps) {\n return <CartesianChart kind=\"bar\" {...props} />;\n}\n", "import { useState, type KeyboardEvent } from \"react\";\n\nimport { cx } from \"@/utils/cx\";\nimport { colorOf, defaultValue } from \"./chartUtils\";\nimport { ChartLegend, ChartTable } from \"./ChartParts\";\nimport type { DonutChartProps } from \"./Chart.types\";\n\nconst percent = new Intl.NumberFormat(undefined, { style: \"percent\", maximumFractionDigits: 1 });\n\n/** One slice of a ring, from one angle to another (radians, clockwise from 12 o'clock). */\nfunction slicePath(cx: number, cy: number, outer: number, inner: number, start: number, end: number) {\n const point = (r: number, a: number) => `${(cx + r * Math.sin(a)).toFixed(2)} ${(cy - r * Math.cos(a)).toFixed(2)}`;\n const large = end - start > Math.PI ? 1 : 0;\n return `M${point(outer, start)}A${outer} ${outer} 0 ${large} 1 ${point(outer, end)}L${point(inner, end)}A${inner} ${inner} 0 ${large} 0 ${point(inner, start)}Z`;\n}\n\n/**\n * Parts of a whole as a ring, with the total in the middle and each part's value and share beside it. Best with two\n * to six slices; hover a slice, or focus it and use the arrow keys, to read it.\n */\nexport function DonutChart({ data, label, formatValue = defaultValue, center, centerLabel = \"Total\", size = 180, legend = true, className }: DonutChartProps) {\n const [active, setActive] = useState<number | null>(null);\n const slices = data.map((slice, i) => ({ ...slice, value: Math.max(0, slice.value), fill: colorOf(slice.color, i) }));\n const total = slices.reduce((sum, slice) => sum + slice.value, 0);\n const share = (value: number) => percent.format(total ? value / total : 0);\n\n const outer = size / 2;\n const inner = outer - Math.max(14, Math.round(size * 0.13));\n // A 2px gap between slices, the same width at the inner and outer edge.\n const pad = (radius: number) => (slices.filter((slice) => slice.value > 0).length > 1 ? 1 / radius : 0);\n let angle = 0;\n const arcs = slices.map((slice) => {\n const start = angle;\n angle += total ? (slice.value / total) * Math.PI * 2 : 0;\n return { start, end: angle };\n });\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!slices.length) return;\n const current = active ?? 0;\n const moves: Record<string, number> = {\n ArrowRight: (current + 1) % slices.length,\n ArrowDown: (current + 1) % slices.length,\n ArrowLeft: (current - 1 + slices.length) % slices.length,\n ArrowUp: (current - 1 + slices.length) % slices.length,\n Home: 0,\n End: slices.length - 1,\n };\n if (event.key === \"Escape\") return setActive(null);\n if (!(event.key in moves)) return;\n event.preventDefault();\n setActive(moves[event.key]!);\n };\n\n const shown = active === null ? null : slices[active];\n\n return (\n <figure className={cx(\"ow-chart\", \"ow-chart--donut\", className)}>\n <div\n className=\"ow-chart__donut\"\n style={{ width: size, height: size }}\n tabIndex={slices.length ? 0 : undefined}\n role=\"group\"\n aria-label={`${label}. Use the arrow keys to read each part.`}\n onKeyDown={onKeyDown}\n onFocus={() => setActive((current) => current ?? 0)}\n onBlur={() => setActive(null)}\n onPointerLeave={() => setActive(null)}\n >\n <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} aria-hidden=\"true\">\n {total === 0 ? <circle className=\"ow-chart__empty\" cx={outer} cy={outer} r={(outer + inner) / 2} strokeWidth={outer - inner} /> : null}\n {slices.map((slice, i) => {\n const { start, end } = arcs[i]!;\n if (end - start <= 0) return null;\n const whole = end - start >= Math.PI * 2 - 1e-6;\n const d = whole\n ? `${slicePath(outer, outer, outer, inner, 0, Math.PI)}${slicePath(outer, outer, outer, inner, Math.PI, Math.PI * 2)}`\n : innerPadded(outer, inner, start, end, pad(outer), pad(inner));\n return (\n <path\n key={i}\n d={d}\n fill={slice.fill}\n className={cx(\"ow-chart__slice\", active !== null && active !== i && \"ow-chart__slice--dim\")}\n onPointerEnter={() => setActive(i)}\n />\n );\n })}\n </svg>\n <div className=\"ow-chart__center\" aria-hidden=\"true\">\n <strong className=\"ow-chart__center-value\">{shown ? formatValue(shown.value) : (center ?? formatValue(total))}</strong>\n <span className=\"ow-chart__center-label\">{shown ? `${shown.label} \u00B7 ${share(shown.value)}` : centerLabel}</span>\n </div>\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {shown ? `${shown.label}: ${formatValue(shown.value)}, ${share(shown.value)}.` : \"\"}\n </span>\n </div>\n {legend ? (\n <ChartLegend\n shape=\"square\"\n items={slices.map((slice) => ({ label: slice.label, color: slice.fill, value: `${formatValue(slice.value)} \u00B7 ${share(slice.value)}` }))}\n />\n ) : null}\n <ChartTable\n caption={label}\n head={[\"\", \"Value\", \"Share\"]}\n rows={slices.map((slice) => [slice.label, formatValue(slice.value), share(slice.value)])}\n />\n </figure>\n );\n}\n\n/** A slice with its ends pulled in: by padOuter at the outer edge and padInner at the inner, so the gap is even. */\nfunction innerPadded(outer: number, inner: number, start: number, end: number, padOuter: number, padInner: number) {\n const c = outer;\n const point = (r: number, a: number) => `${(c + r * Math.sin(a)).toFixed(2)} ${(c - r * Math.cos(a)).toFixed(2)}`;\n const os = start + padOuter;\n const oe = Math.max(os, end - padOuter);\n const is = start + padInner;\n const ie = Math.max(is, end - padInner);\n const largeOuter = oe - os > Math.PI ? 1 : 0;\n const largeInner = ie - is > Math.PI ? 1 : 0;\n return `M${point(outer, os)}A${outer} ${outer} 0 ${largeOuter} 1 ${point(outer, oe)}L${point(inner, ie)}A${inner} ${inner} 0 ${largeInner} 0 ${point(inner, is)}Z`;\n}\n", "import type { CSSProperties } from \"react\";\n\nimport { cx } from \"@/utils/cx\";\nimport { colorOf } from \"./chartUtils\";\nimport type { SparklineProps } from \"./Chart.types\";\n\n/**\n * A small line with no axes, for the shape of a trend beside a number or in a table cell. It's an image to screen\n * readers: say what it shows in its aria-label.\n */\nexport function Sparkline({ data, \"aria-label\": ariaLabel, color = 1, area = true, width = 120, height = 32, className }: SparklineProps) {\n const min = Math.min(...data);\n const max = Math.max(...data);\n // 3px of room above and below, so the line and its end dot aren't cut off.\n const pad = 3;\n const y = (value: number) => pad + (1 - (value - min) / (max - min || 1)) * (height - pad * 2) - (max === min ? (height - pad * 2) / 2 : 0);\n const x = (i: number) => (data.length > 1 ? (i / (data.length - 1)) * 100 : 50);\n const line = data.map((value, i) => `${i ? \"L\" : \"M\"}${x(i).toFixed(2)} ${y(value).toFixed(2)}`).join(\"\");\n const last = data.length - 1;\n\n return (\n <span\n role=\"img\"\n aria-label={ariaLabel}\n className={cx(\"ow-sparkline\", className)}\n style={{ width, height, \"--ow-sparkline-color\": colorOf(color, 0) } as CSSProperties}\n >\n {data.length ? (\n <>\n <svg viewBox={`0 0 100 ${height}`} preserveAspectRatio=\"none\" aria-hidden=\"true\">\n {area ? <path className=\"ow-sparkline__area\" d={`${line}L100 ${height}L0 ${height}Z`} /> : null}\n <path className=\"ow-sparkline__line\" d={line} vectorEffect=\"non-scaling-stroke\" />\n </svg>\n {/* The end point is HTML, so the stretched drawing doesn't stretch it into an oval. */}\n <span className=\"ow-sparkline__end\" style={{ left: `${x(last)}%`, top: y(data[last]!) }} aria-hidden=\"true\" />\n </>\n ) : null}\n </span>\n );\n}\n", "import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ChevronRightIcon, FileIcon, FolderIcon, FolderOpenIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface FileTreeNode {\n name: string;\n /** A folder's contents. Give folders an empty array if they're empty. */\n children?: FileTreeNode[];\n /** Replaces the file or folder icon. */\n icon?: ReactNode;\n /** Muted text at the right of the row, such as \"+12 \u22123\" or a size. */\n meta?: ReactNode;\n}\n\nexport interface FileTreeProps {\n items: FileTreeNode[];\n /** The selected file's path, \"src/app.tsx\". */\n selected?: string;\n defaultSelected?: string;\n onSelect?(path: string): void;\n /** Folder paths open at first, or \"all\".\n * @default \"all\" */\n defaultExpanded?: string[] | \"all\";\n /** Names the tree for screen readers.\n * @default \"Files\" */\n label?: string;\n className?: string;\n}\n\ninterface Row {\n node: FileTreeNode;\n path: string;\n level: number;\n parent?: string;\n isFolder: boolean;\n}\n\nfunction flatten(nodes: FileTreeNode[], expanded: Set<string>, parent?: string, level = 1): Row[] {\n return nodes.flatMap((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n const isFolder = node.children !== undefined;\n const row: Row = { node, path, level, parent, isFolder };\n return isFolder && expanded.has(path) ? [row, ...flatten(node.children!, expanded, path, level + 1)] : [row];\n });\n}\n\nfunction allFolders(nodes: FileTreeNode[], parent?: string): string[] {\n return nodes.flatMap((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n return node.children ? [path, ...allFolders(node.children, path)] : [];\n });\n}\n\n/**\n * A project structure explorer: folders open and close, files can be selected.\n * Up and Down move, Right opens a folder or goes into it, Left closes it or goes to its parent.\n */\nexport function FileTree({\n items,\n selected,\n defaultSelected = \"\",\n onSelect,\n defaultExpanded = \"all\",\n label = \"Files\",\n className,\n}: FileTreeProps) {\n const [current, setCurrent] = useControllableState(selected, defaultSelected, onSelect);\n const [expanded, setExpanded] = useState(() => new Set(defaultExpanded === \"all\" ? allFolders(items) : defaultExpanded));\n const rows = useMemo(() => flatten(items, expanded), [items, expanded]);\n const [focusPath, setFocusPath] = useState<string | undefined>();\n const refs = useRef(new Map<string, HTMLLIElement>());\n const tabStop = rows.some((row) => row.path === focusPath) ? focusPath : (rows.find((row) => row.path === current) ?? rows[0])?.path;\n\n function focus(path: string | undefined) {\n if (!path) return;\n setFocusPath(path);\n refs.current.get(path)?.focus();\n }\n\n function toggle(path: string, open?: boolean) {\n setExpanded((previous) => {\n const next = new Set(previous);\n if (open ?? !next.has(path)) next.add(path);\n else next.delete(path);\n return next;\n });\n }\n\n function activate(row: Row) {\n if (row.isFolder) toggle(row.path);\n else setCurrent(row.path);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLLIElement>, row: Row) {\n const index = rows.indexOf(row);\n const handlers: Record<string, () => void> = {\n ArrowDown: () => focus(rows[index + 1]?.path),\n ArrowUp: () => focus(rows[index - 1]?.path),\n Home: () => focus(rows[0]?.path),\n End: () => focus(rows[rows.length - 1]?.path),\n ArrowRight: () => {\n if (!row.isFolder) return;\n if (!expanded.has(row.path)) toggle(row.path, true);\n else focus(rows[index + 1]?.level === row.level + 1 ? rows[index + 1]!.path : undefined);\n },\n ArrowLeft: () => {\n if (row.isFolder && expanded.has(row.path)) toggle(row.path, false);\n else focus(row.parent);\n },\n Enter: () => activate(row),\n \" \": () => activate(row),\n };\n const handler = handlers[event.key];\n if (!handler) return;\n event.preventDefault();\n event.stopPropagation();\n handler();\n }\n\n function render(nodes: FileTreeNode[], parent?: string, level = 1): ReactNode {\n return nodes.map((node) => {\n const path = parent ? `${parent}/${node.name}` : node.name;\n const row = rows.find((entry) => entry.path === path);\n if (!row) return null;\n const isOpen = row.isFolder && expanded.has(path);\n const icon = node.icon ?? (row.isFolder ? isOpen ? <FolderOpenIcon size={16} /> : <FolderIcon size={16} /> : <FileIcon size={16} />);\n return (\n <li\n key={path}\n ref={(element) => {\n if (element) refs.current.set(path, element);\n else refs.current.delete(path);\n }}\n role=\"treeitem\"\n aria-level={level}\n aria-expanded={row.isFolder ? isOpen : undefined}\n aria-selected={row.isFolder ? undefined : current === path}\n tabIndex={tabStop === path ? 0 : -1}\n className=\"ow-tree__item\"\n onKeyDown={(event) => onKeyDown(event, row)}\n onFocus={(event) => {\n if (event.target === event.currentTarget) setFocusPath(path);\n }}\n >\n <div\n className={cx(\"ow-tree__row\", !row.isFolder && current === path && \"ow-tree__row--selected\")}\n title={path}\n onClick={() => {\n focus(path);\n activate(row);\n }}\n >\n {row.isFolder ? (\n <ChevronRightIcon size={14} className={cx(\"ow-tree__chevron\", isOpen && \"ow-tree__chevron--open\")} />\n ) : (\n <span className=\"ow-tree__spacer\" />\n )}\n <span className={cx(\"ow-tree__icon\", row.isFolder && \"ow-tree__icon--folder\")}>{icon}</span>\n <span className=\"ow-tree__name\">{node.name}</span>\n {node.meta ? <span className=\"ow-tree__meta\">{node.meta}</span> : null}\n </div>\n {isOpen && node.children!.length > 0 ? (\n <ul role=\"group\" className=\"ow-tree__group\">\n {render(node.children!, path, level + 1)}\n </ul>\n ) : null}\n </li>\n );\n });\n }\n\n return (\n <ul role=\"tree\" aria-label={label} className={cx(\"ow-tree\", className)}>\n {render(items)}\n </ul>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { InboxIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface EmptyStateProps {\n /** What's missing, as a plain statement: \"No projects yet\". */\n title: ReactNode;\n /** What to do about it, in a sentence. */\n description?: ReactNode;\n /** A 20px icon on a tile.\n * @default <InboxIcon /> */\n icon?: ReactNode;\n /** One primary Button, and maybe a secondary one. */\n actions?: ReactNode;\n /** Draws a dashed outline around it, for an empty area inside a page.\n * @default false */\n bordered?: boolean;\n className?: string;\n}\n\n/** What a list, table or panel shows when there's nothing in it yet, and the way to add the first thing. */\nexport function EmptyState({ title, description, icon, actions, bordered = false, className }: EmptyStateProps) {\n return (\n <div className={cx(\"ow-empty\", bordered && \"ow-empty--bordered\", className)}>\n <span className=\"ow-empty__icon\" aria-hidden=\"true\">\n {icon ?? <InboxIcon size={20} />}\n </span>\n <div className=\"ow-empty__text\">\n <p className=\"ow-empty__title\">{title}</p>\n {description ? <p className=\"ow-empty__description\">{description}</p> : null}\n </div>\n {actions ? <div className=\"ow-empty__actions\">{actions}</div> : null}\n </div>\n );\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n /** Shows a \u2715 that calls this. */\n onRemove?(): void;\n /** `neutral` for labels and filters; `active` for the ones currently applied.\n * @default \"neutral\" */\n variant?: \"neutral\" | \"active\";\n /** @default \"md\" */\n size?: \"sm\" | \"md\";\n /** A 14px icon or a ColorSwatch before the text. */\n icon?: ReactNode;\n /** What the \u2715 removes, read out as \"Remove \u2026\". Defaults to the text when it's a string. */\n removeLabel?: string;\n children: ReactNode;\n}\n\n/** A label on something (a topic, a filter, a recipient) that can be removed. */\nexport function Tag({ onRemove, variant = \"neutral\", size = \"md\", icon, removeLabel, className, children, ...props }: TagProps) {\n const name = removeLabel ?? (typeof children === \"string\" ? children : \"tag\");\n return (\n <span className={cx(\"ow-tag\", `ow-tag--${variant}`, `ow-tag--${size}`, onRemove && \"ow-tag--removable\", className)} {...props}>\n {icon ? <span className=\"ow-tag__icon\">{icon}</span> : null}\n <span className=\"ow-tag__label\">{children}</span>\n {onRemove ? (\n <button type=\"button\" className=\"ow-tag__remove\" aria-label={`Remove ${name}`} onClick={onRemove}>\n <XIcon size={12} />\n </button>\n ) : null}\n </span>\n );\n}\n\nexport interface TagGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Names the set for screen readers, e.g. \"Filters\". */\n label?: string;\n children: ReactNode;\n}\n\n/** Tags in a wrapping row. */\nexport function TagGroup({ label, className, children, ...props }: TagGroupProps) {\n return (\n <div role=\"group\" aria-label={label} className={cx(\"ow-tag-group\", className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface ColorSwatchProps {\n /** Any CSS colour: \"#312c7e\", \"var(--ow-brass)\". */\n color: string;\n /** The colour's name, read out and shown beside the swatch. */\n name?: string;\n /** The value shown under the name, e.g. the hex. */\n value?: string;\n /** sm 16px, md 24px, lg 40px.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** @default \"square\" */\n shape?: \"square\" | \"circle\";\n className?: string;\n}\n\n/** A colour sample, with its name and value if given. */\nexport function ColorSwatch({ color, name, value, size = \"md\", shape = \"square\", className }: ColorSwatchProps) {\n const swatch = (\n <span\n className={cx(\"ow-swatch\", `ow-swatch--${size}`, shape === \"circle\" && \"ow-swatch--circle\")}\n style={{ background: color }}\n {...(name && !value ? { role: \"img\", \"aria-label\": name } : { \"aria-hidden\": true })}\n />\n );\n if (!name && !value) return <span className={className}>{swatch}</span>;\n return (\n <span className={cx(\"ow-swatch-label\", className)}>\n {swatch}\n <span className=\"ow-swatch-label__text\">\n {name ? <span className=\"ow-swatch-label__name\">{name}</span> : null}\n <span className=\"ow-swatch-label__value\">{value}</span>\n </span>\n </span>\n );\n}\n", "import { useState, type CSSProperties } from \"react\";\n\nimport { UserIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport { getInitials } from \"@/utils/text\";\nimport type { AvatarProps, AvatarSize } from \"./Avatar.types\";\nexport type { AvatarProps, AvatarSize } from \"./Avatar.types\";\n\nconst namedSizes = { sm: 24, md: 28, lg: 36, xl: 48 } as const;\n\n/**\n * The class and style that size an avatar: a named size's class, or a pixel size through --ow-avatar-size.\n * @internal\n */\nexport function avatarSize(size: AvatarSize): { className: string; style?: CSSProperties; pixels: number } {\n if (typeof size === \"number\") {\n return { className: \"ow-avatar--custom\", style: { \"--ow-avatar-size\": `${size}px` } as CSSProperties, pixels: size };\n }\n return { className: `ow-avatar--${size}`, pixels: namedSizes[size] };\n}\n\n/** A round picture of a person: their photo, else their initials on the brand colour, else a person icon. */\nexport function Avatar({ name, src, size = \"md\", label, className }: AvatarProps) {\n const initials = getInitials(name);\n const [failedImage, setFailedImage] = useState<string>();\n const showImage = src && src !== failedImage;\n const sizing = avatarSize(size);\n\n return (\n <span\n className={cx(\"ow-avatar\", sizing.className, !initials && !showImage && \"ow-avatar--empty\", className)}\n style={sizing.style}\n {...(label ? { role: \"img\", \"aria-label\": label } : { \"aria-hidden\": true })}\n // The initials are drawn by CSS, not written in the page: they're a picture of the name, so they don't\n // become the visible label of a button the avatar sits in (which its accessible name would have to match).\n data-initials={!showImage && initials ? initials : undefined}\n >\n {showImage ? (\n <img src={src} alt=\"\" className=\"ow-avatar__image\" onError={() => setFailedImage(src)} />\n ) : initials ? null : (\n <UserIcon size={Math.round(sizing.pixels * 0.52)} />\n )}\n </span>\n );\n}\n", "import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { Avatar, avatarSize, type AvatarSize } from \"./Avatar\";\n\nexport interface AvatarGroupProps {\n /** Avatars. */\n children: ReactNode;\n /** Shows this many, then a \"+3\" count.\n * @default 4 */\n max?: number;\n /** Applied to every avatar in the group: a named size or pixels.\n * @default \"md\" */\n size?: AvatarSize;\n /** Names the group for screen readers, e.g. \"5 people on this project\". */\n label?: string;\n className?: string;\n}\n\n/** Overlapping avatars for the people on something, with a count for the rest. */\nexport function AvatarGroup({ children, max = 4, size = \"md\", label, className }: AvatarGroupProps) {\n const avatars = Children.toArray(children).filter(isValidElement) as Array<ReactElement<{ size?: AvatarSize }>>;\n const sizing = avatarSize(size);\n const shown = avatars.slice(0, max);\n const hidden = avatars.length - shown.length;\n return (\n <div role=\"group\" aria-label={label} className={cx(\"ow-avatar-group\", className)}>\n {shown.map((avatar) => cloneElement(avatar, { size }))}\n {hidden > 0 ? (\n <span className={cx(\"ow-avatar\", sizing.className, \"ow-avatar--count\")} style={sizing.style}>\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"ow-visually-hidden\">and {hidden} more</span>\n </span>\n ) : null}\n </div>\n );\n}\n\nexport interface UserProps {\n name: string;\n /** A second line: an email, a role. */\n description?: ReactNode;\n src?: string;\n /** The avatar's size; the name and gap grow with it from xl (48px) up.\n * @default \"md\" */\n size?: AvatarSize;\n className?: string;\n}\n\n/** The User's class for a size: its own for named sizes; a pixel size uses the nearest named one. */\nfunction userSize(size: AvatarSize) {\n if (typeof size !== \"number\") return `ow-user--${size}`;\n return size >= 48 ? \"ow-user--xl\" : size >= 36 ? \"ow-user--lg\" : size >= 28 ? \"ow-user--md\" : \"ow-user--sm\";\n}\n\n/** A person: avatar, name and a line about them, as in an account menu. */\nexport function User({ name, description, src, size = \"md\", className }: UserProps) {\n return (\n <div className={cx(\"ow-user\", userSize(size), className)}>\n <Avatar name={name} src={src} size={size} />\n <div className=\"ow-user__text\">\n <span className=\"ow-user__name\">{name}</span>\n {description ? <span className=\"ow-user__description\">{description}</span> : null}\n </div>\n </div>\n );\n}\n", "import type { HTMLAttributes } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** One keyboard key in running text, with a heavier bottom edge like a real key: <Kbd>\u2318</Kbd> <Kbd>K</Kbd>. */\nexport function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>) {\n return <kbd className={cx(\"ow-kbd\", className)} {...props} />;\n}\n\n/** Code, a path or a command inside a sentence. */\nexport function Code({ className, ...props }: HTMLAttributes<HTMLElement>) {\n return <code className={cx(\"ow-code\", className)} {...props} />;\n}\n", "import type { HTMLAttributes, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n /** `none` for a card that holds a list or table edge to edge; `md` is 16px, `lg` 24px.\n * @default \"md\" */\n padding?: \"none\" | \"md\" | \"lg\";\n}\n\n/** A surface with a hairline border and no shadow: borders before shadows. */\nexport function Card({ className, padding = \"md\", ...props }: CardProps) {\n return <div className={cx(\"ow-card\", `ow-card--pad-${padding}`, className)} {...props} />;\n}\n\nexport interface SettingsRowProps {\n label: ReactNode;\n /** A muted line or two under the label. */\n description?: ReactNode;\n /** The control: a Switch, a Select, a Button. */\n children: ReactNode;\n className?: string;\n}\n\n/** A label on the left and its control on the right, like macOS System Settings. Stack them in a Card. */\nexport function SettingsRow({ children, description, label, className }: SettingsRowProps) {\n return (\n <div className={cx(\"ow-settings-row\", className)}>\n <div className=\"ow-settings-row__text\">\n <span className=\"ow-settings-row__label\">{label}</span>\n {description ? <div className=\"ow-settings-row__description\">{description}</div> : null}\n </div>\n <div className=\"ow-settings-row__control\">{children}</div>\n </div>\n );\n}\n", "import { cx } from \"@/utils/cx\";\nimport type { ContainerProps } from \"./Container.types\";\nexport type { ContainerProps, ContainerSize } from \"./Container.types\";\n\n/**\n * Centres content at a set width with the page's side margins: 32px, and the phone gutter under 760px. Every block\n * lines its content up the same way, so whatever sits in a Container lines up with the blocks above and below it.\n */\nexport function Container({ size = \"page\", as: Element = \"div\", className, ...props }: ContainerProps) {\n return <Element className={cx(\"ow-container\", `ow-container--${size}`, className)} {...props} />;\n}\n", "import { Container } from \"@/components/Container/Container\";\nimport { cx } from \"@/utils/cx\";\nimport type { SectionProps } from \"./Section.types\";\nexport type { SectionProps } from \"./Section.types\";\n\n/**\n * A full-width band of a page, with the blocks' space above and below and their width and side margins inside (a\n * Container). Your own sections then sit in line with the blocks around them.\n */\nexport function Section({ tone = \"paper\", spacing = \"md\", size = \"page\", as: Element = \"section\", className, children, ...props }: SectionProps) {\n return (\n <Element className={cx(\"ow-section\", `ow-section--${tone}`, `ow-section--space-${spacing}`, className)} {...props}>\n {size === false ? children : <Container size={size}>{children}</Container>}\n </Element>\n );\n}\n", "import { useRef, type HTMLAttributes, type PointerEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\n/** A white pill with a brass dot that names a section, set just above its title. */\nexport function Chip({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return <span className={cx(\"ow-chip\", className)} {...props} />;\n}\n\nexport interface SectionHeadingProps {\n /** One to three words for the Chip above the title. */\n eyebrow?: ReactNode;\n title: ReactNode;\n /** One or two sentences under the title. */\n intro?: ReactNode;\n /** @default \"start\" */\n align?: \"start\" | \"center\";\n /** The heading level.\n * @default \"h2\" */\n as?: \"h1\" | \"h2\" | \"h3\";\n className?: string;\n}\n\n/** How a marketing section opens: a Chip, a big light title, then an intro in muted text. */\nexport function SectionHeading({\n eyebrow,\n title,\n intro,\n align = \"start\",\n as: Heading = \"h2\",\n className,\n}: SectionHeadingProps) {\n return (\n <div className={cx(\"ow-section-heading\", align === \"center\" && \"ow-section-heading--center\", className)}>\n {eyebrow ? <Chip>{eyebrow}</Chip> : null}\n <Heading className=\"ow-section-heading__title\">{title}</Heading>\n {intro ? <p className=\"ow-section-heading__intro\">{intro}</p> : null}\n </div>\n );\n}\n\nexport interface SiteHeaderProps {\n /** Your logo or name, usually a link home. */\n brand: ReactNode;\n /** Links in the middle; hidden under 760px wide. */\n nav?: ReactNode;\n /** On the right: one primary Button with shape=\"pill\". */\n actions?: ReactNode;\n className?: string;\n}\n\n/** The marketing site's header: a floating white pill over a blur, with a hairline border and a soft shadow. */\nexport function SiteHeader({ brand, nav, actions, className }: SiteHeaderProps) {\n return (\n <header className={cx(\"ow-site-header\", className)}>\n <div className=\"ow-site-header__brand\">{brand}</div>\n {nav ? <nav className=\"ow-site-header__nav\">{nav}</nav> : null}\n {actions ? <div className=\"ow-site-header__actions\">{actions}</div> : null}\n </header>\n );\n}\n\nexport interface DotGridProps extends HTMLAttributes<HTMLDivElement> {\n /** Fades the dots out toward the edges.\n * @default false */\n fade?: boolean;\n /** Turns the dots under the pointer brass.\n * @default false */\n interactive?: boolean;\n}\n\n/** A ground of 1px dots every 22px, like a sheet laid out for planning. Content goes inside. */\nexport function DotGrid({ fade = false, interactive = false, className, children, onPointerMove, ...props }: DotGridProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n function track(event: PointerEvent<HTMLDivElement>) {\n onPointerMove?.(event);\n const element = ref.current;\n if (!interactive || !element) return;\n const rect = element.getBoundingClientRect();\n element.style.setProperty(\"--ow-pointer-x\", `${event.clientX - rect.left}px`);\n element.style.setProperty(\"--ow-pointer-y\", `${event.clientY - rect.top}px`);\n }\n\n return (\n <div\n ref={ref}\n className={cx(\"ow-dot-grid\", fade && \"ow-dot-grid--fade\", interactive && \"ow-dot-grid--interactive\", className)}\n onPointerMove={track}\n {...props}\n >\n <span className=\"ow-dot-grid__dots\" aria-hidden=\"true\" />\n {interactive ? (\n <span className=\"ow-dot-grid__brass\" aria-hidden=\"true\" />\n ) : null}\n <div className=\"ow-dot-grid__content\">{children}</div>\n </div>\n );\n}\n", "import { forwardRef, useEffect, useRef } from \"react\";\n\nimport { cx } from \"@/utils/cx\";\nimport type { ProseProps } from \"./Prose.types\";\nexport type { ProseProps } from \"./Prose.types\";\n\n/**\n * Styles content you don't write element by element: Markdown rendered to HTML, a CMS body, an agent's answer. It sets\n * the plain elements inside it (headings, paragraphs, lists, quotes, code, tables, images, details) in Openware's type\n * and colours, and leaves Openware components inside it as they are.\n */\nexport const Prose = /* @__PURE__ */ forwardRef<HTMLElement, ProseProps>(function Prose({ size = \"md\", fullWidth = false, as = \"div\", className, children, ...props }, ref) {\n const Element = as as \"div\";\n const root = useRef<HTMLElement | null>(null);\n\n // Content Prose styles comes as plain HTML, so it fixes two things such HTML can't say for itself, after each render:\n // a code block or table that scrolls sideways can be reached by keyboard to scroll it, and a Markdown task-list\n // checkbox (an <input> at the start of a list item, with no label) is named by its item's text.\n useEffect(() => {\n const element = root.current;\n if (!element) return;\n for (const scroller of element.querySelectorAll<HTMLElement>(\"pre, .ow-table-wrap\")) {\n if (scroller.scrollWidth > scroller.clientWidth && !scroller.hasAttribute(\"tabindex\")) scroller.tabIndex = 0;\n }\n for (const box of element.querySelectorAll<HTMLInputElement>('li > input[type=\"checkbox\"], li > p > input[type=\"checkbox\"]')) {\n if (box.labels?.length || box.hasAttribute(\"aria-label\") || box.hasAttribute(\"aria-labelledby\")) continue;\n const text = box.closest(\"li\")?.textContent?.trim();\n if (text) box.setAttribute(\"aria-label\", text);\n }\n });\n\n return (\n <Element\n ref={(node: HTMLDivElement | null) => {\n root.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n className={cx(\"ow-prose\", `ow-prose--${size}`, size === \"md\" ? \"ow-type-prose\" : \"ow-type-copy\", fullWidth && \"ow-prose--full\", className)}\n {...props}\n >\n {children}\n </Element>\n );\n});\n", "import type { CSSProperties, JSX, ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\n\nexport interface TextShimmerProps {\n /** The words that shimmer, usually a status ending in an ellipsis: \"Thinking\u2026\", \"Running tests\u2026\". */\n children: ReactNode;\n /** The element, so it can sit in a heading or a paragraph.\n * @default \"span\" */\n as?: keyof JSX.IntrinsicElements;\n /** Seconds for the highlight to cross the text once.\n * @default 2 */\n duration?: number;\n /** Stops the shimmer and shows the text plainly, e.g. once the step has finished.\n * @default true */\n active?: boolean;\n className?: string;\n}\n\n/**\n * Text with a highlight sweeping across it, for work in progress: \"Thinking\u2026\", \"Searching the codebase\u2026\". It's plain\n * text to screen readers, and stands still when the person prefers reduced motion.\n */\nexport function TextShimmer({ children, as = \"span\", duration = 2, active = true, className }: TextShimmerProps) {\n const Element = as as \"span\";\n return (\n <Element\n className={cx(\"ow-shimmer\", active && \"ow-shimmer--active\", className)}\n style={active ? ({ \"--ow-shimmer-duration\": `${duration}s` } as CSSProperties) : undefined}\n >\n {children}\n </Element>\n );\n}\n", "import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type DragEvent,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { ArrowUpIcon, FileIcon, UploadIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { resizeTextArea } from \"../../utils/resizeTextArea\";\nimport { Button } from \"../Button/Button\";\nimport { Textarea } from \"../Textarea/Textarea\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\n/** A file attached to the message, shown as a chip above the text. */\nexport interface PromptAttachment {\n /** Identifies it to onRemoveAttachment, and keys its chip. */\n id: string;\n /** The file name, shown on the chip (a long one is cut short before its extension) and read out by its remove button. */\n name: string;\n /** Bytes, shown under the name: \"48 kB\". */\n size?: number;\n /** The MIME type, such as \"image/png\". With the name, it picks the chip's icon when there's no preview. */\n type?: string;\n /** An image to show as the chip's thumbnail: an object URL from URL.createObjectURL, or any image URL. */\n previewUrl?: string;\n}\n\nexport interface PromptInputProps {\n /** The text, when controlled. Clear it yourself in onSubmit. */\n value?: string;\n /** The starting text when uncontrolled. The box clears itself after each send.\n * @default \"\" */\n defaultValue?: string;\n /** Called with the text on every change. */\n onChange?(value: string): void;\n /**\n * Called on Enter or the send button with the text (trimmed) and the attachments. It isn't called while there's\n * nothing to send (no text and no attachments), while streaming, or while disabled.\n */\n onSubmit?(value: string, attachments: PromptAttachment[]): void;\n /** The agent is replying: the send button becomes a Stop button and Escape in the box stops it. The next message can\n * be typed meanwhile, but not sent.\n * @default false */\n isStreaming?: boolean;\n /** Called by the Stop button, and by Escape in the box, while streaming. */\n onStop?(): void;\n /** The files attached so far, as chips above the text. You keep the list: add to it in onAttach and take from it in\n * onRemoveAttachment. */\n attachments?: PromptAttachment[];\n /** Called with the files picked with the paperclip, pasted, or dropped on the box. Giving it shows the paperclip. */\n onAttach?(files: File[]): void;\n /** Called with an attachment's id when its remove button is pressed. Giving it shows the remove buttons. */\n onRemoveAttachment?(id: string): void;\n /** File types to accept, as for <input accept>: \"image/*,.log,.txt\". Other files are turned away with a message. */\n accept?: string;\n /** Lets several files be attached at once.\n * @default true */\n multiple?: boolean;\n /** Controls at the start of the toolbar under the text, after the paperclip: a model Select, a toggle. Buttons here\n * should be size sm. */\n startActions?: ReactNode;\n /** Controls at the end of the toolbar, before the send button. */\n endActions?: ReactNode;\n /** A muted line under the box, such as how to send: \"Enter to send, Shift + Enter for a new line\". The text box\n * points to it with aria-describedby. */\n hint?: ReactNode;\n /** @default \"Message the agent\u2026\" */\n placeholder?: string;\n /** Names the text box for screen readers. It's \"Message\" unless something else labels it: aria-labelledby, or an id\n * that a <label> points to, as in a Field. */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** The text box's id. Field sets it. */\n id?: string;\n /** Marks the box invalid: a danger border, and aria-invalid on the text box. Field sets it from its error.\n * @default false */\n isInvalid?: boolean;\n /** Turns off the text box, its buttons and the controls in the toolbar, and fades the box.\n * @default false */\n disabled?: boolean;\n /** Focuses the text box when it appears. Use it where typing is plainly the next step, such as a new chat.\n * @default false */\n autoFocus?: boolean;\n /** The most characters the text can have. A quiet count shows once it's 80% full. */\n maxLength?: number;\n /** The rows of text the box shows when it's empty.\n * @default 1 */\n minRows?: number;\n /** The most rows it grows to; past that, the text scrolls.\n * @default 8 */\n maxRows?: number;\n /** md for a chat page, sm for a side panel or a reply box.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** The locale for attachment sizes and the character count, such as \"de-CH\". Defaults to the browser's. */\n locale?: string;\n /** Called for each key in the text box before the box's own keys. Call event.preventDefault() to take a key over, for\n * example the Up arrow to edit the last message. */\n onKeyDown?(event: KeyboardEvent<HTMLTextAreaElement>): void;\n /** Classes for the outer element, which holds the box and the hint. */\n className?: string;\n}\n\nconst noAttachments: PromptAttachment[] = [];\n/** The count shows once the text is this full. */\nconst counterFrom = 0.8;\n/** How long typing has to pause before the count is read out. */\nconst announceDelay = 1000;\n\nfunction Glyph({ children }: { children: ReactNode }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={16}\n height={16}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\n// Lucide shapes (ISC licence), drawn here like the ones in icons.tsx.\nconst sheet = \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\";\nconst fold = \"M14 2v5a1 1 0 0 0 1 1h5\";\n\nconst PaperclipIcon = () => (\n <Glyph>\n <path d=\"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\" />\n </Glyph>\n);\n\nconst StopIcon = () => (\n <Glyph>\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\" stroke=\"none\" />\n </Glyph>\n);\n\nconst fileIcons = {\n image: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <circle cx=\"10\" cy=\"12\" r=\"2\" />\n <path d=\"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22\" />\n </Glyph>\n ),\n code: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </Glyph>\n ),\n text: (\n <Glyph>\n <path d={sheet} />\n <path d={fold} />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </Glyph>\n ),\n file: <FileIcon size={16} />,\n};\n\nfunction kindOf({ name, type = \"\" }: PromptAttachment): keyof typeof fileIcons {\n const lower = name.toLowerCase();\n if (type.startsWith(\"image/\") || /\\.(png|jpe?g|gif|webp|avif|heic|svg)$/.test(lower)) return \"image\";\n if (/\\.(tsx?|jsx?|mjs|cjs|py|go|rs|rb|java|kt|swift|c|cc|cpp|h|cs|php|css|scss|html|json|ya?ml|toml|sql|sh)$/.test(lower)) return \"code\";\n if (type.startsWith(\"text/\") || type === \"application/pdf\" || /\\.(txt|md|log|csv|pdf|docx?|rtf)$/.test(lower)) return \"text\";\n return \"file\";\n}\n\n/** \"screenshot.png\" \u2192 [\"screenshot\", \".png\"], so the name can be cut short before its extension. */\nfunction splitName(name: string): [string, string] {\n const dot = name.lastIndexOf(\".\");\n if (dot <= 0 || name.length - dot > 8) return [name, \"\"];\n return [name.slice(0, dot), name.slice(dot)];\n}\n\nfunction formatBytes(bytes: number, locale: string | undefined): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let unit = 0;\n while (value >= 1000 && unit < units.length - 1) {\n value /= 1000;\n unit += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[unit],\n unitDisplay: unit === 0 ? \"long\" : \"short\",\n maximumFractionDigits: unit > 0 && value < 10 ? 1 : 0,\n }).format(value);\n}\n\n/** Whether a file matches an <input accept> list. */\nfunction accepts(file: File, accept: string | undefined): boolean {\n if (!accept) return true;\n return accept.split(\",\").some((rule) => {\n const pattern = rule.trim().toLowerCase();\n if (!pattern) return false;\n if (pattern.startsWith(\".\")) return file.name.toLowerCase().endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return file.type.toLowerCase().startsWith(pattern.slice(0, -1));\n return file.type.toLowerCase() === pattern;\n });\n}\n\nconst hasFiles = (event: DragEvent) => Array.from(event.dataTransfer.types).includes(\"Files\");\n\n/**\n * The box you write to the agent in. Enter sends and Shift+Enter starts a new line; it grows with the text, takes files\n * from a picker, the clipboard or a drop, and turns its send button into Stop while the agent replies.\n */\nexport const PromptInput = /* @__PURE__ */ forwardRef<HTMLTextAreaElement, PromptInputProps>(function PromptInput(\n {\n value,\n defaultValue = \"\",\n onChange,\n onSubmit,\n isStreaming = false,\n onStop,\n attachments = noAttachments,\n onAttach,\n onRemoveAttachment,\n accept,\n multiple = true,\n startActions,\n endActions,\n hint,\n placeholder = \"Message the agent\u2026\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n isInvalid = false,\n disabled = false,\n autoFocus = false,\n maxLength,\n minRows = 1,\n maxRows = 8,\n size = \"md\",\n locale,\n onKeyDown,\n className,\n },\n ref,\n) {\n const [text, setText] = useControllableState(value, defaultValue, onChange);\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const actionRef = useRef<HTMLButtonElement>(null);\n const pickerRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const composing = useRef(false);\n const dragDepth = useRef(0);\n const pendingFocus = useRef<{ id: string; index: number } | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [notice, setNotice] = useState<string>();\n const [announcement, setAnnouncement] = useState(\"\");\n const hintId = useId();\n\n const rows = Math.max(1, Math.round(minRows));\n const maxRowCount = Math.max(rows, Math.round(maxRows));\n const canAttach = Boolean(onAttach) && !disabled;\n const hasContent = text.trim().length > 0 || attachments.length > 0;\n const canSend = hasContent && !disabled && !isStreaming;\n const toolbarStart = Boolean(onAttach || startActions);\n // With nothing in the toolbar but the send button, the button sits at the end of the text instead.\n const inline = !toolbarStart && !endActions;\n const showCounter = maxLength !== undefined && maxLength > 0 && text.length >= maxLength * counterFrom;\n const remaining = maxLength === undefined ? 0 : Math.max(0, maxLength - text.length);\n const number = (count: number) => new Intl.NumberFormat(locale).format(count);\n const shownHint = notice ?? hint;\n const describedBy = [ariaDescribedBy, hint && !notice ? hintId : undefined].filter(Boolean).join(\" \") || undefined;\n const name = ariaLabel ?? (ariaLabelledBy || id ? undefined : \"Message\");\n\n function setTextAreaRef(element: HTMLTextAreaElement | null) {\n textAreaRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }\n\n // The text rewraps when the box gets wider or narrower, so it's measured again.\n useEffect(() => {\n const textArea = textAreaRef.current;\n if (!textArea || typeof ResizeObserver === \"undefined\") return;\n let width = textArea.clientWidth;\n const observer = new ResizeObserver(() => {\n if (textArea.clientWidth === width) return;\n width = textArea.clientWidth;\n resizeTextArea(textArea);\n });\n observer.observe(textArea);\n return () => observer.disconnect();\n }, []);\n\n useLayoutEffect(() => {\n if (textAreaRef.current) resizeTextArea(textAreaRef.current);\n }, [size, rows]);\n\n // When a reply ends with focus on Stop and nothing to send, the button turns into a disabled Send: focus moves to\n // the text box rather than being dropped. Read before the change commits, since a disabled button loses focus.\n const wasStreaming = useRef(isStreaming);\n const actionHadFocus = useRef(false);\n if (wasStreaming.current !== isStreaming) {\n actionHadFocus.current = typeof document !== \"undefined\" && document.activeElement === actionRef.current;\n }\n useLayoutEffect(() => {\n if (wasStreaming.current && !isStreaming && actionHadFocus.current && !hasContent) textAreaRef.current?.focus();\n wasStreaming.current = isStreaming;\n actionHadFocus.current = false;\n }, [isStreaming, hasContent]);\n\n // After a chip is removed, focus goes to the next chip's remove button, or the previous one, or the text box.\n useLayoutEffect(() => {\n const pending = pendingFocus.current;\n if (!pending) return;\n pendingFocus.current = null;\n if (attachments.some((attachment) => attachment.id === pending.id)) return;\n const buttons = listRef.current?.querySelectorAll<HTMLButtonElement>(\".ow-prompt-input__remove\");\n const next = buttons?.length ? buttons[Math.min(pending.index, buttons.length - 1)] : undefined;\n (next ?? textAreaRef.current)?.focus();\n }, [attachments]);\n\n // Near the limit, the count is read out once typing pauses, not on every key.\n useEffect(() => {\n if (!showCounter || document.activeElement !== textAreaRef.current) return;\n const timer = window.setTimeout(() => {\n setAnnouncement(`${number(remaining)} ${remaining === 1 ? \"character\" : \"characters\"} left`);\n }, announceDelay);\n return () => window.clearTimeout(timer);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `number` only depends on locale.\n }, [showCounter, remaining, locale]);\n\n function submit() {\n if (!canSend) return;\n onSubmit?.(text.trim(), attachments);\n setNotice(undefined);\n if (value === undefined) setText(\"\");\n }\n\n function stop() {\n if (isStreaming && !disabled) onStop?.();\n }\n\n function take(list: File[]) {\n if (!canAttach || !list.length) return;\n const files = multiple ? list : list.slice(0, 1);\n const refused = files.find((file) => !accepts(file, accept));\n const taken = files.filter((file) => accepts(file, accept));\n let message: string | undefined;\n if (refused) message = `\u201C${refused.name}\u201D isn't a file this accepts.`;\n else if (!multiple && list.length > 1) message = \"Attach one file at a time.\";\n setNotice(message);\n if (message) setAnnouncement(message);\n if (taken.length) onAttach?.(taken);\n }\n\n function remove(attachment: PromptAttachment, index: number) {\n if (listRef.current?.contains(document.activeElement)) pendingFocus.current = { id: attachment.id, index };\n onRemoveAttachment?.(attachment.id);\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLTextAreaElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Enter\" && !event.shiftKey) {\n // Enter also ends an IME composition (Japanese, Chinese, Korean input); that Enter isn't a send.\n if (composing.current || event.nativeEvent.isComposing || event.keyCode === 229) return;\n event.preventDefault();\n submit();\n } else if (event.key === \"Escape\" && isStreaming && onStop) {\n event.preventDefault();\n event.stopPropagation();\n stop();\n }\n }\n\n // Pasting a screenshot attaches it. Text that comes with an image (a range of spreadsheet cells) pastes as text.\n function handlePaste(event: ClipboardEvent<HTMLTextAreaElement>) {\n if (!canAttach) return;\n const files = Array.from(event.clipboardData.files);\n if (!files.length || event.clipboardData.getData(\"text/plain\")) return;\n event.preventDefault();\n take(files);\n }\n\n // A press on the box's padding or the toolbar's empty space puts the caret in the text.\n function handleMouseDown(event: MouseEvent<HTMLElement>) {\n const target = event.target as HTMLElement;\n if (disabled || (target !== event.currentTarget && !target.hasAttribute(\"data-prompt-blank\"))) return;\n event.preventDefault();\n textAreaRef.current?.focus();\n }\n\n const attachButton = onAttach ? (\n <Tooltip label=\"Attach files\">\n <Button\n className=\"ow-prompt-input__attach\"\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={multiple ? \"Attach files\" : \"Attach a file\"}\n disabled={disabled}\n onClick={() => pickerRef.current?.click()}\n >\n <PaperclipIcon />\n </Button>\n </Tooltip>\n ) : null;\n\n const actionLabel = isStreaming ? \"Stop\" : \"Send\";\n const actionButton = (\n <Tooltip label={actionLabel}>\n <Button\n ref={actionRef}\n className=\"ow-prompt-input__action\"\n variant=\"primary\"\n size=\"sm\"\n iconOnly\n aria-label={actionLabel}\n disabled={disabled || (isStreaming ? !onStop : !hasContent)}\n onClick={() => {\n if (isStreaming) stop();\n else submit();\n textAreaRef.current?.focus();\n }}\n >\n {isStreaming ? <StopIcon /> : <ArrowUpIcon size={16} />}\n </Button>\n </Tooltip>\n );\n\n return (\n <div\n className={cx(\n \"ow-prompt-input\",\n `ow-prompt-input--${size}`,\n inline && \"ow-prompt-input--inline\",\n isInvalid && \"ow-prompt-input--invalid\",\n disabled && \"ow-prompt-input--disabled\",\n isDragging && \"ow-prompt-input--dragging\",\n className,\n )}\n style={{ \"--ow-prompt-min-rows\": rows, \"--ow-prompt-max-rows\": maxRowCount } as CSSProperties}\n >\n <fieldset\n role=\"presentation\"\n className=\"ow-prompt-input__box\"\n disabled={disabled}\n onMouseDown={handleMouseDown}\n onDragEnter={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n dragDepth.current += 1;\n setIsDragging(true);\n }}\n onDragOver={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }}\n onDragLeave={() => {\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) setIsDragging(false);\n }}\n onDrop={(event) => {\n if (!canAttach || !hasFiles(event)) return;\n event.preventDefault();\n dragDepth.current = 0;\n setIsDragging(false);\n take(Array.from(event.dataTransfer.files));\n }}\n >\n {attachments.length ? (\n <ul ref={listRef} className=\"ow-prompt-input__attachments\" aria-label=\"Attachments\">\n {attachments.map((attachment, index) => {\n const [base, extension] = splitName(attachment.name);\n return (\n <li key={attachment.id} className=\"ow-prompt-input__attachment\">\n <span className=\"ow-prompt-input__thumb\" aria-hidden=\"true\">\n {fileIcons[kindOf(attachment)]}\n {attachment.previewUrl ? (\n <img\n src={attachment.previewUrl}\n alt=\"\"\n onError={(event) => {\n event.currentTarget.hidden = true;\n }}\n />\n ) : null}\n </span>\n <span className=\"ow-prompt-input__file\">\n <span className=\"ow-prompt-input__file-name\" title={attachment.name}>\n <span className=\"ow-prompt-input__file-base\">{base}</span>\n {extension}\n </span>\n {attachment.size !== undefined ? (\n <span className=\"ow-prompt-input__file-size\">{formatBytes(attachment.size, locale)}</span>\n ) : null}\n </span>\n {onRemoveAttachment ? (\n <button\n type=\"button\"\n className=\"ow-prompt-input__remove\"\n aria-label={`Remove ${attachment.name}`}\n onClick={() => remove(attachment, index)}\n >\n <XIcon size={14} />\n </button>\n ) : null}\n </li>\n );\n })}\n </ul>\n ) : null}\n\n <Textarea\n ref={setTextAreaRef}\n className=\"ow-prompt-input__textarea\"\n bare\n autoGrow\n autoGrowMaxHeight={`calc(var(--ow-prompt-line) * ${maxRowCount} + 2 * var(--ow-prompt-pad))`}\n rows={rows}\n id={id}\n value={text}\n placeholder={placeholder}\n aria-label={name}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n isInvalid={isInvalid}\n disabled={disabled}\n autoFocus={autoFocus}\n maxLength={maxLength}\n enterKeyHint=\"send\"\n onChange={(event) => setText(event.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onCompositionStart={() => {\n composing.current = true;\n }}\n onCompositionEnd={() => {\n composing.current = false;\n }}\n />\n\n <div className=\"ow-prompt-input__toolbar\" data-prompt-blank=\"\">\n {toolbarStart ? (\n <div className=\"ow-prompt-input__start\" data-prompt-blank=\"\">\n {attachButton}\n {startActions}\n </div>\n ) : null}\n <div className=\"ow-prompt-input__end\" data-prompt-blank=\"\">\n {showCounter ? (\n <span className={cx(\"ow-prompt-input__counter\", remaining === 0 && \"ow-prompt-input__counter--full\")} aria-hidden=\"true\">\n {number(text.length)} / {number(maxLength!)}\n </span>\n ) : null}\n {endActions}\n {actionButton}\n </div>\n </div>\n\n {onAttach ? (\n <input\n ref={pickerRef}\n type=\"file\"\n hidden\n tabIndex={-1}\n accept={accept}\n multiple={multiple}\n onChange={(event) => {\n take(Array.from(event.target.files ?? []));\n event.target.value = \"\";\n textAreaRef.current?.focus();\n }}\n />\n ) : null}\n\n {isDragging ? (\n <div className=\"ow-prompt-input__drop\" aria-hidden=\"true\">\n <UploadIcon size={16} />\n Drop to attach\n </div>\n ) : null}\n </fieldset>\n\n {shownHint ? (\n <div\n className={cx(\"ow-prompt-input__hint\", notice && \"ow-prompt-input__hint--notice\")}\n id={notice ? undefined : hintId}\n aria-hidden={notice ? true : undefined}\n >\n {shownHint}\n </div>\n ) : null}\n <span className=\"ow-visually-hidden\" role=\"status\">\n {announcement}\n </span>\n </div>\n );\n});\n", "import { forwardRef, type ButtonHTMLAttributes, type CSSProperties, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { buttonClassName } from \"../Button/Button\";\n\nexport interface PromptSuggestionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** The suggested prompt, or a short title for it. Keep it to a few words on a pill. */\n children: ReactNode;\n /** A 16px lucide-react icon before the text. */\n icon?: ReactNode;\n /** A muted second line under the text, saying what the agent will do. Shown on cards. */\n description?: ReactNode;\n /** `pill` for a row of short prompts; `card` for a few larger starting points, each with a description.\n * @default \"card\" with a description, otherwise \"pill\" */\n variant?: \"pill\" | \"card\";\n}\n\n/**\n * A suggested prompt to start from: a quiet pill, or a card with a second line. It's a button: what it does on click,\n * filling the prompt box or sending at once, is up to you.\n */\nexport const PromptSuggestion = /* @__PURE__ */ forwardRef<HTMLButtonElement, PromptSuggestionProps>(function PromptSuggestion(\n { children, icon, description, variant = description ? \"card\" : \"pill\", type = \"button\", className, ...buttonProps },\n ref,\n) {\n if (variant === \"card\") {\n return (\n <button ref={ref} type={type} className={cx(\"ow-prompt-suggestion\", \"ow-prompt-suggestion--card\", className)} {...buttonProps}>\n {icon ? <span className=\"ow-prompt-suggestion__icon\">{icon}</span> : null}\n <span className=\"ow-prompt-suggestion__text\">\n <span className=\"ow-prompt-suggestion__title\">{children}</span>\n {description ? <span className=\"ow-prompt-suggestion__description\">{description}</span> : null}\n </span>\n </button>\n );\n }\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n buttonClassName({ variant: \"secondary\", size: \"sm\", shape: \"pill\" }),\n \"ow-prompt-suggestion\",\n \"ow-prompt-suggestion--pill\",\n className,\n )}\n {...buttonProps}\n >\n {icon ? <span className=\"ow-prompt-suggestion__icon\">{icon}</span> : null}\n <span className=\"ow-prompt-suggestion__label\">{children}</span>\n </button>\n );\n});\n\nexport interface PromptSuggestionsProps extends HTMLAttributes<HTMLDivElement> {\n /** PromptSuggestion buttons. */\n children: ReactNode;\n /** `wrap` runs pills along a line and onto the next; `grid` sets cards in equal columns that fold to one when\n * there's no room.\n * @default \"wrap\" */\n layout?: \"wrap\" | \"grid\";\n /** The most columns in a grid. Columns are at least 200px wide, so a narrow grid has fewer.\n * @default 2 */\n columns?: number;\n /** Where wrapped pills line up.\n * @default \"start\" */\n align?: \"start\" | \"center\";\n /** Names the set for screen readers.\n * @default \"Suggested prompts\" */\n \"aria-label\"?: string;\n}\n\n/** Suggested prompts, as a labelled group: pills that wrap, or cards in a grid. */\nexport function PromptSuggestions({\n children,\n layout = \"wrap\",\n columns = 2,\n align = \"start\",\n \"aria-label\": ariaLabel = \"Suggested prompts\",\n className,\n style,\n ...props\n}: PromptSuggestionsProps) {\n return (\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className={cx(\"ow-prompt-suggestions\", `ow-prompt-suggestions--${layout}`, align === \"center\" && \"ow-prompt-suggestions--center\", className)}\n style={layout === \"grid\" ? ({ \"--ow-suggestion-columns\": Math.max(1, Math.round(columns)), ...style } as CSSProperties) : style}\n {...props}\n >\n {children}\n </div>\n );\n}\n", "import {\n Children,\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from \"react\";\n\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { ArrowDownIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\n\nexport interface ChatConversationProps extends HTMLAttributes<HTMLDivElement> {\n /** The messages: ChatMessages, a ChatLoader, anything else in the column. */\n children?: ReactNode;\n /** Shown in place of the messages while there are none: a greeting, suggestions, an EmptyState. */\n empty?: ReactNode;\n /** Docked under the messages and lined up with them, outside the log: usually a PromptInput. It stays in view while\n * the messages scroll, and Jump to latest floats above it. */\n footer?: ReactNode;\n /** Names the conversation for screen readers.\n * @default \"Conversation\" */\n \"aria-label\"?: string;\n /** The id of a visible heading that names the conversation, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** `comfortable` keeps the messages in a 720px column in the middle, for reading; `full` lets them use the whole\n * width, for a narrow side panel.\n * @default \"comfortable\" */\n width?: \"comfortable\" | \"full\";\n /** The words on the button that appears once the reader scrolls up.\n * @default \"Jump to latest\" */\n jumpLabel?: string;\n /** How that button counts the messages that arrived while the reader was scrolled up.\n * @default (count) => `${count} new` */\n formatNewCount?(count: number): string;\n}\n\nexport interface ChatConversationHandle {\n /** Scrolls to the newest message and follows new content again: smoothly, or at once under reduced motion. Call it\n * when the person sends a message, so they see their own words and the answer. */\n scrollToBottom(options?: { behavior?: ScrollBehavior }): void;\n}\n\n/** What messages inside a conversation need from it. */\ninterface ChatConversationContextValue {\n /** True once the first messages have painted: messages that mount after that animate in. */\n ready: MutableRefObject<boolean>;\n /** A message mounted; it counts as new while the reader is scrolled up. Returns the cleanup for when it goes. */\n register(id: string): () => void;\n}\n\n/** @internal */\nexport const ChatConversationContext = /* @__PURE__ */ createContext<ChatConversationContextValue | null>(null);\n\n/** How close to the bottom, in pixels, still counts as reading the latest. */\nconst stickyDistance = 32;\n\nconst defaultCount = (count: number) => `${count} new`;\n\nconst prefersReducedMotion = () => typeof window !== \"undefined\" && Boolean(window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches);\n\n/**\n * The scrolling column of a chat. It follows the newest content while the reader is at the bottom (new messages, an\n * answer that's still streaming), stops as soon as they scroll up to read, and offers a \"Jump to latest\" button to\n * come back. It's a polite live region (role=\"log\"), so screen readers hear messages as they're added.\n */\nexport const ChatConversation = /* @__PURE__ */ forwardRef<ChatConversationHandle, ChatConversationProps>(function ChatConversation(\n {\n children,\n empty,\n footer,\n \"aria-label\": ariaLabel = \"Conversation\",\n \"aria-labelledby\": ariaLabelledBy,\n width = \"comfortable\",\n jumpLabel = \"Jump to latest\",\n formatNewCount = defaultCount,\n className,\n ...props\n },\n ref,\n) {\n const scrollerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const jumpRef = useRef<HTMLButtonElement>(null);\n const following = useRef(true);\n const lastTop = useRef(0);\n const ready = useRef(false);\n const unseen = useRef(new Set<string>());\n const [isFollowing, setIsFollowing] = useState(true);\n const [newCount, setNewCount] = useState(0);\n const isEmpty = Children.toArray(children).length === 0;\n\n const follow = useCallback((next: boolean) => {\n following.current = next;\n setIsFollowing(next);\n if (next && unseen.current.size > 0) {\n unseen.current.clear();\n setNewCount(0);\n }\n }, []);\n\n // Pins the view to the bottom at once. Following never animates, so a streaming answer never lags behind.\n const stick = useCallback(() => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n scroller.scrollTop = scroller.scrollHeight;\n lastTop.current = scroller.scrollTop;\n }, []);\n\n const scrollToBottom = useCallback(\n (options?: { behavior?: ScrollBehavior }) => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n follow(true);\n scroller.scrollTo({ top: scroller.scrollHeight, behavior: options?.behavior ?? (prefersReducedMotion() ? \"auto\" : \"smooth\") });\n },\n [follow],\n );\n\n useImperativeHandle(ref, () => ({ scrollToBottom }), [scrollToBottom]);\n\n // Opens at the newest message.\n useLayoutEffect(stick, [stick]);\n\n useEffect(() => {\n ready.current = true;\n }, []);\n\n // Follows whatever changes the size, whether or not this renders: a new message, a streaming answer, a code block\n // loading, the frame shrinking as the prompt box grows below. It runs before paint, so nothing lags a frame behind.\n useEffect(() => {\n const scroller = scrollerRef.current;\n const content = contentRef.current;\n if (!scroller || !content || typeof ResizeObserver === \"undefined\") return undefined;\n const observer = new ResizeObserver(() => {\n if (following.current) stick();\n });\n observer.observe(content);\n observer.observe(scroller);\n return () => observer.disconnect();\n }, [stick]);\n\n function onScroll() {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n const top = scroller.scrollTop;\n const distance = scroller.scrollHeight - top - scroller.clientHeight;\n // Any move up is the reader looking back. (Content shrinking under them only clamps them to the bottom.)\n if (top < lastTop.current && distance > 1) {\n if (following.current) follow(false);\n } else if (distance <= stickyDistance && !following.current) {\n follow(true);\n }\n lastTop.current = top;\n }\n\n const context = useMemo<ChatConversationContextValue>(\n () => ({\n ready,\n register(id) {\n if (ready.current && !following.current) {\n unseen.current.add(id);\n setNewCount(unseen.current.size);\n }\n return () => {\n if (unseen.current.delete(id)) setNewCount(unseen.current.size);\n };\n },\n }),\n [],\n );\n\n const showJump = !isFollowing && !isEmpty;\n const jump = usePresence(showJump);\n\n return (\n <div className={cx(\"ow-chat-conversation\", width === \"full\" && \"ow-chat-conversation--full\", className)} {...props}>\n <div className=\"ow-chat-conversation__viewport\">\n <div\n ref={scrollerRef}\n className=\"ow-chat-conversation__scroll\"\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n // A tab stop, so the conversation scrolls from the keyboard.\n tabIndex={isEmpty ? undefined : 0}\n onScroll={onScroll}\n >\n <div ref={contentRef} className=\"ow-chat-conversation__content\">\n <ChatConversationContext.Provider value={context}>{children}</ChatConversationContext.Provider>\n </div>\n </div>\n {isEmpty && empty ? (\n <div className=\"ow-chat-conversation__empty\">\n <div className=\"ow-chat-conversation__empty-inner\">{empty}</div>\n </div>\n ) : null}\n {jump.mounted ? (\n <div className=\"ow-chat-conversation__jump\" data-state={jump.state}>\n <Button\n ref={jumpRef}\n size=\"sm\"\n shape=\"pill\"\n startIcon={<ArrowDownIcon size={16} />}\n aria-label={newCount > 0 ? `${jumpLabel}, ${formatNewCount(newCount)}` : jumpLabel}\n tabIndex={showJump ? undefined : -1}\n onClick={() => {\n // The button goes once the view is at the bottom: keep keyboard focus in the conversation.\n if (document.activeElement === jumpRef.current) scrollerRef.current?.focus({ preventScroll: true });\n scrollToBottom();\n }}\n >\n {jumpLabel}\n {newCount > 0 ? <span className=\"ow-chat-conversation__count\">{formatNewCount(newCount)}</span> : null}\n </Button>\n </div>\n ) : null}\n </div>\n {footer != null && footer !== false ? (\n <div className=\"ow-chat-conversation__footer\">\n <div className=\"ow-chat-conversation__footer-inner\">{footer}</div>\n </div>\n ) : null}\n </div>\n );\n});\n", "import {\n forwardRef,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n type RefObject,\n} from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, CircleAlertIcon, CopyIcon, type IconProps } from \"../../icons\";\nimport { copyText } from \"../../utils/copyText\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\nimport { ToggleButton } from \"../Button/ButtonGroup\";\nimport { Toolbar } from \"../Toolbar/Toolbar\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { ChatConversationContext } from \"./ChatConversation\";\n\n/* Lucide shapes (ISC licence) the chat draws itself, like src/icons.tsx. */\nfunction lucide(paths: ReactNode) {\n return function Icon({ size = 16, strokeWidth = 2, ...props }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n {paths}\n </svg>\n );\n };\n}\n\nconst BotIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M12 8V4H8\" />\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\" />\n <path d=\"M2 14h2\" />\n <path d=\"M20 14h2\" />\n <path d=\"M15 13v2\" />\n <path d=\"M9 13v2\" />\n </>,\n);\nconst RotateCcwIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </>,\n);\nconst ThumbsUpIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\" />\n <path d=\"M7 10v12\" />\n </>,\n);\nconst ThumbsDownIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\" />\n <path d=\"M17 14V2\" />\n </>,\n);\nconst PencilIcon = /* @__PURE__ */ lucide(\n <>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\n </>,\n);\n\nexport interface ChatAgentAvatarProps {\n /** sm 24px, md 28px beside a message, lg 36px in a page or panel header: the sizes of Avatar.\n * @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Give it when the avatar stands alone; beside the agent's name, leave it out and it's hidden from screen readers. */\n label?: string;\n className?: string;\n}\n\nconst botSizes = { sm: 14, md: 16, lg: 18 };\n\n/**\n * The agent's avatar: a bot icon on a tinted circle, in the sizes of Avatar. Messages and the loader show it by\n * default; use it wherever else the agent appears, such as a chat's header.\n */\nexport function ChatAgentAvatar({ size = \"md\", label, className }: ChatAgentAvatarProps) {\n return (\n <span\n className={cx(\"ow-chat-avatar\", size !== \"md\" && `ow-chat-avatar--${size}`, className)}\n role={label ? \"img\" : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n >\n <BotIcon size={botSizes[size]} />\n </span>\n );\n}\n\n/**\n * Whether this message or loader should animate in: only when it arrives in a conversation that's already showing,\n * not for the history it opens with.\n * @internal\n */\nexport function useChatEntrance(): boolean {\n const conversation = useContext(ChatConversationContext);\n const [entering] = useState(() => conversation?.ready.current ?? false);\n return entering;\n}\n\nconst formatters = new Map<string, { short: Intl.DateTimeFormat; full: Intl.DateTimeFormat }>();\n\nfunction formattersFor(locale: string | undefined) {\n const key = locale ?? \"\";\n let entry = formatters.get(key);\n if (!entry) {\n entry = {\n short: new Intl.DateTimeFormat(locale, { timeStyle: \"short\" }),\n full: new Intl.DateTimeFormat(locale, { dateStyle: \"full\", timeStyle: \"short\" }),\n };\n formatters.set(key, entry);\n }\n return entry;\n}\n\n/** A short local time (\"14:02\" in en-GB, \"2:02 PM\" in en-US) for a Date or ISO string; anything unparseable shows as given. */\nfunction MessageTime({ time, locale }: { time: Date | string; locale?: string }) {\n const date = typeof time === \"string\" ? new Date(time) : time;\n if (Number.isNaN(date.getTime())) {\n return <time className=\"ow-chat-message__time\">{String(time)}</time>;\n }\n const { short, full } = formattersFor(locale);\n return (\n <time className=\"ow-chat-message__time\" dateTime={date.toISOString()} title={full.format(date)}>\n {short.format(date)}\n </time>\n );\n}\n\n/** Text inside these isn't where the writing is happening. */\nconst skipCaret = '[aria-hidden=\"true\"], .ow-visually-hidden';\n\n/**\n * Keeps the streaming caret just after the last character of the content, wherever that is: a plain string, the\n * last paragraph of rendered Markdown, a code block. It follows the content as it changes and as it reflows.\n */\nfunction useStreamingCaret(bodyRef: RefObject<HTMLElement>, contentRef: RefObject<HTMLElement>, caretRef: RefObject<HTMLElement>, active: boolean) {\n useLayoutEffect(() => {\n const body = bodyRef.current;\n const content = contentRef.current;\n const caret = caretRef.current;\n if (!active || !body || !content || !caret) return undefined;\n\n const place = () => {\n const walker = document.createTreeWalker(content, NodeFilter.SHOW_TEXT, {\n acceptNode: (node) => (node.nodeValue?.trim() && !node.parentElement?.closest(skipCaret) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT),\n });\n const last = walker.lastChild() as Text | null;\n const box = body.getBoundingClientRect();\n if (!last) {\n // Nothing written yet: the caret waits where the first word will go.\n caret.style.transform = \"\";\n caret.style.removeProperty(\"height\");\n caret.style.removeProperty(\"color\");\n caret.hidden = false;\n return;\n }\n const end = last.data.trimEnd().length;\n const range = document.createRange();\n range.setStart(last, end - 1);\n range.setEnd(last, end);\n const rects = range.getClientRects();\n const rect = rects[rects.length - 1];\n if (!rect) {\n caret.hidden = true;\n return;\n }\n const x = Math.min(rect.right - box.left + 2, box.width - 2);\n caret.hidden = false;\n caret.style.transform = `translate(${Math.round(x)}px, ${Math.round(rect.top - box.top)}px)`;\n caret.style.height = `${Math.round(rect.height)}px`;\n caret.style.color = getComputedStyle(last.parentElement ?? content).color;\n };\n\n place();\n const mutations = new MutationObserver(place);\n mutations.observe(content, { subtree: true, childList: true, characterData: true });\n const resizes = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(place);\n resizes?.observe(body);\n return () => {\n mutations.disconnect();\n resizes?.disconnect();\n };\n }, [active, bodyRef, contentRef, caretRef]);\n}\n\nexport type ChatMessageFrom = \"user\" | \"assistant\" | \"system\";\nexport type ChatMessageStatus = \"streaming\" | \"done\" | \"error\";\n\nexport interface ChatMessageProps extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n /** Who it's from. `user`: the person, in a bubble on the right. `assistant`: the agent, full width beside its\n * avatar. `system`: a muted line in the middle, between hairlines, for things that happened (\"Maya changed the\n * model to Claude Sonnet\"). */\n from: ChatMessageFrom;\n /** The message. A person's plain text keeps its line breaks; give an agent's formatted answer as Prose, and put\n * paragraphs in Text so blocks sit 12px apart. */\n children?: ReactNode;\n /** Shown above the message: \"Acme agent\", \"Maya Chen\". Left out, screen readers hear \"You\" or \"Agent\" instead. */\n name?: ReactNode;\n /** The agent's bot tile by default; any node (an Avatar) in its place, or null for none. A person's message shows one\n * only when you give it. */\n avatar?: ReactNode;\n /** When it was sent, as a Date or an ISO string. It shows as a short local time, with the full date on hover. */\n time?: Date | string;\n /** The locale for the time, such as \"en-GB\". Defaults to the browser's. */\n locale?: string;\n /** `streaming` while the text is still arriving: a soft caret blinks after it and the message is aria-busy.\n * `error` shows a line saying what went wrong, with Retry when you pass `onRetry`.\n * @default \"done\" */\n status?: ChatMessageStatus;\n /** What went wrong, for `status=\"error\"`.\n * @default \"The answer didn't finish.\" for the agent, \"Couldn't send this message.\" for a person */\n error?: ReactNode;\n /** Shows a Retry button on the error line. */\n onRetry?(): void;\n /** The Retry button's words, for another language.\n * @default \"Retry\" */\n retryLabel?: string;\n /** Actions under the message, usually a ChatMessageActions. They wait until the message has finished streaming. */\n actions?: ReactNode;\n /** `hover` shows the actions while the message is hovered or has focus, and always on touch screens. `always` keeps\n * them in view, for the latest answer.\n * @default \"hover\" */\n showActions?: \"hover\" | \"always\";\n}\n\n/**\n * One message in a conversation: the person's in a bubble on the right, the agent's across the full width with its\n * avatar, name and time, or a system line in the middle. It shows a caret while the answer streams, an error with\n * Retry when it fails, and its actions on hover.\n */\nexport const ChatMessage = /* @__PURE__ */ forwardRef<HTMLElement, ChatMessageProps>(function ChatMessage(\n { from, children, name, avatar, time, locale, status = \"done\", error, onRetry, retryLabel = \"Retry\", actions, showActions = \"hover\", className, ...props },\n ref,\n) {\n const conversation = useContext(ChatConversationContext);\n const entering = useChatEntrance();\n const id = useId();\n const bodyRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const streaming = status === \"streaming\";\n\n useEffect(() => conversation?.register(id), [conversation, id]);\n useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== \"system\");\n\n if (from === \"system\") {\n return (\n <div\n ref={ref as Ref<HTMLDivElement>}\n className={cx(\"ow-chat-message\", \"ow-chat-message--system\", entering && \"ow-chat-message--enter\", className)}\n {...props}\n >\n <span className=\"ow-chat-message__system-text\">\n {children}\n {time !== undefined ? (\n <>\n <span aria-hidden=\"true\"> \u00B7 </span>\n <MessageTime time={time} locale={locale} />\n </>\n ) : null}\n </span>\n </div>\n );\n }\n\n const isUser = from === \"user\";\n const avatarNode = avatar !== undefined ? avatar : isUser ? null : <ChatAgentAvatar />;\n const hasHeader = name != null || time !== undefined;\n const errorText = error ?? (isUser ? \"Couldn't send this message.\" : \"The answer didn't finish.\");\n\n return (\n <article\n ref={ref}\n className={cx(\n \"ow-chat-message\",\n `ow-chat-message--${from}`,\n entering && \"ow-chat-message--enter\",\n streaming && \"ow-chat-message--streaming\",\n status === \"error\" && \"ow-chat-message--error\",\n showActions === \"always\" && \"ow-chat-message--actions-always\",\n className,\n )}\n aria-busy={streaming || undefined}\n {...props}\n >\n {avatarNode != null && avatarNode !== false ? <div className=\"ow-chat-message__avatar\">{avatarNode}</div> : null}\n <div className=\"ow-chat-message__main\">\n {hasHeader ? (\n <div className=\"ow-chat-message__header\">\n {name != null ? (\n <span className=\"ow-chat-message__name\">{name}</span>\n ) : (\n <span className=\"ow-visually-hidden\">{isUser ? \"You\" : \"Agent\"}</span>\n )}\n {time !== undefined ? <MessageTime time={time} locale={locale} /> : null}\n </div>\n ) : (\n <span className=\"ow-visually-hidden\">{isUser ? \"You\" : \"Agent\"}</span>\n )}\n <div ref={bodyRef} className=\"ow-chat-message__body\">\n <div ref={contentRef} className=\"ow-chat-message__content\">\n {children}\n </div>\n {streaming ? <span ref={caretRef} className=\"ow-chat-message__caret\" aria-hidden=\"true\" /> : null}\n </div>\n {status === \"error\" ? (\n <div className={cx(\"ow-chat-message__error\", onRetry && \"ow-chat-message__error--retry\")}>\n <CircleAlertIcon size={16} className=\"ow-chat-message__error-icon\" />\n <span className=\"ow-chat-message__error-text\">{errorText}</span>\n {onRetry ? (\n <Button size=\"sm\" startIcon={<RotateCcwIcon size={16} />} onClick={onRetry}>\n {retryLabel}\n </Button>\n ) : null}\n </div>\n ) : null}\n {actions && !streaming ? <div className=\"ow-chat-message__actions\">{actions}</div> : null}\n </div>\n </article>\n );\n});\n\nexport type ChatRating = \"up\" | \"down\";\n\nexport interface ChatMessageActionsProps {\n /** The message as plain text. Shows Copy, which copies it and says \"Copied\" for two seconds. */\n copyText?: string;\n /** Shows Edit, for the person's own messages. */\n onEdit?(): void;\n /** Shows Retry, to ask for the answer again. */\n onRetry?(): void;\n /** Shows Good response and Bad response. Called with the one pressed, or null when the pressed one is pressed again. */\n onRate?(rating: ChatRating | null): void;\n /** Which rating is pressed, when you keep it yourself. */\n rating?: ChatRating | null;\n /** The starting rating when uncontrolled.\n * @default null */\n defaultRating?: ChatRating | null;\n /** More actions after these: ghost, sm, icon-only Buttons, each in a Tooltip with its aria-label. */\n children?: ReactNode;\n /** The buttons' words, for another language. */\n labels?: Partial<Record<\"copy\" | \"copied\" | \"edit\" | \"retry\" | \"good\" | \"bad\", string>>;\n /** Names the toolbar for screen readers.\n * @default \"Message actions\" */\n \"aria-label\"?: string;\n className?: string;\n}\n\nconst defaultLabels = { copy: \"Copy\", copied: \"Copied\", edit: \"Edit\", retry: \"Retry\", good: \"Good response\", bad: \"Bad response\" };\n\nfunction CopyAction({ text, label, copiedLabel }: { text: string; label: string; copiedLabel: string }) {\n const [copied, setCopied] = useState(false);\n const timer = useRef(0);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n const current = copied ? copiedLabel : label;\n return (\n <>\n <Tooltip label={current}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={current}\n className={cx(\"ow-chat-actions__copy\", copied && \"ow-chat-actions__copy--copied\")}\n onClick={async () => {\n if (await copyText(text)) {\n setCopied(true);\n window.clearTimeout(timer.current);\n timer.current = window.setTimeout(() => setCopied(false), 2000);\n }\n }}\n >\n <span className=\"ow-chat-actions__copy-icon\">\n <CopyIcon size={16} />\n <CheckIcon size={16} />\n </span>\n </Button>\n </Tooltip>\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {copied ? copiedLabel : \"\"}\n </span>\n </>\n );\n}\n\n/**\n * The row of small actions under a message: Copy, Edit, Retry, and Good or Bad response. Only the ones you give a\n * callback (or `copyText`) appear. It's a toolbar: one tab stop, with the arrow keys moving between the buttons.\n */\nexport function ChatMessageActions({\n copyText: text,\n onEdit,\n onRetry,\n onRate,\n rating,\n defaultRating = null,\n children,\n labels,\n \"aria-label\": ariaLabel = \"Message actions\",\n className,\n}: ChatMessageActionsProps) {\n const words = { ...defaultLabels, ...labels };\n const [current, setCurrent] = useControllableState<ChatRating | null>(rating, defaultRating, onRate);\n\n const rate = (value: ChatRating, label: string, Icon: typeof ThumbsUpIcon) => {\n const pressed = current === value;\n return (\n <Tooltip label={label}>\n <ToggleButton\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={label}\n pressed={pressed}\n className=\"ow-chat-actions__rate\"\n onPressedChange={() => setCurrent(pressed ? null : value)}\n >\n <Icon size={16} />\n </ToggleButton>\n </Tooltip>\n );\n };\n\n return (\n <Toolbar variant=\"plain\" size=\"sm\" aria-label={ariaLabel} className={cx(\"ow-chat-actions\", className)}>\n {text !== undefined ? <CopyAction text={text} label={words.copy} copiedLabel={words.copied} /> : null}\n {onEdit ? (\n <Tooltip label={words.edit}>\n <Button variant=\"ghost\" size=\"sm\" iconOnly aria-label={words.edit} onClick={onEdit}>\n <PencilIcon size={16} />\n </Button>\n </Tooltip>\n ) : null}\n {onRetry ? (\n <Tooltip label={words.retry}>\n <Button variant=\"ghost\" size=\"sm\" iconOnly aria-label={words.retry} onClick={onRetry}>\n <RotateCcwIcon size={16} />\n </Button>\n </Tooltip>\n ) : null}\n {onRate ? (\n <>\n {rate(\"up\", words.good, ThumbsUpIcon)}\n {rate(\"down\", words.bad, ThumbsDownIcon)}\n </>\n ) : null}\n {children}\n </Toolbar>\n );\n}\n", "import type { ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\nimport { ChatAgentAvatar, useChatEntrance } from \"./ChatMessage\";\n\nexport interface ChatLoaderProps {\n /** Words in place of the dots, with a shimmer across them: \"Thinking\u2026\", \"Reading the codebase\u2026\". */\n label?: ReactNode;\n /** Just the dots or the label, without a message's avatar and spacing: for inside a message, a step or a status bar.\n * @default false */\n inline?: boolean;\n /** The agent's name above, as on its messages: \"Acme agent\". */\n name?: ReactNode;\n /** The agent's bot tile by default; any node in its place, or null for none. */\n avatar?: ReactNode;\n /** What screen readers hear while the dots show. With a `label`, they hear the label.\n * @default \"Working\u2026\" */\n srLabel?: string;\n className?: string;\n}\n\n/**\n * The agent is working and nothing has arrived yet: three dots that pulse in turn, or a shimmering label such as\n * \"Thinking\u2026\". It sits in the conversation like the agent's next message, so the answer takes its place without a jump.\n */\nexport function ChatLoader({ label, inline = false, name, avatar, srLabel = \"Working\u2026\", className }: ChatLoaderProps) {\n const entering = useChatEntrance();\n const indicator =\n label != null ? (\n <TextShimmer className=\"ow-chat-loader__label\">{label}</TextShimmer>\n ) : (\n <span className=\"ow-chat-loader__dots\">\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-chat-loader__dot\" aria-hidden=\"true\" />\n <span className=\"ow-visually-hidden\">{srLabel}</span>\n </span>\n );\n\n if (inline) {\n return (\n <span role=\"status\" className={cx(\"ow-chat-loader\", \"ow-chat-loader--inline\", className)}>\n {indicator}\n </span>\n );\n }\n\n const avatarNode = avatar === undefined ? <ChatAgentAvatar /> : avatar;\n return (\n <div role=\"status\" className={cx(\"ow-chat-message\", \"ow-chat-message--assistant\", \"ow-chat-loader\", entering && \"ow-chat-loader--enter\", className)}>\n {avatarNode != null && avatarNode !== false ? <div className=\"ow-chat-message__avatar\">{avatarNode}</div> : null}\n <div className=\"ow-chat-message__main\">\n {name != null ? (\n <div className=\"ow-chat-message__header\">\n <span className=\"ow-chat-message__name\">{name}</span>\n </div>\n ) : null}\n <div className=\"ow-chat-loader__line\">{indicator}</div>\n </div>\n </div>\n );\n}\n", "import { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon, ChevronRightIcon, XIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { Button } from \"../Button/Button\";\nimport { CodeBlock, Snippet } from \"../CodeBlock/CodeBlock\";\nimport { Code } from \"../Kbd/Kbd\";\nimport { Spinner } from \"../Spinner/Spinner\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\n\n/**\n * Where a tool call or a step has got to. `approval` waits for a person to approve it; `cancelled` didn't run or didn't\n * finish because a person denied it or stopped the run.\n */\nexport type ChatToolStatus = \"pending\" | \"running\" | \"success\" | \"error\" | \"approval\" | \"cancelled\";\n\n/* Pieces shared with ChainOfThought and ChatSources: the status mark, durations and the collapsing panel. */\n\nconst statusWords: Record<ChatToolStatus, string> = {\n pending: \"Not started\",\n running: \"Running\",\n success: \"Done\",\n error: \"Failed\",\n approval: \"Needs approval\",\n cancelled: \"Cancelled\",\n};\n\n/** A slash across the ring: it was called off. */\nfunction SlashIcon() {\n return (\n <svg\n width={12}\n height={12}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n\nfunction ExclamationIcon() {\n return (\n <svg\n width={12}\n height={12}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M12 5v9\" />\n <path d=\"M12 19h.01\" />\n </svg>\n );\n}\n\n/** The round mark before a tool call or a step: a spinner, a check, a cross, a \"!\", a slash or a hollow ring, with its status as words for screen readers. */\nexport function ChatStatusMarker({ status, icon }: { status: ChatToolStatus; icon?: ReactNode }) {\n // A step's own icon stands in for the check or the ring; running, failed and waiting always show their mark.\n const showsIcon = Boolean(icon) && (status === \"success\" || status === \"pending\");\n const glyph =\n status === \"running\" ? (\n <Spinner size=\"sm\" label=\"\" />\n ) : status === \"error\" ? (\n <XIcon size={12} strokeWidth={3} />\n ) : status === \"approval\" ? (\n <ExclamationIcon />\n ) : status === \"cancelled\" ? (\n <SlashIcon />\n ) : showsIcon ? (\n icon\n ) : status === \"success\" ? (\n <CheckIcon size={12} strokeWidth={3} />\n ) : null;\n return (\n <span className={cx(\"ow-chat-status\", `ow-chat-status--${status}`, showsIcon && \"ow-chat-status--icon\")}>\n <span className=\"ow-chat-status__glyph\" aria-hidden=\"true\">\n {glyph}\n </span>\n <span className=\"ow-visually-hidden\">{statusWords[status]}: </span>\n </span>\n );\n}\n\n/** \"380 ms\", \"4.2 s\", \"12 s\", \"1 min 12 s\", \"1 h 4 min\": a duration as people say it, with the locale's digits. */\nexport function formatDuration(ms: number, locale?: string): string {\n const number = (value: number, digits = 0) => new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(value);\n const safe = Math.max(0, ms);\n if (safe < 1000) return `${number(Math.round(safe))} ms`;\n const seconds = safe / 1000;\n if (seconds < 10) return `${number(Math.floor(seconds * 10) / 10, 1)} s`;\n if (seconds < 60) return `${number(Math.floor(seconds))} s`;\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) {\n const rest = Math.floor(seconds % 60);\n return rest ? `${number(minutes)} min ${number(rest)} s` : `${number(minutes)} min`;\n }\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n return rest ? `${number(hours)} h ${number(rest)} min` : `${number(hours)} h`;\n}\n\n/** A duration in a <time> element, so it carries a machine-readable value too. */\nexport function ChatDuration({ ms, locale, className }: { ms: number; locale?: string; className?: string }) {\n return (\n <time dateTime={`PT${Math.max(0, Math.round(ms)) / 1000}S`} className={className}>\n {formatDuration(ms, locale)}\n </time>\n );\n}\n\n/**\n * Open state that follows a status: it opens when `wantsOpen` turns true (an error, a step under way) and closes again\n * when it turns false, unless the person has opened or closed it themselves since. A controlled `expanded` is left alone.\n */\nexport function useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen,\n closeWhenSettled = true,\n initial = wantsOpen,\n}: {\n expanded: boolean | undefined;\n defaultExpanded: boolean | undefined;\n onExpandedChange: ((expanded: boolean) => void) | undefined;\n wantsOpen: boolean;\n closeWhenSettled?: boolean;\n initial?: boolean;\n}): [boolean, () => void] {\n const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded ?? initial, onExpandedChange);\n const touched = useRef(false);\n const previous = useRef(wantsOpen);\n\n useEffect(() => {\n if (previous.current === wantsOpen) return;\n previous.current = wantsOpen;\n if (expanded !== undefined) return;\n if (wantsOpen) {\n touched.current = false;\n setOpen(true);\n } else if (closeWhenSettled && !touched.current) {\n setOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only a change of status moves it.\n }, [wantsOpen]);\n\n return [\n isOpen,\n () => {\n touched.current = true;\n setOpen(!isOpen);\n },\n ];\n}\n\n/**\n * A panel that opens and closes under a disclosure button, animating its height (a 0fr \u2192 1fr grid row). Closed, it's\n * inert: nothing in it can be tabbed to or read out. `bleed` lets focus rings at its edges show past the clip.\n */\nexport function ChatCollapse({\n id,\n open,\n bleed = false,\n className,\n children,\n}: {\n id: string;\n open: boolean;\n bleed?: boolean;\n className?: string;\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (ref.current) ref.current.inert = !open;\n }, [open]);\n return (\n <div ref={ref} id={id} className={cx(\"ow-chat-collapse\", bleed && \"ow-chat-collapse--bleed\")} data-open={open}>\n <div className=\"ow-chat-collapse__clip\">\n <div className={className}>{children}</div>\n </div>\n </div>\n );\n}\n\nexport interface ChatToolProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** What the agent is doing, in words: \"Run the test suite\". */\n title: ReactNode;\n /** The tool it calls, shown in code type beside the title: \"run_tests\". */\n name?: string;\n /** A 15px icon for the tool, before the title. */\n icon?: ReactNode;\n /** Where the call has got to. Running shows a spinner and a shimmering title; `approval` asks the person to approve it;\n * `cancelled` is for a call they denied, or one the run stopped before it finished: say which in `summary`. */\n status: ChatToolStatus;\n /** The result in one line: \"212 tests passed\", \"Read 3 files\". */\n summary?: ReactNode;\n /** How long it took, or has taken so far, in milliseconds. Shown as \"4.2 s\". */\n duration?: number;\n /** What the tool was called with: a one-line string (a command) in a Snippet, a longer one in a code block, or an\n * object as formatted JSON. Shown under \"Input\". */\n input?: string | Record<string, unknown> | unknown[];\n /** What the tool returned: a string in a code block, or any node (a list of files, a link). Shown under \"Output\". */\n output?: ReactNode;\n /** What went wrong, shown in the danger colour under \"Error\". */\n error?: ReactNode;\n /** Whether the input and output show. Leave out to let it follow the status: closed, opening for an error or an approval. */\n expanded?: boolean;\n /** Whether it starts open. Defaults to open for an error or an approval and closed otherwise. */\n defaultExpanded?: boolean;\n /** Called with the new state when it opens or closes, by the person or by a change of status. */\n onExpandedChange?(expanded: boolean): void;\n /** What it asks to do, while `status` is \"approval\". Defaults to \"Wants to run\" and the tool's name. */\n approvalMessage?: ReactNode;\n /** The approve button's label: name the action, e.g. \"Approve and publish\".\n * @default \"Approve\" */\n approveLabel?: string;\n /** The deny button's label, e.g. \"Don't publish\".\n * @default \"Deny\" */\n denyLabel?: string;\n /** Called when the person approves the call. Move `status` on from \"approval\" in response. */\n onApprove?(): void;\n /** Called when the person refuses the call. Move `status` on to \"cancelled\" in response. */\n onDeny?(): void;\n /** The locale for the duration's digits, e.g. \"de-CH\". Defaults to the browser's. */\n locale?: string;\n}\n\n/** The longest an input or output gets before it scrolls. */\nconst codeMaxHeight = 280;\n\nfunction formatInput(input: NonNullable<ChatToolProps[\"input\"]>): string {\n if (typeof input === \"string\") return input;\n try {\n return JSON.stringify(input, null, 2);\n } catch {\n return String(input);\n }\n}\n\n/**\n * One tool call an agent makes: what it's doing, the tool, its status and result on one row, which opens to show the\n * input and output. A failed call opens to its error, and a call that needs approval asks for it with Approve and Deny.\n */\nexport const ChatTool = /* @__PURE__ */ forwardRef<HTMLDivElement, ChatToolProps>(function ChatTool(\n {\n title,\n name,\n icon,\n status,\n summary,\n duration,\n input,\n output,\n error,\n expanded,\n defaultExpanded,\n onExpandedChange,\n approvalMessage,\n approveLabel = \"Approve\",\n denyLabel = \"Deny\",\n onApprove,\n onDeny,\n locale,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const messageRef = useRef<HTMLParagraphElement>(null);\n const decided = useRef(false);\n const [announcement, setAnnouncement] = useState(\"\");\n\n const needsApproval = status === \"approval\";\n const [isOpen, toggle] = useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen: status === \"error\" || needsApproval,\n });\n\n const hasInput = input !== undefined && input !== null && input !== \"\";\n const hasOutput = output !== undefined && output !== null && output !== false && output !== \"\";\n const hasError = error !== undefined && error !== null && error !== false && error !== \"\";\n const hasDetails = hasInput || hasOutput || hasError;\n const hasMeta = Boolean(summary) || duration !== undefined;\n\n // Say politely that the agent is waiting for the person, once the request is on screen. The region starts empty\n // and fills a moment later, so screen readers notice the change even when it mounts already waiting.\n useEffect(() => {\n if (!needsApproval) {\n setAnnouncement(\"\");\n return;\n }\n const timer = window.setTimeout(() => {\n const request = messageRef.current?.textContent?.trim();\n setAnnouncement(`Needs approval. ${request ?? \"\"}`.trim());\n }, 150);\n return () => window.clearTimeout(timer);\n }, [needsApproval]);\n\n // Approving or denying removes the buttons; keep the keyboard on this call rather than losing it to the page.\n useEffect(() => {\n if (needsApproval || !decided.current) return;\n decided.current = false;\n const active = document.activeElement;\n if (!active || active === document.body) (triggerRef.current ?? rootRef.current)?.focus();\n }, [needsApproval]);\n\n const running = status === \"running\";\n const header = (\n <>\n <ChatStatusMarker status={status} />\n {icon ? (\n <span className=\"ow-chat-tool__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"ow-chat-tool__main\">\n <span className=\"ow-chat-tool__heading\">\n <span className=\"ow-chat-tool__title\">{running ? <TextShimmer>{title}</TextShimmer> : title}</span>\n {name ? <Code className=\"ow-chat-tool__name\">{name}</Code> : null}\n </span>\n {hasMeta ? (\n <span className=\"ow-chat-tool__meta\">\n {summary ? <span className=\"ow-chat-tool__summary\">{summary}</span> : null}\n {summary && duration !== undefined ? (\n <span className=\"ow-chat-tool__dot\" aria-hidden=\"true\">\n \u00B7\n </span>\n ) : null}\n {duration !== undefined ? <ChatDuration ms={duration} locale={locale} className=\"ow-chat-tool__duration\" /> : null}\n </span>\n ) : null}\n </span>\n {hasDetails ? (\n <span className=\"ow-chat-tool__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n ) : null}\n </>\n );\n\n return (\n <div\n ref={(element) => {\n rootRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n }}\n className={cx(\"ow-chat-tool\", className)}\n data-status={status}\n data-open={hasDetails ? isOpen : undefined}\n aria-busy={running || undefined}\n tabIndex={hasDetails ? undefined : -1}\n {...props}\n >\n {hasDetails ? (\n <button\n ref={triggerRef}\n type=\"button\"\n id={`${id}-trigger`}\n className=\"ow-chat-tool__header ow-chat-tool__header--button\"\n aria-expanded={isOpen}\n aria-controls={`${id}-details`}\n onClick={toggle}\n >\n {header}\n </button>\n ) : (\n <div className=\"ow-chat-tool__header\">{header}</div>\n )}\n\n {hasDetails ? (\n <ChatCollapse id={`${id}-details`} open={isOpen} className=\"ow-chat-tool__details\">\n {hasInput ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Input</span>\n {typeof input === \"string\" && !input.includes(\"\\n\") ? (\n <Snippet value={input} prompt={null} />\n ) : (\n <CodeBlock code={formatInput(input)} language={typeof input === \"string\" ? undefined : \"json\"} maxHeight={codeMaxHeight} />\n )}\n </div>\n ) : null}\n {hasOutput ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Output</span>\n {typeof output === \"string\" ? (\n <CodeBlock code={output} maxHeight={codeMaxHeight} />\n ) : (\n <div className=\"ow-chat-tool__output\">{output}</div>\n )}\n </div>\n ) : null}\n {hasError ? (\n <div className=\"ow-chat-tool__section\">\n <span className=\"ow-chat-tool__label\">Error</span>\n <div className=\"ow-chat-tool__error\">{error}</div>\n </div>\n ) : null}\n </ChatCollapse>\n ) : null}\n\n {needsApproval ? (\n <div className=\"ow-chat-tool__approval\" role=\"group\" aria-labelledby={`${id}-request`}>\n <p ref={messageRef} id={`${id}-request`} className=\"ow-chat-tool__request\">\n {approvalMessage ??\n (name ? (\n <>\n Wants to run <Code>{name}</Code>\n </>\n ) : (\n \"Wants to go ahead\"\n ))}\n </p>\n <div className=\"ow-chat-tool__actions\">\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={() => {\n decided.current = true;\n onApprove?.();\n }}\n >\n {approveLabel}\n </Button>\n <Button\n size=\"sm\"\n onClick={() => {\n decided.current = true;\n onDeny?.();\n }}\n >\n {denyLabel}\n </Button>\n </div>\n </div>\n ) : null}\n\n <span className=\"ow-visually-hidden\" aria-live=\"polite\">\n {announcement}\n </span>\n </div>\n );\n});\n", "import { forwardRef, useId, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { ChevronRightIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { ChatCollapse, ChatStatusMarker, formatDuration, useStatusExpansion } from \"../ChatTool/ChatTool\";\nimport { TextShimmer } from \"../TextShimmer/TextShimmer\";\n\n/** Where the reasoning, or one step of it, has got to. */\nexport type ChainOfThoughtStatus = \"pending\" | \"running\" | \"success\" | \"error\";\n\nexport interface ChainOfThoughtStep {\n /** A stable key for the step, so it keeps its place as steps are added. */\n id: string;\n /** The step in words: \"Find where invoice dates are formatted\". */\n title: ReactNode;\n /** Where the step has got to: a hollow ring, a spinner, a check or a cross. */\n status: ChainOfThoughtStatus;\n /** More about the step under its title: what it found, a file path, a short list. */\n detail?: ReactNode;\n /** A 12px icon in place of the check or the hollow ring, e.g. a search icon. Running and failed steps keep their own mark. */\n icon?: ReactNode;\n}\n\nexport interface ChainOfThoughtProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The plan, in order, each with its status. */\n steps?: ChainOfThoughtStep[];\n /** \"running\" shows \"Thinking\u2026\" with a shimmer and keeps it open; anything else is finished.\n * @default \"success\" */\n status?: ChainOfThoughtStatus;\n /** How long it thought, in milliseconds: \"Thought for 12 s\". */\n duration?: number;\n /** The header's words. Defaults to \"Thinking\u2026\" while running and \"Thought for 12 s\" once done. */\n label?: ReactNode;\n /** The reasoning itself, as text, shown above the steps. It can grow while it streams in. */\n children?: ReactNode;\n /** Whether the reasoning shows. Leave out to let it follow `status`. */\n expanded?: boolean;\n /** Whether it starts open. Defaults to open while running and closed once done. */\n defaultExpanded?: boolean;\n /** Called with the new state when it opens or closes, by the person or by a change of status. */\n onExpandedChange?(expanded: boolean): void;\n /** Folds the reasoning away when `status` turns from \"running\" to done, unless the person has opened or closed it.\n * @default true */\n collapseWhenDone?: boolean;\n /** The locale for the duration's digits, e.g. \"de-CH\". Defaults to the browser's. */\n locale?: string;\n}\n\nconst plural = (count: number, word: string) => `${count} ${word}${count === 1 ? \"\" : \"s\"}`;\n\n/**\n * An agent's reasoning and plan: a \"Thinking\u2026\" header that opens to the reasoning and a list of steps on a thin line,\n * each with its status. It stays open while the agent works and folds to \"Thought for 12 s\" when it's done.\n */\nexport const ChainOfThought = /* @__PURE__ */ forwardRef<HTMLDivElement, ChainOfThoughtProps>(function ChainOfThought(\n {\n steps = [],\n status = \"success\",\n duration,\n label,\n children,\n expanded,\n defaultExpanded,\n onExpandedChange,\n collapseWhenDone = true,\n locale,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const running = status === \"running\";\n const [isOpen, toggle] = useStatusExpansion({\n expanded,\n defaultExpanded,\n onExpandedChange,\n wantsOpen: running,\n closeWhenSettled: collapseWhenDone,\n initial: running || !collapseWhenDone,\n });\n\n const hasReasoning = children !== undefined && children !== null && children !== false && children !== \"\";\n const hasBody = hasReasoning || steps.length > 0;\n const finished = steps.filter((step) => step.status === \"success\" || step.status === \"error\").length;\n const failed = steps.filter((step) => step.status === \"error\").length;\n\n const heading = label ?? (running ? \"Thinking\u2026\" : duration !== undefined ? `Thought for ${formatDuration(duration, locale)}` : \"Reasoning\");\n const count = steps.length > 0 ? (running ? `${finished} of ${plural(steps.length, \"step\")}` : plural(steps.length, \"step\")) : null;\n\n const headerText = (\n <span className=\"ow-chat-toggle__text\">\n <span className=\"ow-chain-of-thought__label\">{running ? <TextShimmer>{heading}</TextShimmer> : heading}</span>\n {count ? (\n <span className=\"ow-chat-toggle__meta\">\n <span aria-hidden=\"true\">\u00B7 </span>\n {count}\n {failed > 0 ? <span className=\"ow-chain-of-thought__failed\">, {failed} failed</span> : null}\n </span>\n ) : null}\n </span>\n );\n\n return (\n <div ref={ref} className={cx(\"ow-chain-of-thought\", className)} data-status={status} aria-busy={running || undefined} {...props}>\n {hasBody ? (\n <button type=\"button\" className=\"ow-chat-toggle\" aria-expanded={isOpen} aria-controls={`${id}-body`} onClick={toggle}>\n <span className=\"ow-chat-toggle__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n {headerText}\n </button>\n ) : (\n <div className=\"ow-chat-toggle ow-chain-of-thought__static\">{headerText}</div>\n )}\n {hasBody ? (\n <ChatCollapse id={`${id}-body`} open={isOpen} bleed className=\"ow-chain-of-thought__body\">\n {hasReasoning ? <div className=\"ow-chain-of-thought__reasoning\">{children}</div> : null}\n {steps.length > 0 ? (\n <ol className=\"ow-chain-of-thought__steps\">\n {steps.map((step) => (\n <li key={step.id} className=\"ow-chain-of-thought__step\" data-status={step.status}>\n <ChatStatusMarker status={step.status} icon={step.icon} />\n <div className=\"ow-chain-of-thought__step-body\">\n <span className=\"ow-chain-of-thought__step-title\">\n {step.status === \"running\" ? <TextShimmer>{step.title}</TextShimmer> : step.title}\n </span>\n {step.detail !== undefined && step.detail !== null ? (\n <div className=\"ow-chain-of-thought__detail\">{step.detail}</div>\n ) : null}\n </div>\n </li>\n ))}\n </ol>\n ) : null}\n </ChatCollapse>\n ) : null}\n </div>\n );\n});\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type HTMLAttributes, type MouseEvent, type ReactNode } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating } from \"../../hooks/useFloating\";\nimport { usePresence } from \"../../hooks/usePresence\";\nimport { ArrowUpRightIcon, ChevronRightIcon, FileIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { linkClassName } from \"../Breadcrumbs/Breadcrumbs\";\nimport { ChatCollapse } from \"../ChatTool/ChatTool\";\n\n/** One source an answer drew on: a file, a pull request, a web page. ChatSource and ChatSources both take it. */\nexport interface ChatSourceItem {\n /** What it is: a function, a pull request's title, a page's title. */\n title: ReactNode;\n /** Where it is, in one line: \"src/billing/invoice.ts \u00B7 lines 40\u201372\", \"Pull request #482\", \"docs.stripe.com\". */\n source?: ReactNode;\n /** A few lines from it, in the preview. ChatSources leaves it out. */\n snippet?: ReactNode;\n /** Where it opens. With it the citation is a link; without, a button. */\n href?: string;\n /** Opens `href` in a new tab, for sources outside your app.\n * @default false */\n external?: boolean;\n /** A 15px icon for the kind of source, beside its title. */\n icon?: ReactNode;\n /** Its number, shown in the citation chip and on its card: [1], [2]. */\n index?: number;\n}\n\nexport interface ChatSourceProps extends ChatSourceItem {\n /** A short name for the chip when there's no `index`: \"invoice.ts\", \"#482\". */\n label?: string;\n /** How a string `snippet` shows: `text` as a quote, `code` in the mono face with its line breaks kept.\n * @default \"text\" */\n snippetFormat?: \"text\" | \"code\";\n /** The words of the preview's link to `href`.\n * @default \"Open\" */\n openLabel?: string;\n /** Called when the chip is pressed, e.g. to show the source in a side panel. On touch, the first press opens the preview instead. */\n onClick?(event: MouseEvent<HTMLElement>): void;\n /** Names the chip for screen readers. Defaults to \"Source 1\", or the label. */\n \"aria-label\"?: string;\n /** Classes for the chip's wrapper, which also holds the preview. */\n className?: string;\n}\n\nconst openDelay = 250;\nconst closeDelay = 150;\n\n/**\n * An inline citation in an answer: a small numbered chip that previews its source on hover, keyboard focus, or a tap,\n * in a card above the page. The chip is a link to the source when it has an `href`; the preview describes it to screen\n * readers without taking focus.\n */\nexport const ChatSource = /* @__PURE__ */ forwardRef<HTMLElement, ChatSourceProps>(function ChatSource(\n {\n title,\n source,\n snippet,\n href,\n external = false,\n icon,\n index,\n label,\n snippetFormat = \"text\",\n openLabel = \"Open\",\n onClick,\n \"aria-label\": ariaLabel,\n className,\n },\n ref,\n) {\n const id = useId();\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const chipRef = useRef<HTMLElement | null>(null);\n const cardRef = useRef<HTMLSpanElement>(null);\n const timer = useRef(0);\n // How the last press started, so a tap can open the preview before it follows the link.\n const pointer = useRef(\"mouse\");\n const [open, setOpen] = useState(false);\n const { mounted, state } = usePresence(open);\n const style = useFloating({ open: mounted, anchorRef: chipRef, floatingRef: cardRef, placement: \"bottom-start\", offset: 6, maxHeight: 360 });\n\n const schedule = (next: boolean, delay: number) => {\n window.clearTimeout(timer.current);\n if (delay === 0) setOpen(next);\n else timer.current = window.setTimeout(() => setOpen(next), delay);\n };\n const close = useCallback(() => {\n window.clearTimeout(timer.current);\n setOpen(false);\n }, []);\n useDismiss(open, [wrapperRef], close);\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n const name = ariaLabel ?? (index !== undefined ? `Source ${index}` : (label ?? \"Source\"));\n const describedBy = [`${id}-title`, source ? `${id}-source` : null, snippet ? `${id}-snippet` : null].filter(Boolean).join(\" \");\n const externalProps = external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {};\n\n const chipProps = {\n ref: (element: HTMLElement | null) => {\n chipRef.current = element;\n if (typeof ref === \"function\") ref(element);\n else if (ref) ref.current = element;\n },\n className: cx(\"ow-chat-source__chip\", index === undefined && \"ow-chat-source__chip--label\", open && \"ow-chat-source__chip--open\"),\n \"aria-label\": name,\n \"aria-describedby\": describedBy,\n onFocus: (event: { currentTarget: HTMLElement }) => {\n if (event.currentTarget.matches(\":focus-visible\")) schedule(true, 0);\n },\n onBlur: () => schedule(false, 0),\n onPointerDown: (event: { pointerType: string }) => {\n pointer.current = event.pointerType;\n },\n onClick: (event: MouseEvent<HTMLElement>) => {\n const tapped = event.detail > 0 && pointer.current !== \"mouse\";\n pointer.current = \"mouse\";\n if (tapped && !open) {\n // The first tap shows the preview; the next one follows the link.\n event.preventDefault();\n schedule(true, 0);\n return;\n }\n if (!href) schedule(true, 0);\n onClick?.(event);\n },\n };\n\n const chipText = <span className=\"ow-chat-source__chip-text\">{index ?? label}</span>;\n\n return (\n <span\n ref={wrapperRef}\n className={cx(\"ow-chat-source\", className)}\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") schedule(true, open ? 0 : openDelay);\n }}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") schedule(false, closeDelay);\n }}\n >\n {href ? (\n <a href={href} {...externalProps} {...chipProps}>\n {chipText}\n </a>\n ) : (\n <button type=\"button\" {...chipProps}>\n {chipText}\n </button>\n )}\n <span ref={cardRef} {...manualPopover} hidden={!mounted} data-state={state} className=\"ow-chat-source-card ow-floating\" style={style}>\n <span className=\"ow-chat-source-card__header\">\n {icon ? (\n <span className=\"ow-chat-source-card__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span id={`${id}-title`} className=\"ow-chat-source-card__title\">\n {title}\n </span>\n </span>\n {source ? (\n <span id={`${id}-source`} className=\"ow-chat-source-card__source\">\n {source}\n </span>\n ) : null}\n {snippet ? (\n <span id={`${id}-snippet`} className={cx(\"ow-chat-source-card__snippet\", `ow-chat-source-card__snippet--${snippetFormat}`)}>\n {snippet}\n </span>\n ) : null}\n {href ? (\n // The chip is the same link, so this one stays out of the tab order.\n <a href={href} {...externalProps} tabIndex={-1} className={cx(linkClassName({ variant: \"standalone\" }), \"ow-chat-source-card__open\")}>\n {openLabel}\n <ArrowUpRightIcon size={13} />\n </a>\n ) : null}\n </span>\n </span>\n );\n});\n\nexport interface ChatSourcesProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The sources, in the order the answer cites them. An `id` keeps each one's place as the list changes. */\n sources: Array<ChatSourceItem & { id?: string }>;\n /** The toggle's words. Defaults to \"3 sources\". */\n label?: ReactNode;\n /** Whether the list shows. */\n expanded?: boolean;\n /** Whether the list starts open.\n * @default false */\n defaultExpanded?: boolean;\n /** Called with the new state when the person opens or closes the list. */\n onExpandedChange?(expanded: boolean): void;\n}\n\n/** The sources under an answer: a \"3 sources\" toggle that opens to a card for each, linking to it when it has an `href`. */\nexport const ChatSources = /* @__PURE__ */ forwardRef<HTMLDivElement, ChatSourcesProps>(function ChatSources(\n { sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props },\n ref,\n) {\n const id = useId();\n const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded, onExpandedChange);\n if (sources.length === 0) return null;\n\n return (\n <div ref={ref} className={cx(\"ow-chat-sources\", className)} {...props}>\n <button type=\"button\" className=\"ow-chat-toggle\" aria-expanded={isOpen} aria-controls={`${id}-list`} onClick={() => setOpen(!isOpen)}>\n <span className=\"ow-chat-toggle__chevron\" aria-hidden=\"true\">\n <ChevronRightIcon size={14} />\n </span>\n <span className=\"ow-chat-toggle__text\">{label ?? `${sources.length} ${sources.length === 1 ? \"source\" : \"sources\"}`}</span>\n </button>\n <ChatCollapse id={`${id}-list`} open={isOpen} bleed className=\"ow-chat-sources__body\">\n <ul className=\"ow-chat-sources__list\">\n {sources.map((item, position) => {\n const content = (\n <>\n <span className=\"ow-chat-sources__lead\">\n {item.index !== undefined ? (\n <span className=\"ow-chat-sources__index\">\n <span className=\"ow-visually-hidden\">Source </span>\n {item.index}\n </span>\n ) : null}\n {item.icon || item.index === undefined ? (\n <span className=\"ow-chat-sources__icon\" aria-hidden=\"true\">\n {item.icon ?? <FileIcon size={15} />}\n </span>\n ) : null}\n </span>\n <span className=\"ow-chat-sources__text\">\n <span className=\"ow-chat-sources__title\">{item.title}</span>\n {item.source ? <span className=\"ow-chat-sources__source\">{item.source}</span> : null}\n </span>\n {item.href && item.external ? (\n <>\n <span className=\"ow-chat-sources__external\" aria-hidden=\"true\">\n <ArrowUpRightIcon size={14} />\n </span>\n <span className=\"ow-visually-hidden\"> (opens in a new tab)</span>\n </>\n ) : null}\n </>\n );\n return (\n <li key={item.id ?? item.index ?? position}>\n {item.href ? (\n <a\n href={item.href}\n className=\"ow-chat-sources__card ow-chat-sources__card--link\"\n {...(item.external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})}\n >\n {content}\n </a>\n ) : (\n <div className=\"ow-chat-sources__card\">{content}</div>\n )}\n </li>\n );\n })}\n </ul>\n </ChatCollapse>\n </div>\n );\n});\n", "import { forwardRef, useCallback, useEffect, useId, useRef, useState, type CSSProperties, type ForwardedRef } from \"react\";\nimport { HexAlphaColorPicker, HexColorInput, HexColorPicker } from \"react-colorful\";\n\nimport { useControllableState } from \"@/hooks/useControllableState\";\nimport { manualPopover, useDismiss, useFloating, type Placement } from \"@/hooks/useFloating\";\nimport { usePresence } from \"@/hooks/usePresence\";\nimport { ChevronDownIcon, PipetteIcon } from \"@/icons\";\nimport { cx } from \"@/utils/cx\";\nimport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption, EyeDropperResult } from \"./ColorPicker.types\";\nexport type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from \"./ColorPicker.types\";\n\nconst swatchColor = (swatch: ColorSwatchOption) => (typeof swatch === \"string\" ? swatch : swatch.color);\nconst swatchName = (swatch: ColorSwatchOption) => (typeof swatch === \"string\" ? swatch : swatch.name);\nconst same = (a: string, b: string) => a.toLowerCase().replace(/^#/, \"\") === b.toLowerCase().replace(/^#/, \"\");\n\n/**\n * Picks a colour: a saturation area and a hue slider (react-colorful, dressed in Openware's look), a hex field,\n * an eyedropper where the browser has one, and optional swatches. The area and sliders work with the arrow keys.\n */\nexport function ColorPicker({\n value,\n defaultValue = \"#312c7e\",\n onChange,\n alpha = false,\n swatches,\n showInput = true,\n eyeDropper = true,\n \"aria-label\": ariaLabel = \"Colour\",\n className,\n}: ColorPickerProps) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const [canPick, setCanPick] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n useEffect(() => setCanPick(typeof window !== \"undefined\" && \"EyeDropper\" in window), []);\n\n // react-colorful names its sliders \"Color\", \"Hue\" and \"Alpha\"; read them out in Openware's words.\n useEffect(() => {\n const names: Record<string, string> = { saturation: \"Colour\", hue: \"Hue\", alpha: \"Opacity\" };\n for (const [part, label] of Object.entries(names)) {\n rootRef.current?.querySelector(`.react-colorful__${part} .react-colorful__interactive`)?.setAttribute(\"aria-label\", label);\n }\n }, [alpha]);\n const Picker = alpha ? HexAlphaColorPicker : HexColorPicker;\n const change = (next: string) => setColor(next.toLowerCase());\n\n async function pickFromScreen() {\n if (!window.EyeDropper) return;\n try {\n const result = await new window.EyeDropper().open();\n change(result.sRGBHex);\n } catch {\n // Escape pressed: nothing picked.\n }\n }\n\n return (\n <div ref={rootRef} role=\"group\" aria-label={ariaLabel} className={cx(\"ow-color-picker\", className)}>\n <Picker color={color} onChange={change} />\n {showInput || (eyeDropper && canPick) ? (\n <div className=\"ow-color-picker__row\">\n {eyeDropper && canPick ? (\n <button type=\"button\" className=\"ow-color-picker__dropper\" aria-label=\"Pick a colour from the screen\" onClick={pickFromScreen}>\n <PipetteIcon size={15} />\n </button>\n ) : null}\n {showInput ? (\n <span className=\"ow-input-group ow-input-group--sm ow-color-picker__input\">\n <span className=\"ow-input-group__addon\" aria-hidden=\"true\">\n #\n </span>\n <HexColorInput\n className=\"ow-input-group__input\"\n color={color}\n onChange={change}\n alpha={alpha}\n aria-label=\"Hex colour\"\n spellCheck={false}\n />\n </span>\n ) : null}\n <span className=\"ow-color-picker__preview\" style={{ \"--ow-color-picker-value\": color } as CSSProperties} aria-hidden=\"true\" />\n </div>\n ) : null}\n {swatches?.length ? (\n <div className=\"ow-color-picker__swatches\" role=\"group\" aria-label=\"Swatches\">\n {swatches.map((swatch) => {\n const swatchValue = swatchColor(swatch);\n return (\n <button\n key={swatchValue}\n type=\"button\"\n className=\"ow-color-picker__swatch\"\n style={{ \"--ow-color-picker-value\": swatchValue } as CSSProperties}\n aria-label={swatchName(swatch)}\n aria-pressed={same(swatchValue, color)}\n title={swatchName(swatch)}\n onClick={() => change(swatchValue)}\n />\n );\n })}\n </div>\n ) : null}\n </div>\n );\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/** A field that shows a colour and its hex, and opens a ColorPicker below. Escape or a click outside closes it. */\nexport const ColorField = /* @__PURE__ */ forwardRef<HTMLButtonElement, ColorFieldProps>(function ColorField(\n {\n value,\n defaultValue = \"#312c7e\",\n onChange,\n size = \"md\",\n isInvalid = false,\n disabled = false,\n placement = \"bottom-start\",\n id,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...pickerProps\n },\n ref,\n) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const [isOpen, setOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const { mounted, state } = usePresence(isOpen);\n const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement, offset: 6, maxHeight: 640 });\n\n const close = useCallback((reason?: \"outside\" | \"escape\") => {\n setOpen(false);\n if (reason !== \"outside\") triggerRef.current?.focus();\n }, []);\n useDismiss(isOpen, [panelRef, triggerRef], close);\n\n // Focus the colour area when it opens, so the arrow keys work straight away.\n useEffect(() => {\n if (!isOpen) return undefined;\n const frame = requestAnimationFrame(() => panelRef.current?.querySelector<HTMLElement>(\".react-colorful__interactive\")?.focus());\n return () => cancelAnimationFrame(frame);\n }, [isOpen]);\n\n return (\n <>\n <button\n ref={(element) => {\n triggerRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? panelId : undefined}\n // Named by its label, then the value it shows: the name holds the visible text, as voice control needs.\n aria-label={ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${color.toUpperCase()}` : undefined}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n className={cx(\n \"ow-select\",\n \"ow-color-field\",\n `ow-select--${size}`,\n { \"ow-select--open\": isOpen, \"ow-select--invalid\": isInvalid && !isOpen },\n className,\n )}\n onClick={() => setOpen(!isOpen)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" && !isOpen) {\n event.preventDefault();\n setOpen(true);\n }\n }}\n >\n <span className=\"ow-color-field__swatch\" style={{ \"--ow-color-picker-value\": color } as CSSProperties} aria-hidden=\"true\" />\n <span id={`${panelId}-value`} className=\"ow-select__value ow-color-field__value\">\n {color.toUpperCase()}\n </span>\n <ChevronDownIcon size={size === \"sm\" ? 14 : 16} className=\"ow-select__chevron\" />\n </button>\n {mounted ? (\n <div\n ref={panelRef}\n {...manualPopover}\n data-state={state}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a colour\"\n className=\"ow-popover ow-floating ow-color-field__panel\"\n style={style}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && (event.target as HTMLElement).closest(\".react-colorful\")) close();\n }}\n >\n <ColorPicker {...pickerProps} value={color} onChange={setColor} />\n </div>\n ) : null}\n </>\n );\n});\n", "import { forwardRef, useRef, useState, type CSSProperties, type ForwardedRef, type KeyboardEvent } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport { clamp, describeColor, hsvModel, hueHex, toHex, useColorModel, useDrag } from \"./color\";\n\nexport interface ColorAreaProps {\n /** The colour as hex, \"#0d9488\". Given with alpha (\"#0d9488cc\"), it keeps the alpha. */\n value?: string;\n /** The starting colour when uncontrolled.\n * @default \"#312c7e\" */\n defaultValue?: string;\n /** Called with a lowercase hex as the person drags or presses the arrow keys. */\n onChange?(color: string): void;\n /** Called when the person lets go or releases the key, for work too slow to do on every move. */\n onChangeEnd?(color: string): void;\n /** The hue to show while the colour is a grey, which has none of its own. Pass a hue ColorSlider's `onHueChange`\n * value here to keep the two in step on greys. Without it, the area keeps the last hue it had. */\n hue?: number;\n /** Pixels, or any CSS width. It never grows past its container.\n * @default 232 */\n width?: number | string;\n /** Pixels, or any CSS height.\n * @default 152 */\n height?: number | string;\n /** Fades it; the pointer and the keys do nothing.\n * @default false */\n disabled?: boolean;\n /** The locale for the percentages screen readers hear. Defaults to the browser's. */\n locale?: string;\n /** The form field name; the hex is submitted under it. */\n name?: string;\n /** Names the area for screen readers; its two sliders are \"Saturation\" and \"Brightness\" within it.\n * @default \"Colour\" */\n \"aria-label\"?: string;\n /** Names the area by a visible label's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out after each slider's value. */\n \"aria-describedby\"?: string;\n /** The group's id. */\n id?: string;\n /** Classes for the area, e.g. a size. */\n className?: string;\n}\n\ntype Axis = \"x\" | \"y\";\n\nconst size = (length: number | string | undefined) => (typeof length === \"number\" ? `${length}px` : length);\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * A square of one hue: saturation across, brightness up and down. Drag the thumb, or use the arrow keys.\n * To screen readers it's two sliders, saturation and brightness, each reading out the colour.\n * The ref is the saturation slider's input, for focusing it.\n */\nexport const ColorArea = /* @__PURE__ */ forwardRef<HTMLInputElement, ColorAreaProps>(function ColorArea(\n {\n value,\n defaultValue = \"#312c7e\",\n onChange,\n onChangeEnd,\n hue,\n width,\n height,\n disabled = false,\n locale,\n name,\n \"aria-label\": ariaLabel = \"Colour\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n className,\n },\n ref,\n) {\n const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue, onChange, hsvModel, { hue });\n const rootRef = useRef<HTMLDivElement>(null);\n const inputs = useRef<Record<Axis, HTMLInputElement | null>>({ x: null, y: null });\n // Only one of the two sliders is a tab stop: the one last used.\n const [axis, setAxis] = useState<Axis>(\"x\");\n const isRtl = () => (rootRef.current ? getComputedStyle(rootRef.current).direction === \"rtl\" : false);\n const end = () => onChangeEnd?.(latest());\n\n const drag = useDrag({\n onMove: (x, y) => set({ ...hsv, s: (isRtl() ? 1 - x : x) * 100, v: (1 - y) * 100 }),\n onEnd: end,\n onStart: () => inputs.current[axis]?.focus({ preventScroll: true }),\n disabled,\n });\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n drag.keyboard();\n const step = event.shiftKey ? 10 : 1;\n const forward = isRtl() ? -1 : 1;\n let { s, v } = hsv;\n let moved: Axis = \"x\";\n switch (event.key) {\n case \"ArrowRight\":\n s = Math.round(s) + step * forward;\n break;\n case \"ArrowLeft\":\n s = Math.round(s) - step * forward;\n break;\n case \"Home\":\n s = 0;\n break;\n case \"End\":\n s = 100;\n break;\n case \"ArrowUp\":\n case \"PageUp\":\n v = Math.round(v) + (event.key === \"PageUp\" ? 10 : step);\n moved = \"y\";\n break;\n case \"ArrowDown\":\n case \"PageDown\":\n v = Math.round(v) - (event.key === \"PageDown\" ? 10 : step);\n moved = \"y\";\n break;\n default:\n return;\n }\n event.preventDefault();\n set({ ...hsv, s: clamp(s, 0, 100), v: clamp(v, 0, 100) });\n // Move focus to the slider for the axis that changed, so a screen reader reads that one.\n if (moved !== axis) {\n setAxis(moved);\n inputs.current[moved]?.focus({ preventScroll: true });\n }\n }\n\n function onKeyUp(event: KeyboardEvent<HTMLInputElement>) {\n if (/^(Arrow|Page|Home|End)/.test(event.key)) end();\n }\n\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 });\n const saturation = `Saturation ${percent.format(hsv.s / 100)}`;\n const brightness = `brightness ${percent.format(hsv.v / 100)}`;\n const colorName = describeColor(rgba);\n\n const input = (which: Axis) => (\n <input\n ref={(element) => {\n inputs.current[which] = element;\n if (which === \"x\") assignRef(ref, element);\n }}\n type=\"range\"\n className=\"ow-visually-hidden\"\n min={0}\n max={100}\n step={1}\n value={Math.round(which === \"x\" ? hsv.s : hsv.v)}\n disabled={disabled}\n tabIndex={axis === which ? undefined : -1}\n aria-label={which === \"x\" ? \"Saturation\" : \"Brightness\"}\n aria-roledescription=\"2D slider\"\n aria-orientation={which === \"x\" ? \"horizontal\" : \"vertical\"}\n aria-valuetext={\n which === \"x\"\n ? `${saturation}, ${brightness}, ${colorName}`\n : `${brightness[0]!.toUpperCase()}${brightness.slice(1)}, ${saturation.toLowerCase()}, ${colorName}`\n }\n aria-describedby={ariaDescribedBy}\n onChange={(event) => set({ ...hsv, [which === \"x\" ? \"s\" : \"v\"]: Number(event.target.value) })}\n onFocus={() => setAxis(which)}\n onBlur={drag.keyboard}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n />\n );\n\n return (\n <div\n ref={rootRef}\n id={id}\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-color-area\",\n { \"ow-color-area--dragging\": drag.dragging, \"ow-color-area--pointer\": drag.pointerFocus, \"ow-color-area--disabled\": disabled },\n className,\n )}\n style={\n {\n \"--ow-color-area-hue\": hueHex(hsv.h),\n \"--ow-color-area-width\": size(width),\n \"--ow-color-area-height\": size(height),\n } as CSSProperties\n }\n {...drag.handlers}\n >\n <div\n className=\"ow-color-area__thumb\"\n style={{ \"--ow-color-area-x\": `${hsv.s}%`, \"--ow-color-area-y\": `${100 - hsv.v}%`, \"--ow-color-area-color\": toHex(rgba) } as CSSProperties}\n >\n {input(\"x\")}\n {input(\"y\")}\n </div>\n {name ? <input type=\"hidden\" name={name} value={hex} /> : null}\n </div>\n );\n});\n", "import { useCallback, useReducer, useRef, useState, type PointerEvent as ReactPointerEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\n\n/** Red, green and blue from 0 to 255, alpha from 0 to 1. */\nexport interface Rgba {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\n/** Hue in degrees, saturation and brightness (value) from 0 to 100, alpha from 0 to 1. */\nexport interface Hsva {\n h: number;\n s: number;\n v: number;\n a: number;\n}\n\n/** Hue in degrees, saturation and lightness from 0 to 100, alpha from 0 to 1. */\nexport interface Hsla {\n h: number;\n s: number;\n l: number;\n a: number;\n}\n\nexport const clamp = (n: number, min: number, max: number) => Math.min(max, Math.max(min, n));\n\n/** \"#0d9488\", \"#0d9488cc\", \"#0d9\" or \"0d9488\" \u2192 its channels; anything else \u2192 null. */\nexport function parseHex(color: string): Rgba | null {\n let hex = color.trim().replace(/^#/, \"\");\n if (hex.length === 3 || hex.length === 4) hex = [...hex].map((digit) => digit + digit).join(\"\");\n if (!/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) return null;\n const byteAt = (index: number) => parseInt(hex.slice(index, index + 2), 16);\n return { r: byteAt(0), g: byteAt(2), b: byteAt(4), a: hex.length === 8 ? byteAt(6) / 255 : 1 };\n}\n\n/** Whether a hex colour spells out its alpha (#rgba or #rrggbbaa). */\nexport const hasAlpha = (color: string) => /^#?([0-9a-f]{4}|[0-9a-f]{8})$/i.test(color.trim());\n\nconst byte = (n: number) =>\n Math.round(clamp(n, 0, 255))\n .toString(16)\n .padStart(2, \"0\");\n\n/** Lowercase \"#rrggbb\", or \"#rrggbbaa\" with `alpha`. */\nexport function toHex({ r, g, b, a }: Rgba, alpha = false): string {\n return `#${byte(r)}${byte(g)}${byte(b)}${alpha ? byte(a * 255) : \"\"}`;\n}\n\n/** The same colour written one way, so \"#0D9488\" and \"#0d9488\" compare equal. Invalid colours come back as given. */\nexport function normalizeHex(color: string): string {\n const rgba = parseHex(color);\n return rgba ? toHex(rgba, hasAlpha(color)) : color;\n}\n\nexport function rgbToHsv({ r, g, b, a }: Rgba): Hsva {\n const max = Math.max(r, g, b);\n const range = max - Math.min(r, g, b);\n let h = 0;\n if (range) {\n if (max === r) h = ((g - b) / range) % 6;\n else if (max === g) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h = (h * 60 + 360) % 360;\n }\n return { h, s: max ? (range / max) * 100 : 0, v: (max / 255) * 100, a };\n}\n\nexport function hsvToRgb({ h, s, v, a }: Hsva): Rgba {\n const S = s / 100;\n const V = v / 100;\n const channel = (n: number) => {\n const k = (n + h / 60) % 6;\n return (V - V * S * Math.max(0, Math.min(k, 4 - k, 1))) * 255;\n };\n return { r: channel(5), g: channel(3), b: channel(1), a };\n}\n\nexport function hsvToHsl({ h, s, v, a }: Hsva): Hsla {\n const S = s / 100;\n const V = v / 100;\n const l = V * (1 - S / 2);\n return { h, s: l === 0 || l === 1 ? 0 : ((V - l) / Math.min(l, 1 - l)) * 100, l: l * 100, a };\n}\n\nexport function hslToHsv({ h, s, l, a }: Hsla): Hsva {\n const S = s / 100;\n const L = l / 100;\n const v = L + S * Math.min(L, 1 - L);\n return { h, s: v === 0 ? 0 : 2 * (1 - L / v) * 100, v: v * 100, a };\n}\n\n/** A way of seeing a colour that a control edits, and how to read a hex into it without losing what a grey can't hold. */\nexport interface ColorModel<M extends { h: number }> {\n read(rgba: Rgba, previous: M | undefined): M;\n write(model: M): Rgba;\n}\n\nexport const hsvModel: ColorModel<Hsva> = {\n read(rgba, previous) {\n const next = rgbToHsv(rgba);\n if (!previous) return next;\n // A grey has no hue, and black no saturation either: keep the last ones, so a corner doesn't lose them.\n if (next.s === 0 || next.v === 0) next.h = previous.h;\n if (next.v === 0) next.s = previous.s;\n return next;\n },\n write: hsvToRgb,\n};\n\nexport const hslModel: ColorModel<Hsla> = {\n read(rgba, previous) {\n const next = hsvToHsl(rgbToHsv(rgba));\n if (!previous) return next;\n if (next.s === 0) next.h = previous.h;\n // Black and white have neither hue nor saturation.\n if (next.l <= 0 || next.l >= 100) {\n next.h = previous.h;\n next.s = previous.s;\n }\n return next;\n },\n write: (model) => hsvToRgb(hslToHsv(model)),\n};\n\nconst fallback: Rgba = { r: 0, g: 0, b: 0, a: 1 };\n\n/**\n * A hex colour that a parent may control, seen through a model (HSV or HSL). The model is kept between renders\n * and only read again from the hex when the hex changes from outside, so greys and black keep their hue.\n * `hue`, when given, is the hue to show while the colour is a grey.\n */\nexport function useColorModel<M extends { h: number }>(\n value: string | undefined,\n defaultValue: string,\n onChange: ((color: string) => void) | undefined,\n model: ColorModel<M>,\n { hue, alpha = false }: { hue?: number; alpha?: boolean } = {},\n) {\n const [color, setColor] = useControllableState(value, defaultValue, onChange);\n const memory = useRef<{ hex: string; model: ColorModel<M>; value: M } | null>(null);\n const [, rerender] = useReducer((n: number) => n + 1, 0);\n\n const incoming = normalizeHex(color);\n if (!memory.current || memory.current.hex !== incoming || memory.current.model !== model) {\n const rgba = parseHex(incoming);\n const previous = memory.current?.model === model ? memory.current.value : undefined;\n memory.current = { hex: incoming, model, value: rgba ? model.read(rgba, previous) : (previous ?? model.read(fallback, undefined)) };\n }\n\n const rgba = parseHex(memory.current.hex) ?? model.write(memory.current.value);\n const isGrey = rgba.r === rgba.g && rgba.g === rgba.b;\n const current = isGrey && hue !== undefined ? { ...memory.current.value, h: hue } : memory.current.value;\n const withAlpha = alpha || hasAlpha(color);\n\n const set = useCallback(\n (next: M) => {\n const hex = toHex(model.write(next), withAlpha);\n memory.current = { hex, model, value: next };\n // When the hex doesn't change (the hue of a grey), only the thumb moves: render that.\n rerender();\n setColor(hex);\n return hex;\n },\n [model, withAlpha, setColor],\n );\n\n // The latest hex, for onChangeEnd, which can run before the next render.\n const latest = useCallback(() => memory.current?.hex ?? incoming, [incoming]);\n\n return { value: current, rgba: model.write(current), hex: memory.current.hex, set, latest };\n}\n\n/**\n * Pointer dragging over an element: reports where the pointer is as fractions of its box (0 to 1, from the top\n * left), keeps reporting outside it through pointer capture, and calls onEnd when the pointer lets go. onStart runs\n * on press, to focus the control. `pointerFocus` is true from a press until a key or a blur: the control was focused\n * by the pointer and shows no focus ring, the way :focus-visible would if it were a native control.\n */\nexport function useDrag({\n onMove,\n onEnd,\n onStart,\n disabled = false,\n}: {\n onMove(x: number, y: number): void;\n onEnd(): void;\n onStart?(): void;\n disabled?: boolean;\n}) {\n const [dragging, setDragging] = useState(false);\n const [pointerFocus, setPointerFocus] = useState(false);\n const move = (event: ReactPointerEvent<HTMLElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n onMove(clamp((event.clientX - rect.left) / (rect.width || 1), 0, 1), clamp((event.clientY - rect.top) / (rect.height || 1), 0, 1));\n };\n return {\n dragging,\n pointerFocus,\n /** For the input's onKeyDown and onBlur: the focus ring shows again. */\n keyboard: () => setPointerFocus(false),\n handlers: {\n onPointerDown(event: ReactPointerEvent<HTMLElement>) {\n if (disabled || event.button !== 0) return;\n // No text selection or page scroll while dragging.\n event.preventDefault();\n event.currentTarget.setPointerCapture(event.pointerId);\n onStart?.();\n setPointerFocus(true);\n setDragging(true);\n move(event);\n },\n onPointerMove(event: ReactPointerEvent<HTMLElement>) {\n if (event.currentTarget.hasPointerCapture(event.pointerId)) move(event);\n },\n onLostPointerCapture() {\n setDragging(false);\n onEnd();\n },\n },\n };\n}\n\n// Relative luminance, for picking a check mark's colour.\nconst linear = (channel: number) => {\n const v = channel / 255;\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\nconst luminance = ({ r, g, b }: Pick<Rgba, \"r\" | \"g\" | \"b\">) => 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);\nconst ratio = (a: number, b: number) => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n\n/** Whether light (white) or dark (slate 900) ink reads better on a colour; a translucent colour is seen over white. */\nexport function inkFor({ r, g, b, a }: Rgba): \"light\" | \"dark\" {\n const over = (channel: number) => channel * a + 255 * (1 - a);\n const ground = luminance({ r: over(r), g: over(g), b: over(b) });\n return ratio(ground, 1) >= ratio(ground, luminance({ r: 15, g: 23, b: 42 })) ? \"light\" : \"dark\";\n}\n\nfunction hueName(h: number, l: number): string {\n if (h < 12 || h >= 345) return l > 70 ? \"pink\" : \"red\";\n if (h < 42) return l < 35 ? \"brown\" : \"orange\";\n if (h < 66) return l < 30 ? \"olive\" : \"yellow\";\n if (h < 85) return \"lime\";\n if (h < 150) return \"green\";\n if (h < 170) return \"teal\";\n if (h < 195) return l >= 45 ? \"cyan\" : \"teal\";\n if (h < 240) return \"blue\";\n if (h < 260) return \"indigo\";\n if (h < 290) return \"purple\";\n if (h < 320) return \"magenta\";\n return \"pink\";\n}\n\n/** A short description of a colour for screen readers: \"dark teal\", \"light grey\", \"greyish blue\". */\nexport function describeColor(rgba: Rgba): string {\n const { h, s, v } = rgbToHsv(rgba);\n const { l } = hsvToHsl({ h, s, v, a: 1 });\n const chroma = Math.max(rgba.r, rgba.g, rgba.b) - Math.min(rgba.r, rgba.g, rgba.b);\n if (chroma < 12) {\n if (l < 8) return \"black\";\n if (l > 97) return \"white\";\n return l < 35 ? \"dark grey\" : l > 75 ? \"light grey\" : \"grey\";\n }\n const name = hueName(h, l);\n const shade =\n name === \"brown\" || name === \"olive\" ? (l < 20 ? \"dark\" : \"\") : l < 20 ? \"very dark\" : l < 38 ? \"dark\" : l > 85 ? \"very light\" : l > 68 ? \"light\" : \"\";\n return [shade, chroma < 40 ? \"greyish\" : \"\", name].filter(Boolean).join(\" \");\n}\n\n/** The pure hue, as a hex: what a hue slider's thumb shows. */\nexport const hueHex = (h: number) => toHex(hsvToRgb({ h, s: 100, v: 100, a: 1 }));\n\n/** The six stops of the hue wheel, red to red. */\nexport const hueStops = \"#ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%\";\n", "import { forwardRef, useId, useRef, type CSSProperties, type ForwardedRef, type KeyboardEvent, type ReactNode } from \"react\";\n\nimport { cx } from \"../../utils/cx\";\nimport {\n clamp,\n describeColor,\n hslModel,\n hsvModel,\n hueHex,\n hueStops,\n parseHex,\n toHex,\n useColorModel,\n useDrag,\n type ColorModel,\n type Hsla,\n type Hsva,\n type Rgba,\n} from \"./color\";\n\n/** A channel a ColorSlider changes: HSL's hue, saturation or lightness, the alpha, or red, green or blue. */\nexport type ColorChannel = \"hue\" | \"saturation\" | \"lightness\" | \"alpha\" | \"red\" | \"green\" | \"blue\";\n\nexport interface ColorSliderProps {\n /** The channel it changes. Saturation and lightness are HSL's; the track shows the channel's range for the current colour. */\n channel: ColorChannel;\n /** The colour as hex. The alpha channel takes and returns \"#rrggbbaa\"; the others keep any alpha they're given. */\n value?: string;\n /** The starting colour when uncontrolled.\n * @default \"#312c7e\" */\n defaultValue?: string;\n /** Called with a lowercase hex as the person drags or presses the arrow keys. */\n onChange?(color: string): void;\n /** Called when the person lets go or releases the key, for work too slow to do on every move. */\n onChangeEnd?(color: string): void;\n /** The hue to show while the colour is a grey, which has none of its own. Without it, the slider keeps the last hue it had. */\n hue?: number;\n /** Called with the hue as a hue slider moves, including over a grey, whose hex doesn't change. Pass it on to a\n * ColorArea's `hue` to keep the two in step. */\n onHueChange?(hue: number): void;\n /** Shown above the track, and names the slider for screen readers. */\n label?: ReactNode;\n /** Shows the channel's value (174\u00B0, 72%, or 0 to 255 for red, green and blue) at the right of the label.\n * Defaults to true when there's a label. */\n showValue?: boolean;\n /** A vertical slider is 152px tall, a ColorArea's height; set another with CSS.\n * @default \"horizontal\" */\n orientation?: \"horizontal\" | \"vertical\";\n /** Fades it; the pointer and the keys do nothing.\n * @default false */\n disabled?: boolean;\n /** The locale for the value shown and read out. Defaults to the browser's. */\n locale?: string;\n /** The form field name; the hex is submitted under it. */\n name?: string;\n /** Names the slider when there's no label. Defaults to the channel's name (\"Hue\", \"Opacity\"), unless aria-labelledby\n * or a Field names it. */\n \"aria-label\"?: string;\n /** Names the slider by a visible label's id. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out after the value; a Field sets it. */\n \"aria-describedby\"?: string;\n /** The input's id; a Field sets it so its label names the slider. */\n id?: string;\n /** Classes for the slider's outer element, e.g. a height for a vertical one. */\n className?: string;\n}\n\ntype Model = Hsva | Hsla;\n\nconst channels: Record<ColorChannel, { name: string; max: number; unit: \"degree\" | \"percent\" | \"number\" }> = {\n hue: { name: \"Hue\", max: 360, unit: \"degree\" },\n saturation: { name: \"Saturation\", max: 100, unit: \"percent\" },\n lightness: { name: \"Lightness\", max: 100, unit: \"percent\" },\n alpha: { name: \"Opacity\", max: 100, unit: \"percent\" },\n red: { name: \"Red\", max: 255, unit: \"number\" },\n green: { name: \"Green\", max: 255, unit: \"number\" },\n blue: { name: \"Blue\", max: 255, unit: \"number\" },\n};\n\nconst rgbKey = { red: \"r\", green: \"g\", blue: \"b\" } as const;\n\nfunction read(channel: ColorChannel, model: Model, rgba: Rgba): number {\n if (channel === \"hue\") return model.h;\n if (channel === \"saturation\") return model.s;\n if (channel === \"lightness\") return (model as Hsla).l;\n if (channel === \"alpha\") return model.a * 100;\n return rgba[rgbKey[channel]];\n}\n\nfunction write(channel: ColorChannel, model: Model, rgba: Rgba, n: number): Model {\n if (channel === \"hue\") return { ...model, h: n };\n if (channel === \"saturation\") return { ...model, s: n };\n if (channel === \"lightness\") return { ...model, l: n };\n if (channel === \"alpha\") return { ...model, a: n / 100 };\n return hsvModel.read({ ...rgba, [rgbKey[channel]]: Math.round(n) }, model as Hsva);\n}\n\n/** The track's colours, from the channel's minimum to its maximum, for the current colour. */\nfunction gradient(channel: ColorChannel, model: Model, rgba: Rgba): string {\n const opaque = { ...rgba, a: 1 };\n const hsl = (s: number, l: number) => toHex(hslModel.write({ h: model.h, s, l, a: 1 }));\n switch (channel) {\n case \"hue\":\n return hueStops;\n case \"saturation\":\n return `${hsl(0, (model as Hsla).l)}, ${hsl(100, (model as Hsla).l)}`;\n case \"lightness\":\n return `#000000, ${hsl(model.s, 50)}, #ffffff`;\n case \"alpha\":\n return `${toHex({ ...rgba, a: 0 }, true)}, ${toHex(opaque)}`;\n default: {\n const key = rgbKey[channel];\n return `${toHex({ ...opaque, [key]: 0 })}, ${toHex({ ...opaque, [key]: 255 })}`;\n }\n }\n}\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\n/**\n * Changes one channel of a colour by dragging, over a track that shows that channel's range: a hue slider, an\n * opacity slider over a checkerboard, or red, green and blue. It works with the keyboard like Slider.\n * The ref is its input, for focusing it.\n */\nexport const ColorSlider = /* @__PURE__ */ forwardRef<HTMLInputElement, ColorSliderProps>(function ColorSlider(\n {\n channel,\n value,\n defaultValue = \"#312c7e\",\n onChange,\n onChangeEnd,\n hue,\n onHueChange,\n label,\n showValue = Boolean(label),\n orientation = \"horizontal\",\n disabled = false,\n locale,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n className,\n },\n ref,\n) {\n const spec = channels[channel];\n const isHsl = channel === \"saturation\" || channel === \"lightness\";\n const color = useColorModel<Model>(value, defaultValue, onChange, (isHsl ? hslModel : hsvModel) as ColorModel<Model>, {\n hue,\n alpha: channel === \"alpha\",\n });\n const { rgba, latest } = color;\n const current = read(channel, color.value, rgba);\n const labelId = useId();\n const trackRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const vertical = orientation === \"vertical\";\n const isRtl = () => !vertical && trackRef.current !== null && getComputedStyle(trackRef.current).direction === \"rtl\";\n const end = () => onChangeEnd?.(latest());\n\n function change(n: number) {\n const next = write(channel, color.value, rgba, clamp(n, 0, spec.max));\n color.set(next);\n if (next.h !== color.value.h) onHueChange?.(next.h);\n }\n\n const drag = useDrag({\n onMove: (x, y) => change((vertical ? 1 - y : isRtl() ? 1 - x : x) * spec.max),\n onEnd: end,\n onStart: () => inputRef.current?.focus({ preventScroll: true }),\n disabled,\n });\n\n function onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n drag.keyboard();\n const step = event.shiftKey ? 10 : 1;\n const forward = isRtl() ? -1 : 1;\n const from = Math.round(current);\n const keys: Record<string, number> = {\n ArrowRight: from + step * forward,\n ArrowLeft: from - step * forward,\n ArrowUp: from + step,\n ArrowDown: from - step,\n PageUp: from + 10,\n PageDown: from - 10,\n Home: 0,\n End: spec.max,\n };\n if (!(event.key in keys)) return;\n event.preventDefault();\n change(keys[event.key]!);\n }\n\n const format =\n spec.unit === \"degree\"\n ? new Intl.NumberFormat(locale, { style: \"unit\", unit: \"degree\", unitDisplay: \"narrow\", maximumFractionDigits: 0 })\n : spec.unit === \"percent\"\n ? new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n : new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });\n const shown = format.format(spec.unit === \"percent\" ? current / 100 : current);\n const named = channel === \"hue\" ? describeColor(parseHex(hueHex(color.value.h))!) : describeColor({ ...rgba, a: 1 });\n const fill = channel === \"hue\" ? hueHex(color.value.h) : toHex(rgba, channel === \"alpha\");\n\n return (\n <div\n className={cx(\n \"ow-color-slider\",\n `ow-color-slider--${orientation}`,\n {\n \"ow-color-slider--alpha\": channel === \"alpha\",\n \"ow-color-slider--dragging\": drag.dragging,\n \"ow-color-slider--pointer\": drag.pointerFocus,\n \"ow-color-slider--disabled\": disabled,\n },\n className,\n )}\n >\n {label || showValue ? (\n <div className=\"ow-color-slider__header\">\n {label ? (\n <span id={labelId} className=\"ow-color-slider__label\">\n {label}\n </span>\n ) : (\n <span />\n )}\n {showValue ? (\n <output className=\"ow-color-slider__value\" aria-hidden=\"true\">\n {shown}\n </output>\n ) : null}\n </div>\n ) : null}\n <div\n ref={trackRef}\n className=\"ow-color-slider__track\"\n style={\n {\n \"--ow-color-slider-gradient\": `linear-gradient(var(--ow-color-slider-direction), ${gradient(channel, color.value, rgba)})`,\n } as CSSProperties\n }\n {...drag.handlers}\n >\n <div\n className=\"ow-color-slider__thumb\"\n style={{ \"--ow-color-slider-position\": `${(current / spec.max) * 100}%`, \"--ow-color-slider-thumb\": fill } as CSSProperties}\n >\n <input\n ref={(element) => {\n inputRef.current = element;\n assignRef(ref, element);\n }}\n id={id}\n type=\"range\"\n className=\"ow-visually-hidden\"\n min={0}\n max={spec.max}\n step={1}\n value={Math.round(current)}\n disabled={disabled}\n aria-orientation={orientation}\n aria-labelledby={label ? labelId : ariaLabelledBy}\n aria-label={label || ariaLabelledBy || (id && !ariaLabel) ? undefined : (ariaLabel ?? spec.name)}\n aria-valuetext={channel === \"alpha\" ? shown : `${shown}, ${named}`}\n aria-describedby={ariaDescribedBy}\n onChange={(event) => change(Number(event.target.value))}\n onKeyDown={onKeyDown}\n onBlur={drag.keyboard}\n onKeyUp={(event) => {\n if (/^(Arrow|Page|Home|End)/.test(event.key)) end();\n }}\n />\n </div>\n </div>\n {name ? <input type=\"hidden\" name={name} value={color.hex} /> : null}\n </div>\n );\n});\n", "import { forwardRef, useRef, type CSSProperties, type KeyboardEvent } from \"react\";\n\nimport { useControllableState } from \"../../hooks/useControllableState\";\nimport { CheckIcon } from \"../../icons\";\nimport { cx } from \"../../utils/cx\";\nimport { describeColor, inkFor, normalizeHex, parseHex } from \"./color\";\n\nexport interface ColorSwatchPickerOption {\n /** A hex colour: \"#312c7e\". */\n value: string;\n /** The colour's name, read out and shown on hover: \"Midnight\". Defaults to a description, like \"dark indigo\". */\n label?: string;\n /** Shown faded and skipped by the arrow keys, e.g. a colour another label has taken. */\n disabled?: boolean;\n}\n\nexport interface ColorSwatchPickerProps {\n /** The colours to choose from: hex strings, or { value, label } to give them names. */\n options: Array<string | ColorSwatchPickerOption>;\n /** The chosen colour. It matches an option whatever its case or length (#abc, #aabbcc). */\n value?: string;\n /** The starting colour when uncontrolled. Defaults to none. */\n defaultValue?: string;\n /** Called with the chosen option's value, as written in `options`. */\n onChange?(color: string): void;\n /** sm 24px, md 32px swatches.\n * @default \"md\" */\n size?: \"sm\" | \"md\";\n /** @default \"square\" */\n shape?: \"square\" | \"circle\";\n /** Fades every swatch and takes the picker out of the tab order.\n * @default false */\n disabled?: boolean;\n /** The form field name; the chosen colour is submitted under it. */\n name?: string;\n /** Names the group for screen readers, e.g. \"Label colour\". */\n \"aria-label\"?: string;\n /** Names the group by a visible heading's id, in place of aria-label. */\n \"aria-labelledby\"?: string;\n /** Ids of a hint or an error, read out with the group. */\n \"aria-describedby\"?: string;\n /** The group's id. */\n id?: string;\n /** Classes for the group, e.g. a width that sets where the rows wrap. */\n className?: string;\n}\n\n/**\n * Picks one colour from a set of swatches, in rows that wrap. It's a radio group: Tab moves into it, onto the chosen\n * swatch, and the arrow keys move and choose. The chosen swatch has a ring and a check mark.\n */\nexport const ColorSwatchPicker = /* @__PURE__ */ forwardRef<HTMLDivElement, ColorSwatchPickerProps>(function ColorSwatchPicker(\n { options, value, defaultValue, onChange, size = \"md\", shape = \"square\", disabled = false, name, className, ...aria },\n ref,\n) {\n const [current, setCurrent] = useControllableState(value, defaultValue ?? \"\", onChange);\n const refs = useRef<Array<HTMLDivElement | null>>([]);\n const items = options.map((option) => {\n const item = typeof option === \"string\" ? { value: option } : option;\n const rgba = parseHex(item.value);\n return { ...item, rgba, label: item.label ?? (rgba ? describeColor(rgba) : item.value) };\n });\n const chosen = current ? normalizeHex(current) : \"\";\n const selectedIndex = items.findIndex((item) => normalizeHex(item.value) === chosen);\n const enabled = items.flatMap((item, index) => (item.disabled ? [] : [index]));\n const tabStop = selectedIndex >= 0 && !items[selectedIndex]!.disabled ? selectedIndex : enabled[0];\n\n function choose(index: number) {\n const item = items[index];\n if (disabled || !item || item.disabled) return;\n setCurrent(item.value);\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>, index: number) {\n if (disabled) return;\n if (event.key === \" \") {\n event.preventDefault();\n choose(index);\n return;\n }\n const rtl = getComputedStyle(event.currentTarget).direction === \"rtl\";\n const moves: Record<string, number> = { ArrowDown: 1, ArrowUp: -1, ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 };\n const position = enabled.indexOf(index);\n let target: number | undefined;\n // Moving past the end of a row goes on to the next row; past the last swatch, back to the first.\n if (event.key in moves) target = enabled[(position + moves[event.key]! + enabled.length) % enabled.length];\n else if (event.key === \"Home\") target = enabled[0];\n else if (event.key === \"End\") target = enabled[enabled.length - 1];\n if (target === undefined) return;\n event.preventDefault();\n refs.current[target]?.focus();\n choose(target);\n }\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-disabled={disabled || undefined}\n className={cx(\n \"ow-color-swatch-picker\",\n `ow-color-swatch-picker--${size}`,\n { \"ow-color-swatch-picker--circle\": shape === \"circle\", \"ow-color-swatch-picker--disabled\": disabled },\n className,\n )}\n {...aria}\n >\n {items.map((item, index) => {\n const isSelected = index === selectedIndex;\n const isDisabled = disabled || Boolean(item.disabled);\n return (\n <div\n key={`${item.value}-${index}`}\n ref={(element) => {\n refs.current[index] = element;\n }}\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={item.label}\n aria-disabled={isDisabled || undefined}\n tabIndex={!isDisabled && index === tabStop ? 0 : -1}\n title={item.label}\n data-ink={item.rgba ? inkFor(item.rgba) : \"dark\"}\n className=\"ow-color-swatch-picker__swatch\"\n style={{ \"--ow-color-swatch-picker-value\": item.value } as CSSProperties}\n onClick={() => choose(index)}\n onKeyDown={(event) => onKeyDown(event, index)}\n >\n <CheckIcon size={size === \"sm\" ? 14 : 16} strokeWidth={2.5} className=\"ow-color-swatch-picker__check\" aria-hidden=\"true\" />\n </div>\n );\n })}\n {name ? <input type=\"hidden\" name={name} value={selectedIndex >= 0 ? items[selectedIndex]!.value : \"\"} /> : null}\n </div>\n );\n});\n", "import type { CSSProperties } from \"react\";\n\n/** The eleven steps of a brand scale, as in --ow-brand-50 \u2026 --ow-brand-950. */\nexport const brandSteps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;\n\nexport type BrandStep = (typeof brandSteps)[number];\nexport type BrandScale = Record<BrandStep, string>;\n\nexport interface BrandPreset {\n id: string;\n name: string;\n scale: BrandScale;\n}\n\n// Midnight's lightness and chroma at each step, in OKLCH. Every scale is built on this lightness curve, so white\n// text on step 600 (light) and 500 (dark), and the focus rings on 500 and 400, keep their contrast whatever the hue.\nconst lightness = [0.968, 0.94, 0.89, 0.81, 0.68, 0.53, 0.42, 0.33, 0.27, 0.22, 0.17];\nconst chroma = [0.012, 0.022, 0.04, 0.066, 0.1, 0.135, 0.134, 0.086, 0.072, 0.058, 0.045];\nconst peakChroma = 0.135;\n\ntype Lch = { l: number; c: number; h: number };\n\nfunction parseHex(color: string): [number, number, number] {\n let hex = color.trim().replace(/^#/, \"\");\n if (hex.length === 3 || hex.length === 4) hex = [...hex.slice(0, 3)].map((d) => d + d).join(\"\");\n if (!/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) throw new Error(`brandScale: \"${color}\" isn't a hex colour like #2563eb.`);\n return [0, 2, 4].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255) as [number, number, number];\n}\n\nconst toLinear = (v: number) => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst fromLinear = (v: number) => (v <= 0.0031308 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055);\n\nfunction hexToOklch(color: string): Lch {\n const [r, g, b] = parseHex(color).map(toLinear) as [number, number, number];\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;\n return { l: L, c: Math.hypot(A, B), h: ((Math.atan2(B, A) * 180) / Math.PI + 360) % 360 };\n}\n\nfunction oklchToLinear({ l: L, c, h }: Lch): [number, number, number] {\n const A = c * Math.cos((h * Math.PI) / 180);\n const B = c * Math.sin((h * Math.PI) / 180);\n const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;\n const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;\n const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ];\n}\n\nconst inGamut = (rgb: number[]) => rgb.every((v) => v >= -1e-4 && v <= 1 + 1e-4);\n\n/** The colour at this lightness and hue, with as much of the wanted chroma as sRGB can show. */\nfunction toHex(color: Lch): string {\n let { c } = color;\n if (!inGamut(oklchToLinear(color))) {\n let low = 0;\n let high = c;\n for (let i = 0; i < 24; i += 1) {\n const mid = (low + high) / 2;\n if (inGamut(oklchToLinear({ ...color, c: mid }))) low = mid;\n else high = mid;\n }\n c = low;\n }\n return `#${oklchToLinear({ ...color, c })\n .map((v) => Math.round(Math.min(1, Math.max(0, fromLinear(Math.min(1, Math.max(0, v))))) * 255))\n .map((v) => v.toString(16).padStart(2, \"0\"))\n .join(\"\")}`;\n}\n\n/**\n * Builds the eleven brand steps from one colour: its hue and colourfulness on Openware's lightness curve.\n * The steps keep midnight's contrast in both themes, so your exact colour may land a little lighter or\n * darker than given. A grey gives a neutral scale.\n *\n * `brandScale(\"#0d9488\")` \u2192 `{ 50: \"#ebf7f6\", \u2026, 600: \"#00595a\", \u2026, 950: \"#001414\" }`\n */\nexport function brandScale(color: string): BrandScale {\n const { c, h } = hexToOklch(color);\n const strength = Math.min(1.6, c / peakChroma);\n return Object.fromEntries(brandSteps.map((step, i) => [step, toHex({ l: lightness[i]!, c: chroma[i]! * strength, h })])) as BrandScale;\n}\n\n/** A colour or a scale as the --ow-brand-* custom properties, for a `style` prop or `element.style`. */\nexport function brandVariables(brand: string | BrandScale): CSSProperties {\n const scale = typeof brand === \"string\" ? brandScale(brand) : brand;\n return Object.fromEntries(brandSteps.map((step) => [`--ow-brand-${step}`, scale[step]])) as CSSProperties;\n}\n\n/** A colour or a scale as CSS to paste into a stylesheet. */\nexport function brandCss(brand: string | BrandScale, selector = \":root\"): string {\n const scale = typeof brand === \"string\" ? brandScale(brand) : brand;\n return `${selector} {\\n${brandSteps.map((step) => ` --ow-brand-${step}: ${scale[step]};`).join(\"\\n\")}\\n}`;\n}\n\n/**\n * Rebrands everything inside `element` (the whole page by default) by setting the --ow-brand-* properties on\n * it. Pass `null` to go back to midnight. Elements with their own data-theme set their own brand steps, so\n * give those the same properties, or use brandCss with `:root, [data-theme]` in a stylesheet.\n */\nexport function applyBrand(brand: string | BrandScale | null, element: HTMLElement = document.documentElement) {\n for (const step of brandSteps) element.style.removeProperty(`--ow-brand-${step}`);\n if (brand === null) return;\n const variables = brandVariables(brand) as Record<string, string>;\n for (const [name, value] of Object.entries(variables)) element.style.setProperty(name, value);\n}\n\n/** Seven ready-made scales, each checked for contrast in both themes. Midnight is the default. */\nexport const brandPresets: BrandPreset[] = [\n {\n id: \"midnight\",\n name: \"Midnight\",\n scale: {\n 50: \"#f2f3fc\",\n 100: \"#e7e9f9\",\n 200: \"#d4d7f4\",\n 300: \"#b7bbea\",\n 400: \"#898cd0\",\n 500: \"#5856ad\",\n 600: \"#312c7e\",\n 700: \"#1e1b4b\",\n 800: \"#18163d\",\n 900: \"#13112f\",\n 950: \"#0b0a20\",\n },\n },\n {\n id: \"ocean\",\n name: \"Ocean\",\n scale: {\n 50: \"#edf5fe\",\n 100: \"#dfedfd\",\n 200: \"#c3defa\",\n 300: \"#9ac5f3\",\n 400: \"#5a9de0\",\n 500: \"#006ebe\",\n 600: \"#004f8a\",\n 700: \"#003763\",\n 800: \"#00274a\",\n 900: \"#001b36\",\n 950: \"#001023\",\n },\n },\n {\n id: \"teal\",\n name: \"Teal\",\n scale: {\n 50: \"#ebf7f7\",\n 100: \"#daf1f0\",\n 200: \"#bae4e4\",\n 300: \"#87d0cf\",\n 400: \"#1fadad\",\n 500: \"#007c7c\",\n 600: \"#005959\",\n 700: \"#003e3e\",\n 800: \"#002d2d\",\n 900: \"#002020\",\n 950: \"#001313\",\n },\n },\n {\n id: \"forest\",\n name: \"Forest\",\n scale: {\n 50: \"#eef7f0\",\n 100: \"#e0f0e3\",\n 200: \"#c6e4cd\",\n 300: \"#9ecfaa\",\n 400: \"#5fac76\",\n 500: \"#008240\",\n 600: \"#005d2d\",\n 700: \"#00411d\",\n 800: \"#003014\",\n 900: \"#00220c\",\n 950: \"#001506\",\n },\n },\n {\n id: \"plum\",\n name: \"Plum\",\n scale: {\n 50: \"#f9f2f9\",\n 100: \"#f4e6f4\",\n 200: \"#ead1eb\",\n 300: \"#dab1db\",\n 400: \"#bb80be\",\n 500: \"#95489a\",\n 600: \"#732778\",\n 700: \"#4d2150\",\n 800: \"#39163b\",\n 900: \"#290e2b\",\n 950: \"#1a071b\",\n },\n },\n {\n id: \"rose\",\n name: \"Rose\",\n scale: {\n 50: \"#fef1f1\",\n 100: \"#fce5e6\",\n 200: \"#f8cfd1\",\n 300: \"#eeadb1\",\n 400: \"#d67981\",\n 500: \"#b43b4e\",\n 600: \"#8e1331\",\n 700: \"#5e1924\",\n 800: \"#470f19\",\n 900: \"#330910\",\n 950: \"#210408\",\n },\n },\n {\n id: \"ember\",\n name: \"Ember\",\n scale: {\n 50: \"#fdf2ec\",\n 100: \"#fae7dd\",\n 200: \"#f5d3c0\",\n 300: \"#eab395\",\n 400: \"#d18254\",\n 500: \"#a94e00\",\n 600: \"#7b3700\",\n 700: \"#572500\",\n 800: \"#411900\",\n 900: \"#2f1100\",\n 950: \"#1e0800\",\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;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J,MAAM;AAAA,IACN,OAAO;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACT;AAAA,EACJ;AAAA,EACA;AAAA,IACI,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACT;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": ["Sparkline", "Element", "import_jsx_runtime", "size", "import_jsx_runtime", "size", "Button", "import_react", "import_react", "defaultValue", "import_jsx_runtime", "size", "import_jsx_runtime", "CloseButton", "size", "ToggleButton", "import_react", "import_react", "import_jsx_runtime", "defaultValue", "size", "focusable", "import_react", "import_jsx_runtime", "ChoiceCard", "icon", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "Toolbar", "size", "items", "import_react", "import_react", "top", "import_react", "import_jsx_runtime", "import_jsx_runtime", "defaultValue", "size", "import_react", "import_react", "import_jsx_runtime", "Checkbox", "size", "defaultValue", "import_react", "import_jsx_runtime", "icon", "import_jsx_runtime", "Form", "changed", "import_jsx_runtime", "import_react", "import_jsx_runtime", "Input", "size", "import_react", "import_jsx_runtime", "assignRef", "SearchField", "defaultValue", "size", "import_react", "import_jsx_runtime", "NumberField", "defaultValue", "size", "number", "clamp", "import_react", "import_jsx_runtime", "defaultValue", "import_react", "day", "_", "import_react", "import_jsx_runtime", "size", "gap", "import_jsx_runtime", "pad", "day", "DateField", "defaultValue", "size", "import_react", "import_jsx_runtime", "pad", "TimeField", "defaultValue", "size", "import_react", "import_jsx_runtime", "assignRef", "Textarea", "import_react", "import_jsx_runtime", "size", "state", "import_react", "import_jsx_runtime", "typeaheadResetMs", "isGroup", "textOf", "defaultValue", "size", "import_react", "import_jsx_runtime", "assignRef", "Combobox", "defaultValue", "size", "import_react", "import_jsx_runtime", "defaultValue", "import_react", "import_jsx_runtime", "Switch", "import_react", "import_jsx_runtime", "defaultValue", "import_react", "import_jsx_runtime", "icon", "hasFiles", "import_react", "import_jsx_runtime", "Calendar", "defaultValue", "day", "import_react", "import_jsx_runtime", "assignRef", "DatePicker", "defaultValue", "size", "import_react", "import_jsx_runtime", "RangeCalendar", "defaultValue", "day", "import_react", "import_jsx_runtime", "assignRef", "matches", "DateRangePicker", "defaultValue", "size", "import_jsx_runtime", "icon", "size", "import_react", "import_jsx_runtime", "size", "radius", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "icons", "gap", "SonnerToaster", "import_react", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "import_react", "import_react", "import_jsx_runtime", "MenuItem", "icon", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "defaultValue", "icon", "import_react", "import_jsx_runtime", "icon", "defaultValue", "import_react", "import_jsx_runtime", "items", "Link", "import_jsx_runtime", "size", "items", "import_react", "import_jsx_runtime", "items", "import_react", "import_react", "import_jsx_runtime", "NavItem", "icon", "import_react", "import_react", "import_jsx_runtime", "gap", "Element", "margin", "size", "import_jsx_runtime", "import_react", "import_jsx_runtime", "keyOf", "import_jsx_runtime", "icon", "import_react", "import_react", "import_jsx_runtime", "items", "import_jsx_runtime", "n", "margin", "import_jsx_runtime", "import_jsx_runtime", "import_react", "import_jsx_runtime", "cx", "size", "pad", "radius", "import_jsx_runtime", "Sparkline", "pad", "import_react", "import_jsx_runtime", "items", "icon", "import_jsx_runtime", "icon", "import_jsx_runtime", "size", "icon", "import_react", "import_jsx_runtime", "size", "import_react", "import_jsx_runtime", "size", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "size", "Element", "import_jsx_runtime", "size", "Element", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "Prose", "size", "Element", "import_jsx_runtime", "Element", "import_react", "import_jsx_runtime", "PromptInput", "defaultValue", "size", "number", "import_react", "import_jsx_runtime", "PromptSuggestion", "icon", "import_react", "import_jsx_runtime", "ChatConversation", "import_react", "import_jsx_runtime", "size", "ChatMessage", "import_jsx_runtime", "import_react", "import_jsx_runtime", "icon", "number", "rest", "ChatTool", "import_react", "import_jsx_runtime", "ChainOfThought", "import_react", "import_jsx_runtime", "ChatSource", "icon", "ChatSources", "import_react", "import_jsx_runtime", "defaultValue", "assignRef", "ColorField", "size", "import_react", "import_react", "clamp", "defaultValue", "rgba", "chroma", "import_jsx_runtime", "assignRef", "ColorArea", "defaultValue", "clamp", "percent", "import_react", "import_jsx_runtime", "assignRef", "ColorSlider", "defaultValue", "clamp", "import_react", "import_jsx_runtime", "ColorSwatchPicker", "defaultValue", "size", "items", "parseHex", "toHex"]
|
|
7
7
|
}
|