@kanso-labs/kanso-ui 0.46.0 → 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/chip/label.js +1 -0
  2. package/dist/chip/label.js.map +1 -1
  3. package/dist/chip/styles.js +1 -0
  4. package/dist/chip/styles.js.map +1 -1
  5. package/dist/components/breadcrumbs/index.js +1 -1
  6. package/dist/components/breadcrumbs/index.js.map +1 -1
  7. package/dist/components/code/index.js +32 -26
  8. package/dist/components/code/index.js.map +1 -1
  9. package/dist/components/color-swatch/index.js +1 -1
  10. package/dist/components/color-swatch/index.js.map +1 -1
  11. package/dist/components/icon-button/index.js +3 -3
  12. package/dist/components/icon-button/index.js.map +1 -1
  13. package/dist/components/index.d.ts +2 -2
  14. package/dist/components/link/index.js +2 -2
  15. package/dist/components/link/index.js.map +1 -1
  16. package/dist/components/menu/index.js +4 -1
  17. package/dist/components/menu/index.js.map +1 -1
  18. package/dist/components/navigation-bar/index.js.map +1 -1
  19. package/dist/components/progress-indicator/index.js +258 -172
  20. package/dist/components/progress-indicator/index.js.map +1 -1
  21. package/dist/components/search-view/index.js +1 -1
  22. package/dist/components/search-view/index.js.map +1 -1
  23. package/dist/components/table/index.d.ts +26 -5
  24. package/dist/components/table/index.js +93 -75
  25. package/dist/components/table/index.js.map +1 -1
  26. package/dist/components/tag/index.js +1 -0
  27. package/dist/components/tag/index.js.map +1 -1
  28. package/dist/components/time-picker/index.js +35 -5
  29. package/dist/components/time-picker/index.js.map +1 -1
  30. package/dist/components/toolbar/index.d.ts +4 -3
  31. package/dist/components/toolbar/index.js +107 -38
  32. package/dist/components/toolbar/index.js.map +1 -1
  33. package/dist/index.d.ts +2 -2
  34. package/dist/navigation/styles.js +1 -1
  35. package/dist/navigation/styles.js.map +1 -1
  36. package/dist/segments/index.js +2 -6
  37. package/dist/segments/index.js.map +1 -1
  38. package/dist/segments/literal.js +66 -0
  39. package/dist/segments/literal.js.map +1 -0
  40. package/dist/segments/styles.js +4 -0
  41. package/dist/segments/styles.js.map +1 -1
  42. package/dist/styles.css +351 -34
  43. package/package.json +4 -4
@@ -70,7 +70,7 @@ import SplitButton, { SplitButtonAction, SplitButtonActionProps, SplitButtonMenu
70
70
  import Stack, { StackAlign, StackGap, StackJustify, StackProps } from "./stack/index.js";
71
71
  import SupportingPane, { SupportingPaneProps } from "./supporting-pane/index.js";
72
72
  import Switch, { SwitchProps } from "./switch/index.js";
73
- import Table, { TableBody, TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableFooter, TableFooterProps, TableHeader, TableHeaderProps, TableLoadMore, TableLoadMoreProps, TableProps, TableRow, TableRowProps } from "./table/index.js";
73
+ import Table, { TableAlign, TableBody, TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableFooter, TableFooterProps, TableHeader, TableHeaderProps, TableLoadMore, TableLoadMoreProps, TableProps, TableRow, TableRowProps } from "./table/index.js";
74
74
  import Tabs, { TabsLayout, TabsList, TabsListProps, TabsPanel, TabsPanelProps, TabsPanels, TabsPanelsProps, TabsProps, TabsTab, TabsTabProps, TabsVariant } from "./tabs/index.js";
75
75
  import Tag, { TagProps, TagTone, TagVariant } from "./tag/index.js";
76
76
  import Text, { TextProps } from "./text/index.js";
@@ -82,4 +82,4 @@ import TokenField, { TokenFieldProps, TokenSegment } from "./token-field/index.j
82
82
  import Toolbar, { ToolbarProps, ToolbarTone } from "./toolbar/index.js";
83
83
  import Tooltip, { TooltipAlign, TooltipProps, TooltipSide } from "./tooltip/index.js";
84
84
  import Tree, { TreeItem, TreeItemProps, TreeLoadMore, TreeLoadMoreProps, TreeProps, TreeSection, TreeSectionProps } from "./tree/index.js";
85
- export { AppBar, type AppBarProps, type AppBarScroll, type AppBarScrollOptions, Autocomplete, type AutocompleteFilter, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Breadcrumbs, BreadcrumbsItem, type BreadcrumbsItemProps, type BreadcrumbsProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonGroupVariant, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, type CardVariant, Carousel, CarouselItem, type CarouselItemProps, type CarouselItemRenderProps, type CarouselLayout, type CarouselProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipActionProps, type ChipDropdownProps, type ChipFilterProps, ChipGroup, ChipGroupChip, type ChipGroupChipProps, type ChipGroupProps, type ChipProps, type ChipVariant, Code, type CodeProps, ColorArea, type ColorAreaProps, ColorField, type ColorFieldProps, ColorPicker, type ColorPickerProps, ColorSlider, type ColorSliderProps, ColorSwatch, ColorSwatchPicker, ColorSwatchPickerItem, type ColorSwatchPickerItemProps, type ColorSwatchPickerProps, type ColorSwatchProps, ColorWheel, type ColorWheelProps, ComboBox, type ComboBoxProps, type ComboBoxSelectionMode, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyDisplay, type CurrencyNotation, type CurrencyProps, type CurrencySignDisplay, type CurrencyTone, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogBody, DialogContent, type DialogContentProps, DialogFooter, DialogHeader, type DialogProps, DialogTitle, type DialogTitleProps, Disclosure, DisclosureGroup, type DisclosureGroupProps, DisclosureHeader, type DisclosureHeaderProps, DisclosurePanel, type DisclosurePanelProps, type DisclosureProps, DropZone, type DropZoneProps, Fab, FabMenu, FabMenuItem, type FabMenuItemProps, type FabMenuProps, type FabProps, type FabSize, type FabTone, type FabVariant, Feed, type FeedProps, type FieldVariant, FileTrigger, type FileTriggerProps, Form, type FormProps, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, Keycap, type KeycapProps, Link, type LinkProps, type LinkTone, type LinkUnderline, List, ListBox, ListBoxItem, type ListBoxItemProps, ListBoxLoadMore, type ListBoxLoadMoreProps, type ListBoxProps, ListBoxSection, type ListBoxSectionProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, ListLoadMore, type ListLoadMoreProps, type ListProps, ListRow, type ListRowProps, ListSection, type ListSectionProps, LoadingIndicator, type LoadingIndicatorProps, Menu, type MenuAlign, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLoadMore, type MenuLoadMoreProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, type MenuSeparatorProps, type MenuSide, MenuSubmenu, type MenuSubmenuProps, Meter, type MeterProps, type MeterTone, NavigationBar, NavigationBarItem, type NavigationItemProps as NavigationBarItemProps, type NavigationBarProps, NavigationRail, NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationTree, NavigationTreeItem, type NavigationTreeItemProps, type NavigationTreeProps, NavigationTreeSection, type NavigationTreeSectionProps, NumberField, type NumberFieldProps, Popover, type PopoverAlign, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, type PopoverProps, type PopoverSide, type PopoverSize, PopoverTitle, type PopoverTitleProps, type PopoverTrigger, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, type ProgressIndicatorShape, type ProgressIndicatorTone, type ProgressIndicatorVariant, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeCalendar, type RangeCalendarProps, SearchField, type SearchFieldProps, SearchView, SearchViewContent, type SearchViewContentProps, type SearchViewProps, SegmentedButton, type SegmentedButtonProps, SegmentedButtonSegment, type SegmentedButtonSegmentProps, Select, type SelectProps, Separator, type SeparatorInset, type SeparatorProps, Sheet, SheetBody, SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Slider, type SliderProps, type SliderSize, Snackbar, type SnackbarAction, type SnackbarMessage, type SnackbarOptions, type SnackbarProps, type SnackbarQueue, type ToastRegionRenderProps as SnackbarRegionRenderProps, SplitButton, SplitButtonAction, type SplitButtonActionProps, SplitButtonMenu, type SplitButtonMenuProps, type SplitButtonProps, type SplitButtonVariant, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, TableLoadMore, type TableLoadMoreProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsLayout, TabsList, type TabsListProps, TabsPanel, type TabsPanelProps, TabsPanels, type TabsPanelsProps, type TabsProps, TabsTab, type TabsTabProps, type TabsVariant, Tag, type TagProps, type TagTone, type TagVariant, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, TimeField, type TimeFieldProps, TimePicker, type TimePickerMode, type TimePickerProps, TokenField, type TokenFieldProps, type TokenSegment, Toolbar, type ToolbarProps, type ToolbarTone, Tooltip, type TooltipAlign, type TooltipProps, type TooltipSide, Tree, TreeItem, type TreeItemProps, TreeLoadMore, type TreeLoadMoreProps, type TreeProps, TreeSection, type TreeSectionProps, useAppBarScroll };
85
+ export { AppBar, type AppBarProps, type AppBarScroll, type AppBarScrollOptions, Autocomplete, type AutocompleteFilter, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Breadcrumbs, BreadcrumbsItem, type BreadcrumbsItemProps, type BreadcrumbsProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonGroupVariant, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, type CardVariant, Carousel, CarouselItem, type CarouselItemProps, type CarouselItemRenderProps, type CarouselLayout, type CarouselProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipActionProps, type ChipDropdownProps, type ChipFilterProps, ChipGroup, ChipGroupChip, type ChipGroupChipProps, type ChipGroupProps, type ChipProps, type ChipVariant, Code, type CodeProps, ColorArea, type ColorAreaProps, ColorField, type ColorFieldProps, ColorPicker, type ColorPickerProps, ColorSlider, type ColorSliderProps, ColorSwatch, ColorSwatchPicker, ColorSwatchPickerItem, type ColorSwatchPickerItemProps, type ColorSwatchPickerProps, type ColorSwatchProps, ColorWheel, type ColorWheelProps, ComboBox, type ComboBoxProps, type ComboBoxSelectionMode, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyDisplay, type CurrencyNotation, type CurrencyProps, type CurrencySignDisplay, type CurrencyTone, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogBody, DialogContent, type DialogContentProps, DialogFooter, DialogHeader, type DialogProps, DialogTitle, type DialogTitleProps, Disclosure, DisclosureGroup, type DisclosureGroupProps, DisclosureHeader, type DisclosureHeaderProps, DisclosurePanel, type DisclosurePanelProps, type DisclosureProps, DropZone, type DropZoneProps, Fab, FabMenu, FabMenuItem, type FabMenuItemProps, type FabMenuProps, type FabProps, type FabSize, type FabTone, type FabVariant, Feed, type FeedProps, type FieldVariant, FileTrigger, type FileTriggerProps, Form, type FormProps, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, Keycap, type KeycapProps, Link, type LinkProps, type LinkTone, type LinkUnderline, List, ListBox, ListBoxItem, type ListBoxItemProps, ListBoxLoadMore, type ListBoxLoadMoreProps, type ListBoxProps, ListBoxSection, type ListBoxSectionProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, ListLoadMore, type ListLoadMoreProps, type ListProps, ListRow, type ListRowProps, ListSection, type ListSectionProps, LoadingIndicator, type LoadingIndicatorProps, Menu, type MenuAlign, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLoadMore, type MenuLoadMoreProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, type MenuSeparatorProps, type MenuSide, MenuSubmenu, type MenuSubmenuProps, Meter, type MeterProps, type MeterTone, NavigationBar, NavigationBarItem, type NavigationItemProps as NavigationBarItemProps, type NavigationBarProps, NavigationRail, NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationTree, NavigationTreeItem, type NavigationTreeItemProps, type NavigationTreeProps, NavigationTreeSection, type NavigationTreeSectionProps, NumberField, type NumberFieldProps, Popover, type PopoverAlign, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, type PopoverProps, type PopoverSide, type PopoverSize, PopoverTitle, type PopoverTitleProps, type PopoverTrigger, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, type ProgressIndicatorShape, type ProgressIndicatorTone, type ProgressIndicatorVariant, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeCalendar, type RangeCalendarProps, SearchField, type SearchFieldProps, SearchView, SearchViewContent, type SearchViewContentProps, type SearchViewProps, SegmentedButton, type SegmentedButtonProps, SegmentedButtonSegment, type SegmentedButtonSegmentProps, Select, type SelectProps, Separator, type SeparatorInset, type SeparatorProps, Sheet, SheetBody, SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Slider, type SliderProps, type SliderSize, Snackbar, type SnackbarAction, type SnackbarMessage, type SnackbarOptions, type SnackbarProps, type SnackbarQueue, type ToastRegionRenderProps as SnackbarRegionRenderProps, SplitButton, SplitButtonAction, type SplitButtonActionProps, SplitButtonMenu, type SplitButtonMenuProps, type SplitButtonProps, type SplitButtonVariant, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Switch, type SwitchProps, Table, type TableAlign, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, TableLoadMore, type TableLoadMoreProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsLayout, TabsList, type TabsListProps, TabsPanel, type TabsPanelProps, TabsPanels, type TabsPanelsProps, type TabsProps, TabsTab, type TabsTabProps, type TabsVariant, Tag, type TagProps, type TagTone, type TagVariant, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, TimeField, type TimeFieldProps, TimePicker, type TimePickerMode, type TimePickerProps, TokenField, type TokenFieldProps, type TokenSegment, Toolbar, type ToolbarProps, type ToolbarTone, Tooltip, type TooltipAlign, type TooltipProps, type TooltipSide, Tree, TreeItem, type TreeItemProps, TreeLoadMore, type TreeLoadMoreProps, type TreeProps, TreeSection, type TreeSectionProps, useAppBarScroll };
@@ -22,9 +22,9 @@ const styles = {
22
22
  $$css: true
23
23
  },
24
24
  disabled: {
25
- kMwMTN: "x1xj74d8",
25
+ kMwMTN: "x1xj74d8 x1bhcspo",
26
26
  kkrTdU: "x1h6gzvc",
27
- k1TLXF: "x1g6epwz",
27
+ k1TLXF: "x1g6epwz x14onrci",
28
28
  $$css: true
29
29
  }
30
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","Link","RACLink","ariaAttributesOf","linkRenderer","focus","mergeStatefulStyles","styles","base","k6CgDc","kaIpWk","kB7OPa","kkrTdU","kHjlTd","kNySMw","kcSHmL","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","kMwMTN","k1TLXF","tones","inherit","primary","underlines","always","kMnn75","hover","none","hovered","tone","underline","t0","$","T0","t1","t2","t3","onKeyDown","onKeyUp","render","t4","t5","props","undefined","element","aria","t6","state","ring","isHovered","isDisabled"],"sources":["../../../src/components/link/index.tsx"],"sourcesContent":["'use client';\n\nimport type { AriaAttributes, DOMAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, LinkRenderProps, LinkProps as RACLinkProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Link as RACLink } from 'react-aria-components';\nimport { ariaAttributesOf, linkRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// No Material Design page draws an inline link. The nearest component is the\n// text button, whose label is the same primary role on no container, and this\n// takes that, with the disabled treatment every page gives content: on\n// surface at the disabled-content opacity. What belongs to a control standing\n// on its own is left out — the button's height, padding, type and state\n// layer. A link takes its size and face from the sentence it sits in, and\n// says it can be followed with its underline instead, which is this\n// component's own: a 1px rule in 70% of the primary role, or in the outline\n// role under `inherit`, turning fully primary on hover.\n//\n// 70% is the least that keeps the rule at 3:1 against the surface in every\n// scheme the library is shown in — Nordic, the closest, comes to 3.15:1. The\n// rule is what separates a link from its sentence, since the primary role\n// sits as close as 1.3:1 to body text in the dark theme, and at the 45% it\n// was drawn in before it measured 2:1 on the light surface.\n//\n// Hover is React Aria's render state rather than `:hover`, as Button's and\n// Tabs' are. A tap leaves a touch screen's emulated pointer over what was\n// tapped, so `:hover` kept a tapped link lit until the next tap, and React\n// Aria ignores that pointer; it also never reports a disabled link hovered.\n\nconst styles = {\n base: {\n k6CgDc: \"x12w9bfk\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n kHjlTd: \"xj0a0fe\",\n kNySMw: \"xyi4chj\",\n kcSHmL: \"x1ohr1zr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xz1df8t\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n k1TLXF: \"x1g6epwz\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n k1TLXF: \"x1dbr5dg\",\n $$css: true\n },\n primary: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"x1q3xnwu\",\n $$css: true\n }\n};\nconst underlines = {\n always: {\n kMnn75: \"xujl8zx\",\n $$css: true\n },\n hover: {\n kMnn75: \"xkrqix3\",\n $$css: true\n },\n none: {\n kMnn75: \"xkrqix3\",\n $$css: true\n }\n};\n\n// Under a pointer, from the render state — see the comment at the top. Either\n// tone turns its text and its rule fully primary, and a rule held back until\n// hover is drawn.\nconst hovered = {\n tone: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"xv4vikv\",\n $$css: true\n },\n underline: {\n kMnn75: \"xujl8zx\",\n $$css: true\n }\n};\n\n// React Aria types the global DOM events against the element it renders, and\n// a handler written for an <a> does not type-check against the <span> it\n// renders while disabled. The keys are retyped against HTMLElement here, as\n// Button's are, so one set of props serves both forms; the events React Aria\n// defines itself (press, hover, focus) keep its types, since it hands those\n// its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACLinkProps, 'onBlur' | 'onClick' | 'onFocus'>;\ntype LinkDOMProps = Omit<RACLinkProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype LinkProps = {\n children?: ReactNode;\n /** A function may compute the class from the link's render state. */\n className?: ClassNameOrFunction<LinkRenderProps>;\n /** A function may compute the style from the link's render state. */\n style?: StyleOrFunction<LinkRenderProps>;\n /**\n * Which colour role to render in. `primary` marks the link out from the\n * text around it; `inherit` takes the surrounding colour and leans on the\n * underline alone, for a link in a place already understood to be links —\n * a footer, a breadcrumb, a nav.\n * @default 'primary'\n */\n tone?: LinkTone;\n /**\n * When to draw the rule. Leave it at `always` in prose: without it, colour\n * is the only thing separating the link from the sentence, which some\n * readers cannot see. `hover` and `none` are for links whose position\n * already announces them, such as a row of footer links.\n * @default 'always'\n */\n underline?: LinkUnderline;\n} & AriaAttributes & LinkDOMProps;\ntype LinkTone = 'inherit' | 'primary';\ntype LinkUnderline = 'always' | 'hover' | 'none';\n\n/**\n * A navigational link. It renders an `<a>` and sets no type of its own, so it\n * takes the size and face of the text it sits in. Without `href`, or while\n * disabled, it is a span announced as a link instead, since a disabled\n * anchor is no link at all.\n *\n * ```tsx\n * <Link href=\"#first\">Label</Link>\n * ```\n *\n * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard\n * alike, a `RouterProvider` above it turns a navigation into a client-side\n * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.\n * `render` is React Aria's function form, handed the anchor's props to spread\n * onto an element of its own. Every `aria-*` prop is forwarded to the element;\n * React Aria alone would keep only the labelling ones.\n */\nfunction Link({\n onKeyDown,\n onKeyUp,\n render,\n tone = 'primary',\n underline = 'always',\n ...props\n}: LinkProps & RefAttributes<HTMLAnchorElement>) {\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n return <RACLink render={linkRenderer(element, render)} {...props} {...mergeStatefulStyles((state: LinkRenderProps) => stylex.props(styles.base, focus.ring, tones[tone], underlines[underline], state.isHovered && hovered.tone, state.isHovered && underline === 'hover' && hovered.underline, state.isDisabled && styles.disabled), props)} />;\n}\nexport type { LinkDOMProps, LinkProps, LinkTone, LinkUnderline };\nexport default Link;"],"mappings":";;;;;;;;;AAiCA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ;EACRT,QAAQ;EACRU,QAAQ;EACRH,OAAO;CACT;AACF;AACA,MAAMI,QAAQ;CACZC,SAAS;EACPH,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAM,SAAS;EACPJ,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;AACF;AACA,MAAMO,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRT,OAAO;CACT;CACAU,OAAO;EACLD,QAAQ;EACRT,OAAO;CACT;CACAW,MAAM;EACJF,QAAQ;EACRT,OAAO;CACT;AACF;AAKA,MAAMY,UAAU;CACdC,MAAM;EACJX,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAc,WAAW;EACTL,QAAQ;EACRT,OAAO;CACT;AACF;;;;;;;;;;;;;;;;;;AAqDA,SAAAlB,KAAAiC,IAAA;CAAA,MAAAC,IAAApC,EAAA,EAAA;CAAA,IAAAqC;CAAA,IAAAC;CAAA,IAAAC;C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AAI;EAAAJ,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAAzUQ;AAAyU"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","Link","RACLink","ariaAttributesOf","linkRenderer","focus","mergeStatefulStyles","styles","base","k6CgDc","kaIpWk","kB7OPa","kkrTdU","kHjlTd","kNySMw","kcSHmL","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","kMwMTN","k1TLXF","tones","inherit","primary","underlines","always","kMnn75","hover","none","hovered","tone","underline","t0","$","T0","t1","t2","t3","onKeyDown","onKeyUp","render","t4","t5","props","undefined","element","aria","t6","state","ring","isHovered","isDisabled"],"sources":["../../../src/components/link/index.tsx"],"sourcesContent":["'use client';\n\nimport type { AriaAttributes, DOMAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, LinkRenderProps, LinkProps as RACLinkProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Link as RACLink } from 'react-aria-components';\nimport { ariaAttributesOf, linkRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// No Material Design page draws an inline link. The nearest component is the\n// text button, whose label is the same primary role on no container, and this\n// takes that, with the disabled treatment every page gives content: on\n// surface at the disabled-content opacity. What belongs to a control standing\n// on its own is left out — the button's height, padding, type and state\n// layer. A link takes its size and face from the sentence it sits in, and\n// says it can be followed with its underline instead, which is this\n// component's own: a 1px rule in 70% of the primary role, or in the outline\n// role under `inherit`, turning fully primary on hover.\n//\n// 70% is the least that keeps the rule at 3:1 against the surface in every\n// scheme the library is shown in — Nordic, the closest, comes to 3.15:1. The\n// rule is what separates a link from its sentence, since the primary role\n// sits as close as 1.3:1 to body text in the dark theme, and at the 45% it\n// was drawn in before it measured 2:1 on the light surface.\n//\n// Hover is React Aria's render state rather than `:hover`, as Button's and\n// Tabs' are. A tap leaves a touch screen's emulated pointer over what was\n// tapped, so `:hover` kept a tapped link lit until the next tap, and React\n// Aria ignores that pointer; it also never reports a disabled link hovered.\n\n// Windows High Contrast and the rest of the forced-colours modes.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n base: {\n k6CgDc: \"x12w9bfk\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n kHjlTd: \"xj0a0fe\",\n kNySMw: \"xyi4chj\",\n kcSHmL: \"x1ohr1zr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xz1df8t\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n k1TLXF: \"x1g6epwz x14onrci\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n k1TLXF: \"x1dbr5dg\",\n $$css: true\n },\n primary: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"x1q3xnwu\",\n $$css: true\n }\n};\nconst underlines = {\n always: {\n kMnn75: \"xujl8zx\",\n $$css: true\n },\n hover: {\n kMnn75: \"xkrqix3\",\n $$css: true\n },\n none: {\n kMnn75: \"xkrqix3\",\n $$css: true\n }\n};\n\n// Under a pointer, from the render state — see the comment at the top. Either\n// tone turns its text and its rule fully primary, and a rule held back until\n// hover is drawn.\nconst hovered = {\n tone: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"xv4vikv\",\n $$css: true\n },\n underline: {\n kMnn75: \"xujl8zx\",\n $$css: true\n }\n};\n\n// React Aria types the global DOM events against the element it renders, and\n// a handler written for an <a> does not type-check against the <span> it\n// renders while disabled. The keys are retyped against HTMLElement here, as\n// Button's are, so one set of props serves both forms; the events React Aria\n// defines itself (press, hover, focus) keep its types, since it hands those\n// its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACLinkProps, 'onBlur' | 'onClick' | 'onFocus'>;\ntype LinkDOMProps = Omit<RACLinkProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype LinkProps = {\n children?: ReactNode;\n /** A function may compute the class from the link's render state. */\n className?: ClassNameOrFunction<LinkRenderProps>;\n /** A function may compute the style from the link's render state. */\n style?: StyleOrFunction<LinkRenderProps>;\n /**\n * Which colour role to render in. `primary` marks the link out from the\n * text around it; `inherit` takes the surrounding colour and leans on the\n * underline alone, for a link in a place already understood to be links —\n * a footer, a breadcrumb, a nav.\n * @default 'primary'\n */\n tone?: LinkTone;\n /**\n * When to draw the rule. Leave it at `always` in prose: without it, colour\n * is the only thing separating the link from the sentence, which some\n * readers cannot see. `hover` and `none` are for links whose position\n * already announces them, such as a row of footer links.\n * @default 'always'\n */\n underline?: LinkUnderline;\n} & AriaAttributes & LinkDOMProps;\ntype LinkTone = 'inherit' | 'primary';\ntype LinkUnderline = 'always' | 'hover' | 'none';\n\n/**\n * A navigational link. It renders an `<a>` and sets no type of its own, so it\n * takes the size and face of the text it sits in. Without `href`, or while\n * disabled, it is a span announced as a link instead, since a disabled\n * anchor is no link at all.\n *\n * ```tsx\n * <Link href=\"#first\">Label</Link>\n * ```\n *\n * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard\n * alike, a `RouterProvider` above it turns a navigation into a client-side\n * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.\n * `render` is React Aria's function form, handed the anchor's props to spread\n * onto an element of its own. Every `aria-*` prop is forwarded to the element;\n * React Aria alone would keep only the labelling ones.\n */\nfunction Link({\n onKeyDown,\n onKeyUp,\n render,\n tone = 'primary',\n underline = 'always',\n ...props\n}: LinkProps & RefAttributes<HTMLAnchorElement>) {\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n return <RACLink render={linkRenderer(element, render)} {...props} {...mergeStatefulStyles((state: LinkRenderProps) => stylex.props(styles.base, focus.ring, tones[tone], underlines[underline], state.isHovered && hovered.tone, state.isHovered && underline === 'hover' && hovered.underline, state.isDisabled && styles.disabled), props)} />;\n}\nexport type { LinkDOMProps, LinkProps, LinkTone, LinkUnderline };\nexport default Link;"],"mappings":";;;;;;;;;AAmCA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ;EACRT,QAAQ;EACRU,QAAQ;EACRH,OAAO;CACT;AACF;AACA,MAAMI,QAAQ;CACZC,SAAS;EACPH,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAM,SAAS;EACPJ,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;AACF;AACA,MAAMO,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRT,OAAO;CACT;CACAU,OAAO;EACLD,QAAQ;EACRT,OAAO;CACT;CACAW,MAAM;EACJF,QAAQ;EACRT,OAAO;CACT;AACF;AAKA,MAAMY,UAAU;CACdC,MAAM;EACJX,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAc,WAAW;EACTL,QAAQ;EACRT,OAAO;CACT;AACF;;;;;;;;;;;;;;;;;;AAqDA,SAAAlB,KAAAiC,IAAA;CAAA,MAAAC,IAAApC,EAAA,EAAA;CAAA,IAAAqC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAD,IAAA;EAAc,MAAA,EAAAM,WAAAC,SAAAC,QAAAV,MAAAW,IAAAV,WAAAW,IAAA,GAAAC,YAAAX;EAIZ,MAAAF,OAAAW,OAAAG,KAAAA,IAAA,YAAAH;EACA,MAAAV,YAAAW,OAAAE,KAAAA,IAAA,WAAAF;EAGA,MAAAG,UAAgB;GAAAC,MACR7C,iBAAiB0C,OAAK;GAACL;GAAAC;EAG/B;EACQL,KAAAlC;EAAgBmC,KAAAjC,aAAa2C,SAASL,MAAM;EAAOG,KAAAA;EAAK,IAAAI;EAAA,IAAAd,EAAA,OAAAH,QAAAG,EAAA,OAAAF,WAAA;GAA0BgB,MAAAC,UAA4BlD,MAAaO,OAAMC,MAAOH,MAAK8C,MAAO5B,MAAMS,OAAON,WAAWO,YAAYiB,MAAKE,aAAcrB,QAAOC,MAAOkB,MAAKE,aAAcnB,cAAc,WAAWF,QAAOE,WAAYiB,MAAKG,cAAe9C,OAAMa,QAAS;GAACe,EAAA,KAAAH;GAAAG,EAAA,KAAAF;GAAAE,EAAA,KAAAc;EAAA,OAAAA,KAAAd,EAAA;EAA9PI,KAAAjC,oBAAoB2C,IAA4OJ,OAAK;EAACV,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAH,KAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAC,MAAAD,EAAA,OAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EAArUI,KAAA,oBAAC,IAAD;GAAiB,QAAAN;GAA6B,GAAMQ;GAAK,GAAMN;EAAsQ,CAAA;EAAIJ,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAAzUQ;AAAyU"}
@@ -35,8 +35,11 @@ function emptyState() {
35
35
  }
36
36
  function itemContent(children, leading, shortcut, trailing, ripple) {
37
37
  return (state) => {
38
- const check = state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xxk0z11 x9f619 x2lah0s xvy4d1p" }) : void 0;
39
38
  const hasLeading = leading !== void 0 && leading !== null;
39
+ const check = state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xxk0z11 x9f619 x2lah0s xvy4d1p" }) : hasLeading || state.selectionMode === "none" ? void 0 : /* @__PURE__ */ jsx("span", {
40
+ "aria-hidden": true,
41
+ className: "xxk0z11 x9f619 x2lah0s xvy4d1p"
42
+ });
40
43
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RowContent, {
41
44
  isDisabled: state.isDisabled,
42
45
  isSelected: state.isSelected,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","useContext","useEffect","useRef","AutocompleteStateContext","Menu","MenuItem","RACMenuItem","RACMenuLoadMoreItem","MenuSection","textOf","useRipple","rowStyles","supportingTone","mergeStatefulStyles","mergeStyles","overlay","placementOf","popupOrigin","Separator","styles","content","kWkggS","kaIpWk","ks0D6T","k7Eaqz","k3XXqK","k8WAf4","$$css","shortcut","kMwMTN","align","alignOffset","className","container","search","side","sideOffset","style","children","leading","trailing","label","header","emptyState","itemContent","ripple","state","check","isSelected","undefined","hasLeading","isDisabled","trailingOf","itemStyles","props","base","menu","selectedMenu","isHovered","hovered","isFocusVisible","focusVisible","focusVisibleSelected","isPressed","pressed","disabled","t0","$","t1","MenuContent","ref","t2","surfaceStyles","t3","t4","t5","t6","SEARCH_CONTROL","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","T0","handlers","surface","MenuLoadMore","MenuSeparator","MenuSubmenu","SearchSlot","autocomplete","latest","current","Symbol","for","querySelector","focus","setInputValue","popup","placement","hasSubmenu","Content","Item","LoadMore","Section","Submenu","RACMenuTrigger","RACMenu","RACPopover","RACMenuSection","Separator","RACSubmenuTrigger"],"sources":["../../../src/components/menu/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ComponentProps, ReactElement, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, MenuItemRenderProps, PopoverRenderProps, MenuItemProps as RACMenuItemProps, MenuLoadMoreItemProps as RACMenuLoadMoreItemProps, MenuProps as RACMenuProps, MenuSectionProps as RACMenuSectionProps, MenuTriggerProps as RACMenuTriggerProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useEffect, useRef } from 'react';\nimport { AutocompleteStateContext, Header, Keyboard, Menu as RACMenu, MenuItem as RACMenuItem, MenuLoadMoreItem as RACMenuLoadMoreItem, MenuSection as RACMenuSection, MenuTrigger as RACMenuTrigger, Popover as RACPopover, SubmenuTrigger as RACSubmenuTrigger, Text } from 'react-aria-components';\nimport type { OverlayAlign, OverlaySide } from '../../styles/overlay';\nimport { CollectionEmpty, CollectionLoadMore, CollectionStatus } from '../../collection';\nimport { textOf } from '../../collection/text';\nimport { CheckGlyph, ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { KeycapToneContext } from '../../keycap/context';\nimport { RowContent } from '../../row';\nimport { rowStyles, supportingTone } from '../../row/styles';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay, placementOf, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, sizing, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Separator from '../separator';\n\n// The menus page's menu: a surface between 112 and 280 wide with a 4dp\n// corner and 8dp above and below its items, holding rows of the row module's\n// menu variant — 48dp tall, a label-large label, tertiary container when\n// selected, with a check beside the label. The container alone sits as close\n// as 1.1:1 to the surface, so the check is what carries the selection for a\n// reader who cannot tell the two apart. The surface itself is the overlay module's, shared with Popover\n// and Sheet, with the two things the menus page decides differently applied\n// over it: the corner, which is the extra-small step rather than the\n// medium one every other overlay takes, and the container colour, which is\n// the Expressive column's surface container low rather than the baseline's\n// surface container.\n//\n// Six parts, because everything a menu holds takes arbitrary content:\n// `Menu.Content`, `Menu.Item`, `Menu.Section`, `Menu.Separator`,\n// `Menu.Submenu` and `Menu.LoadMore`. A `Button` or `IconButton` placed\n// directly inside `Menu` is the trigger, wired through React Aria's context\n// rather than a part of ours — the same arrangement Sheet and Popover use.\n//\n// Four things are worth knowing about how this maps onto React Aria.\n//\n// **The item's styles are a function of its render state.** StyleX cannot\n// target `[data-selected]` on the element it is styling, so selection,\n// disabled and the rest are read from the state React Aria hands the\n// `className` function, wrapped in `mergeStatefulStyles` so a call site's own\n// `className` survives.\n//\n// **A shortcut goes through React Aria's `Keyboard` slot**, and the label\n// through its `Text` slot. The second is what makes the first work: React\n// Aria points the item's `aria-labelledby` at the labelled text, so a screen\n// reader reads the label alone and announces the keystroke separately. Left\n// as plain content, the item's name is its whole text and the shortcut is\n// read as part of what the item does. The keycap itself is the library's.\n// The shortcut's colour follows the item's state as the supporting line's\n// does, through the same `supportingTone`, and a selected or disabled item\n// hands a keycap inside it the `inherit` tone, so the keycap follows too.\n//\n// **A submenu's arrow is drawn from render state, not from a prop.** React\n// Aria reports `hasSubmenu` on the item inside a `SubmenuTrigger`, so an item\n// that opens one gets the chevron without the call site saying so twice. The\n// glyph carries no direction of its own, so the style mirrors it under a\n// right-to-left writing mode.\n//\n// **A menu's children are a collection**, so anything that is not an item is\n// dropped: React Aria walks them looking for items and finds a search input\n// no place to be. `Menu.Content` therefore takes a `search` slot, drawn on\n// the surface above the items — which is also what puts the bar and the\n// items inside one `Autocomplete` when the menu is filtered.\n//\n// **A separator needs no slot from the call site.** React Aria's menu\n// provides the separator context, which is what `Menu.Separator` picks up —\n// that is why Separator moved onto React Aria in Phase 0. What is added here\n// is the menus page's 8dp either side of the rule.\n\nconst MENU_MIN = '112px';\nconst MENU_MAX = '280px';\nconst styles = {\n content: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n ks0D6T: \"x1jkqq1h\",\n k7Eaqz: \"x1c7vg25\",\n k3XXqK: \"x1t137rt\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n },\n shortcut: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\ntype MenuAlign = OverlayAlign;\ntype MenuContentProps<T extends object = object> = {\n /**\n * Where the menu lines up along that side. Left out, a menu lines up with\n * the start of its trigger, and a submenu with the top of the item that\n * opens it.\n */\n align?: MenuAlign;\n /** Moves the menu along that side, in pixels. */\n alignOffset?: number;\n /**\n * Lands on the surface, which is the element a layout positions. A\n * function may compute the class from the surface's render state.\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * Where to portal the menu. Defaults to the container of the `ThemeScope`\n * around it, which keeps the menu on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the menu\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * What the menu shows when nothing is in it — after a search that matched\n * nothing, usually. Left out, it is a muted row saying \"No results\" in the\n * I18nProvider's locale, which the surface also announces, so the menu\n * keeps a row's height rather than shrinking to its search bar. One of the\n * call site's own replaces the announcement as well as the row.\n */\n renderEmptyState?: RACMenuProps<T>['renderEmptyState'];\n /**\n * Content drawn on the surface above the items — a search bar that filters\n * them, usually. It goes here rather than among the children because a\n * menu's children are a collection: React Aria walks them for items and\n * drops anything else, so an input written beside them disappears.\n *\n * To filter with it, wrap this whole part in `Autocomplete`, which puts\n * the bar and the items inside one wrapper. The bar takes focus as the\n * menu opens, however it was opened, so typing filters straight away,\n * and its query is cleared as the menu closes, so a reopened menu shows\n * every item.\n */\n search?: ReactNode;\n /**\n * Which side of the trigger the menu opens on. Left out, a menu opens below\n * its trigger and a submenu at the inline end of the item that opens it,\n * where the item's chevron points — the places React Aria gives each.\n * Given `align` alone, the side is `bottom`. `start` and `end` follow the\n * writing direction, as a submenu does; `left` and `right` stay put in\n * either.\n */\n side?: MenuSide;\n /**\n * How far the menu sits from the trigger, in pixels. Left out, React Aria's:\n * 8, or 0 for a menu opened with `trigger=\"contextMenu\"`.\n */\n sideOffset?: number;\n /** Lands on the surface, as `className` does. */\n style?: StyleOrFunction<PopoverRenderProps>;\n} & Omit<RACMenuProps<T>, 'className' | 'renderEmptyState' | 'style'>;\ntype MenuItemProps<T extends object = object> = {\n /** The item's label — what it does. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACMenuItemProps<T>['className'];\n /** Content before the label, usually an icon. */\n leading?: ReactNode;\n /**\n * The keystroke that runs the item, at the end of the row. Pass a `Keycap`\n * to draw it as one; a string is set as plain text in the muted role. Either\n * goes through React Aria's keyboard slot, so a screen reader announces it\n * apart from the label rather than reading the two as one name. It takes\n * the item's colour while the item is selected or disabled, and so does a\n * `Keycap` inside it, its rule included.\n */\n shortcut?: ReactNode;\n /** A function may compute the style from the item's render state. */\n style?: RACMenuItemProps<T>['style'];\n /** Content after the label, before the shortcut. */\n trailing?: ReactNode;\n} & Omit<RACMenuItemProps<T>, 'children' | 'className' | 'style'>;\ntype MenuLoadMoreProps = Omit<RACMenuLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\n\n// `children` is optional here where React Aria makes it required, so the\n// type reads the way Sheet's and Popover's do: a root that composes rather\n// than one that has to be handed something. Sheet does the same for the same\n// reason.\ntype MenuProps = Omit<RACMenuTriggerProps, 'children'> & {\n /** The trigger, then the `Menu.Content` it opens. */\n children?: ReactNode;\n};\ntype MenuSectionProps<T extends object = object> = Omit<RACMenuSectionProps<T>, 'children'> & {\n /**\n * The items in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\ntype MenuSeparatorProps = Omit<ComponentProps<typeof Separator>, 'orientation'>;\ntype MenuSide = OverlaySide;\ntype MenuSubmenuProps = {\n /**\n * The item that opens the submenu, then the `Menu.Content` it opens.\n * Exactly those two, in that order. The count is the type's to enforce;\n * the order is not, since every JSX element has the same type.\n */\n children: [trigger: ReactElement, content: ReactElement];\n /**\n * How long the pointer rests on the item before the submenu opens, in\n * milliseconds.\n * @default 200\n */\n delay?: number;\n};\n\n// The default empty state, at module scope so every menu hands React Aria\n// the same function.\nfunction emptyState() {\n return <CollectionEmpty variant=\"menu\" />;\n}\n\n// What the item draws, from React Aria's render state. Built by a call\n// rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\n//\n// The render state decides three things: the chevron, which an item inside a\n// SubmenuTrigger gets without the call site asking twice, the check on a\n// selected item, and the supporting line's colour, which the row module takes\n// from whether the row is selected or disabled.\n//\n// The check takes the leading slot where the item has leading content, in\n// place of it, and comes at the end of the row where it has none. Either way\n// the label stays where it was, so choosing an item moves nothing in the\n// menu. Hidden from the tree, since React Aria's `aria-checked` already says\n// the item is chosen.\nfunction itemContent(children: ReactNode, leading: ReactNode, shortcut: ReactNode, trailing: ReactNode, ripple: ReactNode) {\n return (state: MenuItemRenderProps) => {\n const check = state.isSelected ? <CheckGlyph className=\"xxk0z11 x9f619 x2lah0s xvy4d1p\" /> : undefined;\n const hasLeading = leading !== undefined && leading !== null;\n return <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={hasLeading ? check ?? leading : undefined} trailing={trailingOf(state, shortcut, trailing, hasLeading ? undefined : check)} variant=\"menu\">\n <Text slot=\"label\">{children}</Text>\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n };\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so an\n// item's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled item, so nothing has to outrank them.\n// No overline, and so no three-line row: the menus page gives one item\n// height and one line of text. `List.Item` and `ListBox.Item` take the prop\n// because the lists page is what they draw, and this row is 48dp rather than\n// that page's 56. A label longer than the surface's 280dp still wraps, and\n// breaks inside a word that is wider than that, rather than running out of\n// the surface and under the shortcut — the shared row's rule, which nothing\n// here truncates.\nfunction itemStyles(state: MenuItemRenderProps) {\n return stylex.props(rowStyles.base, rowStyles.menu, state.isSelected && rowStyles.selectedMenu, state.isHovered && rowStyles.hovered, state.isFocusVisible && rowStyles.focusVisible, state.isFocusVisible && state.isSelected && rowStyles.focusVisibleSelected, state.isPressed && rowStyles.pressed, state.isDisabled && rowStyles.disabled);\n}\n\n/**\n * A list of actions opened from a control. Open state is React Aria's: pass\n * `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it keep\n * its own.\n *\n * A `Button` or `IconButton` placed directly inside opens it; everything the\n * menu shows goes in `Menu.Content`, since the trigger lives in the page\n * while the menu is portalled out to the end of the body.\n *\n * ```tsx\n * <Menu>\n * <Button>Open</Button>\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * </Menu.Content>\n * </Menu>\n * ```\n *\n * The trigger's text names the menu, so the button is where a label goes.\n */\nfunction Menu({\n children,\n ...props\n}: MenuProps) {\n return <RACMenuTrigger {...props}>{children}</RACMenuTrigger>;\n}\n\n/**\n * The menu itself, and the surface it is drawn on. React Aria names it after\n * the control that opened it, so `aria-label` here is ignored — name the\n * trigger instead.\n *\n * The call site's `className` and `style` land on the surface, which is the\n * element a layout positions.\n *\n * The placement and the offsets are passed on only where the call site gives\n * them. React Aria hands the popover a placement of its own through context —\n * below the trigger for a menu, at the item's inline end for a submenu — and\n * a prop set here replaces it, so a default written here opened every\n * submenu below its item, over the rest of the menu it came from.\n *\n * A menu with nothing in it shows a muted \"No results\" row in place of its\n * items, and says so through a status on the surface, which is what a search\n * that matches nothing leaves; pass `renderEmptyState` to draw something\n * else.\n */\nfunction MenuContent<T extends object = object>({\n align,\n alignOffset,\n className,\n container,\n ref,\n search,\n side,\n sideOffset,\n style,\n ...props\n}: MenuContentProps<T> & RefAttributes<HTMLElement>) {\n return <RACPopover crossOffset={alignOffset} offset={sideOffset} placement={side === undefined && align === undefined ? undefined : placementOf(side ?? 'bottom', align ?? 'start')}\n // The surface, where the call site's class and style land, rather than\n // the menu inside it, which takes the rest of the props.\n ref={ref}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles(surfaceStyles, {\n className,\n style\n })}>\n <CollectionStatus>\n {search === undefined ? null : <SearchSlot>{search}</SearchSlot>}\n <RACMenu<T> renderEmptyState={emptyState} {...props} className=\"x9f619 x78zum5 xdt5ytf x1t137rt\" />\n </CollectionStatus>\n </RACPopover>;\n}\n\n// What a press on the search slot focuses: its field's own control.\nconst SEARCH_CONTROL = 'input, textarea, [contenteditable=\"true\"]';\n\n/**\n * One action. Its slots are the row's: `leading` before the label, the label\n * as children, and `trailing` after it, with `shortcut` at the end. An item\n * that opens a submenu draws the chevron itself.\n */\nfunction MenuItem<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n shortcut,\n textValue,\n trailing,\n ...props\n}: MenuItemProps<T> & RefAttributes<HTMLDivElement>) {\n // The press ripple List's rows draw — see ListItem there.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACMenuItem textValue={textValue ?? textOf(children)} {...ripple.handlers} {...props} {...mergeStatefulStyles(itemStyles, props)}>\n {itemContent(children, leading, shortcut, trailing, ripple.surface)}\n </RACMenuItem>;\n}\n\n/**\n * The row shown while more items are being fetched. React Aria calls\n * `onLoadMore` when it comes into view, and draws it only while `isLoading`.\n */\nfunction MenuLoadMore({\n label,\n ...props\n}: MenuLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACMenuLoadMoreItem {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xl56j7k x1ddmzdj\"\n }, props)}>\n <CollectionLoadMore diameter=\"20px\" label={label} />\n </RACMenuLoadMoreItem>;\n}\n\n/**\n * A named group of items. `header` names it, and is what a screen reader\n * reads before the items inside.\n */\nfunction MenuSection<T extends object = object>({\n children,\n header,\n ...props\n}: MenuSectionProps<T> & RefAttributes<HTMLElement>) {\n return <RACMenuSection {...props}>\n {header === undefined ? null : <Header className=\"x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q xw3mh6e x6gmt8y x790zyz\">{header}</Header>}\n {children}\n </RACMenuSection>;\n}\n\n/**\n * A rule between groups of items. It takes its role from the menu around it,\n * so it needs no slot from the call site.\n */\nfunction MenuSeparator(props: MenuSeparatorProps) {\n return <Separator {...props} {...mergeStyles({\n className: \"xwpi13i\"\n }, props)} />;\n}\n\n/**\n * An item that opens a menu of its own. Takes exactly two children: the\n * `Menu.Item` that opens it, then the `Menu.Content` it opens.\n */\nfunction MenuSubmenu(props: MenuSubmenuProps) {\n return <RACSubmenuTrigger {...props} />;\n}\n\n/**\n * The search bar above a menu's items, mounted only while the menu is open.\n *\n * Its field takes focus as it mounts. React Aria's popover otherwise took\n * focus itself whenever a pointer opened the menu, so typing went nowhere\n * and only a keyboard's Enter happened to land in the field. Mounted before\n * the items, so the popover finds focus already inside it and leaves it.\n *\n * The query is cleared as it unmounts. The `Autocomplete` that filters the\n * items wraps this whole part and outlives the popover, so its query did\n * too: a menu filtered, used and reopened came back filtered.\n */\nfunction SearchSlot({\n children\n}: {\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const autocomplete = useContext(AutocompleteStateContext);\n // The latest state, for the cleanup below to clear: the state object is a\n // new one on every render, and the effect that mounts the bar runs once.\n const latest = useRef(autocomplete);\n useEffect(() => {\n latest.current = autocomplete;\n });\n useEffect(() => {\n ref.current?.querySelector<HTMLElement>(SEARCH_CONTROL)?.focus();\n return () => {\n latest.current?.setInputValue('');\n };\n }, []);\n return <div ref={ref} className=\"x9f619 xqf7pud xn60lsn\">\n {children}\n </div>;\n}\n\n// The surface grows from the edge it is anchored by, which is what makes it\n// read as coming out of the trigger. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after.\nfunction surfaceStyles(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.content, popupOrigin(state.placement));\n}\n\n/** What sits after the label: the call site's content, then the shortcut or\n * the submenu's chevron. */\nfunction trailingOf(state: MenuItemRenderProps, shortcut: ReactNode, trailing: ReactNode, check: ReactNode) {\n if (state.hasSubmenu) {\n return <>\n {trailing}\n <ChevronEndGlyph className=\"x1qx5ct2 xw4jnvo x19axjrm x1c071of\" />\n </>;\n }\n if (shortcut === undefined && trailing === undefined && check === undefined) {\n return undefined;\n }\n return <>\n {trailing}\n {shortcut === undefined ? null : <Keyboard {...stylex.props(styles.shortcut, supportingTone('menu', state))}>\n <KeycapToneContext value={state.isDisabled || state.isSelected ? 'inherit' : 'neutral'}>\n {shortcut}\n </KeycapToneContext>\n </Keyboard>}\n {check}\n </>;\n}\nMenu.Content = MenuContent;\nMenu.Item = MenuItem;\nMenu.LoadMore = MenuLoadMore;\nMenu.Section = MenuSection;\nMenu.Separator = MenuSeparator;\nMenu.Submenu = MenuSubmenu;\nexport type { MenuAlign, MenuContentProps, MenuItemProps, MenuLoadMoreProps, MenuProps, MenuSectionProps, MenuSeparatorProps, MenuSide, MenuSubmenuProps };\nexport { MenuContent, MenuItem, MenuLoadMore, MenuSection, MenuSeparator, MenuSubmenu };\nexport default Menu;"],"mappings":";;;;;;;;;;;;;;;;;AA4EA,MAAMqB,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ;EACRF,OAAO;CACT;AACF;AAqIA,SAASgB,aAAa;CACpB,OAAO,oBAAC,iBAAD,EAAiB,SAAQ,OAAM,CAAA;AACxC;AAiBA,SAASC,YAAYN,UAAqBC,SAAoB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AAmB,OAAOA,MAAMK,cAAcL,MAAME,aAAa,YAAY;IAC1EpB,UAAAA;GACgB,CAAA;EACX,CAAA;EACXmB;CACH,EAAA,CAAA;AACJ;AACA3C,KAAKkG,UAAUjC;AACfjE,KAAKmG,OAAOlG;AACZD,KAAKoG,WAAWjB;AAChBnF,KAAKqG,UAAUjG;AACfJ,KAAKc,YAAYsE;AACjBpF,KAAKsG,UAAUjB"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","useContext","useEffect","useRef","AutocompleteStateContext","Menu","MenuItem","RACMenuItem","RACMenuLoadMoreItem","MenuSection","textOf","useRipple","rowStyles","supportingTone","mergeStatefulStyles","mergeStyles","overlay","placementOf","popupOrigin","Separator","styles","content","kWkggS","kaIpWk","ks0D6T","k7Eaqz","k3XXqK","k8WAf4","$$css","shortcut","kMwMTN","align","alignOffset","className","container","search","side","sideOffset","style","children","leading","trailing","label","header","emptyState","itemContent","ripple","state","hasLeading","undefined","check","isSelected","selectionMode","isDisabled","trailingOf","itemStyles","props","base","menu","selectedMenu","isHovered","hovered","isFocusVisible","focusVisible","focusVisibleSelected","isPressed","pressed","disabled","t0","$","t1","MenuContent","ref","t2","surfaceStyles","t3","t4","t5","t6","SEARCH_CONTROL","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","T0","handlers","surface","MenuLoadMore","MenuSeparator","MenuSubmenu","SearchSlot","autocomplete","latest","current","Symbol","for","querySelector","focus","setInputValue","popup","placement","hasSubmenu","Content","Item","LoadMore","Section","Submenu","RACMenuTrigger","RACMenu","RACPopover","RACMenuSection","Separator","RACSubmenuTrigger"],"sources":["../../../src/components/menu/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ComponentProps, ReactElement, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, MenuItemRenderProps, PopoverRenderProps, MenuItemProps as RACMenuItemProps, MenuLoadMoreItemProps as RACMenuLoadMoreItemProps, MenuProps as RACMenuProps, MenuSectionProps as RACMenuSectionProps, MenuTriggerProps as RACMenuTriggerProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useEffect, useRef } from 'react';\nimport { AutocompleteStateContext, Header, Keyboard, Menu as RACMenu, MenuItem as RACMenuItem, MenuLoadMoreItem as RACMenuLoadMoreItem, MenuSection as RACMenuSection, MenuTrigger as RACMenuTrigger, Popover as RACPopover, SubmenuTrigger as RACSubmenuTrigger, Text } from 'react-aria-components';\nimport type { OverlayAlign, OverlaySide } from '../../styles/overlay';\nimport { CollectionEmpty, CollectionLoadMore, CollectionStatus } from '../../collection';\nimport { textOf } from '../../collection/text';\nimport { CheckGlyph, ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { KeycapToneContext } from '../../keycap/context';\nimport { RowContent } from '../../row';\nimport { rowStyles, supportingTone } from '../../row/styles';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay, placementOf, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, sizing, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Separator from '../separator';\n\n// The menus page's menu: a surface between 112 and 280 wide with a 4dp\n// corner and 8dp above and below its items, holding rows of the row module's\n// menu variant — 48dp tall, a label-large label, tertiary container when\n// selected, with a check beside the label. The container alone sits as close\n// as 1.1:1 to the surface, so the check is what carries the selection for a\n// reader who cannot tell the two apart. The surface itself is the overlay module's, shared with Popover\n// and Sheet, with the two things the menus page decides differently applied\n// over it: the corner, which is the extra-small step rather than the\n// medium one every other overlay takes, and the container colour, which is\n// the Expressive column's surface container low rather than the baseline's\n// surface container.\n//\n// Six parts, because everything a menu holds takes arbitrary content:\n// `Menu.Content`, `Menu.Item`, `Menu.Section`, `Menu.Separator`,\n// `Menu.Submenu` and `Menu.LoadMore`. A `Button` or `IconButton` placed\n// directly inside `Menu` is the trigger, wired through React Aria's context\n// rather than a part of ours — the same arrangement Sheet and Popover use.\n//\n// Four things are worth knowing about how this maps onto React Aria.\n//\n// **The item's styles are a function of its render state.** StyleX cannot\n// target `[data-selected]` on the element it is styling, so selection,\n// disabled and the rest are read from the state React Aria hands the\n// `className` function, wrapped in `mergeStatefulStyles` so a call site's own\n// `className` survives.\n//\n// **A shortcut goes through React Aria's `Keyboard` slot**, and the label\n// through its `Text` slot. The second is what makes the first work: React\n// Aria points the item's `aria-labelledby` at the labelled text, so a screen\n// reader reads the label alone and announces the keystroke separately. Left\n// as plain content, the item's name is its whole text and the shortcut is\n// read as part of what the item does. The keycap itself is the library's.\n// The shortcut's colour follows the item's state as the supporting line's\n// does, through the same `supportingTone`, and a selected or disabled item\n// hands a keycap inside it the `inherit` tone, so the keycap follows too.\n//\n// **A submenu's arrow is drawn from render state, not from a prop.** React\n// Aria reports `hasSubmenu` on the item inside a `SubmenuTrigger`, so an item\n// that opens one gets the chevron without the call site saying so twice. The\n// glyph carries no direction of its own, so the style mirrors it under a\n// right-to-left writing mode.\n//\n// **A menu's children are a collection**, so anything that is not an item is\n// dropped: React Aria walks them looking for items and finds a search input\n// no place to be. `Menu.Content` therefore takes a `search` slot, drawn on\n// the surface above the items — which is also what puts the bar and the\n// items inside one `Autocomplete` when the menu is filtered.\n//\n// **A separator needs no slot from the call site.** React Aria's menu\n// provides the separator context, which is what `Menu.Separator` picks up —\n// that is why Separator moved onto React Aria in Phase 0. What is added here\n// is the menus page's 8dp either side of the rule.\n\nconst MENU_MIN = '112px';\nconst MENU_MAX = '280px';\nconst styles = {\n content: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n ks0D6T: \"x1jkqq1h\",\n k7Eaqz: \"x1c7vg25\",\n k3XXqK: \"x1t137rt\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n },\n shortcut: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\ntype MenuAlign = OverlayAlign;\ntype MenuContentProps<T extends object = object> = {\n /**\n * Where the menu lines up along that side. Left out, a menu lines up with\n * the start of its trigger, and a submenu with the top of the item that\n * opens it.\n */\n align?: MenuAlign;\n /** Moves the menu along that side, in pixels. */\n alignOffset?: number;\n /**\n * Lands on the surface, which is the element a layout positions. A\n * function may compute the class from the surface's render state.\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * Where to portal the menu. Defaults to the container of the `ThemeScope`\n * around it, which keeps the menu on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the menu\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * What the menu shows when nothing is in it — after a search that matched\n * nothing, usually. Left out, it is a muted row saying \"No results\" in the\n * I18nProvider's locale, which the surface also announces, so the menu\n * keeps a row's height rather than shrinking to its search bar. One of the\n * call site's own replaces the announcement as well as the row.\n */\n renderEmptyState?: RACMenuProps<T>['renderEmptyState'];\n /**\n * Content drawn on the surface above the items — a search bar that filters\n * them, usually. It goes here rather than among the children because a\n * menu's children are a collection: React Aria walks them for items and\n * drops anything else, so an input written beside them disappears.\n *\n * To filter with it, wrap this whole part in `Autocomplete`, which puts\n * the bar and the items inside one wrapper. The bar takes focus as the\n * menu opens, however it was opened, so typing filters straight away,\n * and its query is cleared as the menu closes, so a reopened menu shows\n * every item.\n */\n search?: ReactNode;\n /**\n * Which side of the trigger the menu opens on. Left out, a menu opens below\n * its trigger and a submenu at the inline end of the item that opens it,\n * where the item's chevron points — the places React Aria gives each.\n * Given `align` alone, the side is `bottom`. `start` and `end` follow the\n * writing direction, as a submenu does; `left` and `right` stay put in\n * either.\n */\n side?: MenuSide;\n /**\n * How far the menu sits from the trigger, in pixels. Left out, React Aria's:\n * 8, or 0 for a menu opened with `trigger=\"contextMenu\"`.\n */\n sideOffset?: number;\n /** Lands on the surface, as `className` does. */\n style?: StyleOrFunction<PopoverRenderProps>;\n} & Omit<RACMenuProps<T>, 'className' | 'renderEmptyState' | 'style'>;\ntype MenuItemProps<T extends object = object> = {\n /** The item's label — what it does. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACMenuItemProps<T>['className'];\n /** Content before the label, usually an icon. */\n leading?: ReactNode;\n /**\n * The keystroke that runs the item, at the end of the row. Pass a `Keycap`\n * to draw it as one; a string is set as plain text in the muted role. Either\n * goes through React Aria's keyboard slot, so a screen reader announces it\n * apart from the label rather than reading the two as one name. It takes\n * the item's colour while the item is selected or disabled, and so does a\n * `Keycap` inside it, its rule included.\n */\n shortcut?: ReactNode;\n /** A function may compute the style from the item's render state. */\n style?: RACMenuItemProps<T>['style'];\n /** Content after the label, before the shortcut. */\n trailing?: ReactNode;\n} & Omit<RACMenuItemProps<T>, 'children' | 'className' | 'style'>;\ntype MenuLoadMoreProps = Omit<RACMenuLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\n\n// `children` is optional here where React Aria makes it required, so the\n// type reads the way Sheet's and Popover's do: a root that composes rather\n// than one that has to be handed something. Sheet does the same for the same\n// reason.\ntype MenuProps = Omit<RACMenuTriggerProps, 'children'> & {\n /** The trigger, then the `Menu.Content` it opens. */\n children?: ReactNode;\n};\ntype MenuSectionProps<T extends object = object> = Omit<RACMenuSectionProps<T>, 'children'> & {\n /**\n * The items in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\ntype MenuSeparatorProps = Omit<ComponentProps<typeof Separator>, 'orientation'>;\ntype MenuSide = OverlaySide;\ntype MenuSubmenuProps = {\n /**\n * The item that opens the submenu, then the `Menu.Content` it opens.\n * Exactly those two, in that order. The count is the type's to enforce;\n * the order is not, since every JSX element has the same type.\n */\n children: [trigger: ReactElement, content: ReactElement];\n /**\n * How long the pointer rests on the item before the submenu opens, in\n * milliseconds.\n * @default 200\n */\n delay?: number;\n};\n\n// The default empty state, at module scope so every menu hands React Aria\n// the same function.\nfunction emptyState() {\n return <CollectionEmpty variant=\"menu\" />;\n}\n\n// What the item draws, from React Aria's render state. Built by a call\n// rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\n//\n// The render state decides three things: the chevron, which an item inside a\n// SubmenuTrigger gets without the call site asking twice, the check on a\n// selected item, and the supporting line's colour, which the row module takes\n// from whether the row is selected or disabled.\n//\n// The check takes the leading slot where the item has leading content, in\n// place of it, and comes at the end of the row where it has none. Either way\n// the label stays where it was, so choosing an item moves nothing in the\n// menu. Hidden from the tree, since React Aria's `aria-checked` already says\n// the item is chosen.\n//\n// At the end of the row, an item that is not chosen keeps the check's 24dp\n// empty in its place, in a menu that selects at all. The check comes after a\n// shortcut, so drawn on the chosen item alone it pushed that item's keycap\n// in from the others', and the shortcuts stopped forming a column. A menu\n// that selects nothing has no check to make room for, and keeps none.\nfunction itemContent(children: ReactNode, leading: ReactNode, shortcut: ReactNode, trailing: ReactNode, ripple: ReactNode) {\n return (state: MenuItemRenderProps) => {\n const hasLeading = leading !== undefined && leading !== null;\n const check = state.isSelected ? <CheckGlyph className=\"xxk0z11 x9f619 x2lah0s xvy4d1p\" /> : hasLeading || state.selectionMode === 'none' ? undefined : <span aria-hidden className=\"xxk0z11 x9f619 x2lah0s xvy4d1p\" />;\n return <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={hasLeading ? check ?? leading : undefined} trailing={trailingOf(state, shortcut, trailing, hasLeading ? undefined : check)} variant=\"menu\">\n <Text slot=\"label\">{children}</Text>\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n };\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so an\n// item's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled item, so nothing has to outrank them.\n// No overline, and so no three-line row: the menus page gives one item\n// height and one line of text. `List.Item` and `ListBox.Item` take the prop\n// because the lists page is what they draw, and this row is 48dp rather than\n// that page's 56. A label longer than the surface's 280dp still wraps, and\n// breaks inside a word that is wider than that, rather than running out of\n// the surface and under the shortcut — the shared row's rule, which nothing\n// here truncates.\nfunction itemStyles(state: MenuItemRenderProps) {\n return stylex.props(rowStyles.base, rowStyles.menu, state.isSelected && rowStyles.selectedMenu, state.isHovered && rowStyles.hovered, state.isFocusVisible && rowStyles.focusVisible, state.isFocusVisible && state.isSelected && rowStyles.focusVisibleSelected, state.isPressed && rowStyles.pressed, state.isDisabled && rowStyles.disabled);\n}\n\n/**\n * A list of actions opened from a control. Open state is React Aria's: pass\n * `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it keep\n * its own.\n *\n * A `Button` or `IconButton` placed directly inside opens it; everything the\n * menu shows goes in `Menu.Content`, since the trigger lives in the page\n * while the menu is portalled out to the end of the body.\n *\n * ```tsx\n * <Menu>\n * <Button>Open</Button>\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * </Menu.Content>\n * </Menu>\n * ```\n *\n * The trigger's text names the menu, so the button is where a label goes.\n */\nfunction Menu({\n children,\n ...props\n}: MenuProps) {\n return <RACMenuTrigger {...props}>{children}</RACMenuTrigger>;\n}\n\n/**\n * The menu itself, and the surface it is drawn on. React Aria names it after\n * the control that opened it, so `aria-label` here is ignored — name the\n * trigger instead.\n *\n * The call site's `className` and `style` land on the surface, which is the\n * element a layout positions.\n *\n * The placement and the offsets are passed on only where the call site gives\n * them. React Aria hands the popover a placement of its own through context —\n * below the trigger for a menu, at the item's inline end for a submenu — and\n * a prop set here replaces it, so a default written here opened every\n * submenu below its item, over the rest of the menu it came from.\n *\n * A menu with nothing in it shows a muted \"No results\" row in place of its\n * items, and says so through a status on the surface, which is what a search\n * that matches nothing leaves; pass `renderEmptyState` to draw something\n * else.\n */\nfunction MenuContent<T extends object = object>({\n align,\n alignOffset,\n className,\n container,\n ref,\n search,\n side,\n sideOffset,\n style,\n ...props\n}: MenuContentProps<T> & RefAttributes<HTMLElement>) {\n return <RACPopover crossOffset={alignOffset} offset={sideOffset} placement={side === undefined && align === undefined ? undefined : placementOf(side ?? 'bottom', align ?? 'start')}\n // The surface, where the call site's class and style land, rather than\n // the menu inside it, which takes the rest of the props.\n ref={ref}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles(surfaceStyles, {\n className,\n style\n })}>\n <CollectionStatus>\n {search === undefined ? null : <SearchSlot>{search}</SearchSlot>}\n <RACMenu<T> renderEmptyState={emptyState} {...props} className=\"x9f619 x78zum5 xdt5ytf x1t137rt\" />\n </CollectionStatus>\n </RACPopover>;\n}\n\n// What a press on the search slot focuses: its field's own control.\nconst SEARCH_CONTROL = 'input, textarea, [contenteditable=\"true\"]';\n\n/**\n * One action. Its slots are the row's: `leading` before the label, the label\n * as children, and `trailing` after it, with `shortcut` at the end. An item\n * that opens a submenu draws the chevron itself.\n */\nfunction MenuItem<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n shortcut,\n textValue,\n trailing,\n ...props\n}: MenuItemProps<T> & RefAttributes<HTMLDivElement>) {\n // The press ripple List's rows draw — see ListItem there.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACMenuItem textValue={textValue ?? textOf(children)} {...ripple.handlers} {...props} {...mergeStatefulStyles(itemStyles, props)}>\n {itemContent(children, leading, shortcut, trailing, ripple.surface)}\n </RACMenuItem>;\n}\n\n/**\n * The row shown while more items are being fetched. React Aria calls\n * `onLoadMore` when it comes into view, and draws it only while `isLoading`.\n */\nfunction MenuLoadMore({\n label,\n ...props\n}: MenuLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACMenuLoadMoreItem {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xl56j7k x1ddmzdj\"\n }, props)}>\n <CollectionLoadMore diameter=\"20px\" label={label} />\n </RACMenuLoadMoreItem>;\n}\n\n/**\n * A named group of items. `header` names it, and is what a screen reader\n * reads before the items inside.\n */\nfunction MenuSection<T extends object = object>({\n children,\n header,\n ...props\n}: MenuSectionProps<T> & RefAttributes<HTMLElement>) {\n return <RACMenuSection {...props}>\n {header === undefined ? null : <Header className=\"x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q xw3mh6e x6gmt8y x790zyz\">{header}</Header>}\n {children}\n </RACMenuSection>;\n}\n\n/**\n * A rule between groups of items. It takes its role from the menu around it,\n * so it needs no slot from the call site.\n */\nfunction MenuSeparator(props: MenuSeparatorProps) {\n return <Separator {...props} {...mergeStyles({\n className: \"xwpi13i\"\n }, props)} />;\n}\n\n/**\n * An item that opens a menu of its own. Takes exactly two children: the\n * `Menu.Item` that opens it, then the `Menu.Content` it opens.\n */\nfunction MenuSubmenu(props: MenuSubmenuProps) {\n return <RACSubmenuTrigger {...props} />;\n}\n\n/**\n * The search bar above a menu's items, mounted only while the menu is open.\n *\n * Its field takes focus as it mounts. React Aria's popover otherwise took\n * focus itself whenever a pointer opened the menu, so typing went nowhere\n * and only a keyboard's Enter happened to land in the field. Mounted before\n * the items, so the popover finds focus already inside it and leaves it.\n *\n * The query is cleared as it unmounts. The `Autocomplete` that filters the\n * items wraps this whole part and outlives the popover, so its query did\n * too: a menu filtered, used and reopened came back filtered.\n */\nfunction SearchSlot({\n children\n}: {\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const autocomplete = useContext(AutocompleteStateContext);\n // The latest state, for the cleanup below to clear: the state object is a\n // new one on every render, and the effect that mounts the bar runs once.\n const latest = useRef(autocomplete);\n useEffect(() => {\n latest.current = autocomplete;\n });\n useEffect(() => {\n ref.current?.querySelector<HTMLElement>(SEARCH_CONTROL)?.focus();\n return () => {\n latest.current?.setInputValue('');\n };\n }, []);\n return <div ref={ref} className=\"x9f619 xqf7pud xn60lsn\">\n {children}\n </div>;\n}\n\n// The surface grows from the edge it is anchored by, which is what makes it\n// read as coming out of the trigger. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after.\nfunction surfaceStyles(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.content, popupOrigin(state.placement));\n}\n\n/** What sits after the label: the call site's content, then the shortcut or\n * the submenu's chevron. */\nfunction trailingOf(state: MenuItemRenderProps, shortcut: ReactNode, trailing: ReactNode, check: ReactNode) {\n if (state.hasSubmenu) {\n return <>\n {trailing}\n <ChevronEndGlyph className=\"x1qx5ct2 xw4jnvo x19axjrm x1c071of\" />\n </>;\n }\n if (shortcut === undefined && trailing === undefined && check === undefined) {\n return undefined;\n }\n return <>\n {trailing}\n {shortcut === undefined ? null : <Keyboard {...stylex.props(styles.shortcut, supportingTone('menu', state))}>\n <KeycapToneContext value={state.isDisabled || state.isSelected ? 'inherit' : 'neutral'}>\n {shortcut}\n </KeycapToneContext>\n </Keyboard>}\n {check}\n </>;\n}\nMenu.Content = MenuContent;\nMenu.Item = MenuItem;\nMenu.LoadMore = MenuLoadMore;\nMenu.Section = MenuSection;\nMenu.Separator = MenuSeparator;\nMenu.Submenu = MenuSubmenu;\nexport type { MenuAlign, MenuContentProps, MenuItemProps, MenuLoadMoreProps, MenuProps, MenuSectionProps, MenuSeparatorProps, MenuSide, MenuSubmenuProps };\nexport { MenuContent, MenuItem, MenuLoadMore, MenuSection, MenuSeparator, MenuSubmenu };\nexport default Menu;"],"mappings":";;;;;;;;;;;;;;;;;AA4EA,MAAMqB,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ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A,KAAaR,aAAaQ,KAAAA,KAAaC,UAAUD,KAAAA,GAChE;CAEF,OAAO,qBAAA,YAAA,EAAA,UAAA;EACFR;EACAZ,aAAaoB,KAAAA,IAAY,OAAO,oBAAC,UAAD;GAAU,GAAIjD,MAAaoB,OAAOS,UAAUhB,eAAe,QAAQkC,KAAK,CAAC;GACtG,UAAA,oBAAC,mBAAD;IAAmB,OAAOA,MAAMM,cAAcN,MAAMI,aAAa,YAAY;IAC1EtB,UAAAA;GACgB,CAAA;EACX,CAAA;EACXqB;CACH,EAAA,CAAA;AACJ;AACA7C,KAAKmG,UAAUjC;AACflE,KAAKoG,OAAOnG;AACZD,KAAKqG,WAAWjB;AAChBpF,KAAKsG,UAAUlG;AACfJ,KAAKc,YAAYuE;AACjBrF,KAAKuG,UAAUjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","useLayoutEffect","useState","mergeRefs","useRender","mergeStyles","styles","destinations","kGNEyG","k1xSpc","kzQI83","kjj79g","k7Eaqz","$$css","HORIZONTAL","selectedRoute","NavigationBar","t0","$","children","props","render","element","setElement","isCramped","useCramped","t1","ref","undefined","t2","merged","t3","t4","form","context","t5","className","t6","t7","t8","defaultTagName","bar","t9","NavigationBarItem","shortfallOf","HTMLElement","total","destination","querySelectorAll","label","lastElementChild","Math","max","scrollWidth","clientWidth","needed","setNeeded","measure","window","matchMedia","matches","shortfall","relabel","resize","ResizeObserver","observe","text","MutationObserver","characterData","childList","subtree","disconnect","Item"],"sources":["../../../src/components/navigation-bar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useLayoutEffect, useMemo, useState } from 'react';\nimport type { NavigationItemProps } from '../../navigation';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { NavigationItem, NavigationList } from '../../navigation';\nimport { NavigationContext } from '../../navigation/context';\nimport { mergeRefs } from '../../render/ref';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors } from '../../tokens/design.tokens.stylex';\n\n// The navigation bar page's flexible bar: three to five destinations across\n// the bottom of a compact window, on the surface container, 64dp tall. Below\n// the medium breakpoint each destination is vertical and the destinations\n// share the bar's width equally; at it and above, each is the page's\n// horizontal pill, as wide as what it holds, and the group sits centred with\n// the spare width at the bar's ends. The destinations are `src/navigation`'s,\n// shared with NavigationRail, which holds the two forms' values.\n//\n// The 8dp between two horizontal pills is the library's own. The page puts\n// each pill in an item of a fixed width it does not give, and with no space\n// at all the pills met edge to edge.\n//\n// A horizontal destination is as wide as its icon, its label and 16dp either\n// side, so five of them need far more than the 600dp the breakpoint starts\n// at: five fifteen-letter labels come to about 780. Drawn anyway, every label\n// was cut short the moment the window crossed the breakpoint, while one\n// pixel narrower the vertical form showed them whole. So the bar measures\n// what its horizontal labels lack, and keeps the vertical form until it is\n// that much wider — see `useCramped`.\n//\n// A vertical destination's label stays on one line and is cut short with an\n// ellipsis where the destination's share of the bar ends, and a label cut\n// short shows its full text in the browser's tooltip on hover — see\n// `src/navigation`. Five destinations give each label 69dp at a 375dp\n// window and 66dp at 360dp, about ten characters of label medium, so five\n// destinations' names have to be short.\n//\n// The 64dp is the destinations' row rather than the bar's height, and the\n// bar grows past it: by padding the call site gives it, such as the inset a\n// phone's home indicator asks for, and with its labels under a reader's\n// wider text spacing. The bar adds no inset of its own, since only the call\n// site knows whether the bar sits at the screen's edge.\n//\n// The bar is a `<nav>`, and a page usually has more than one navigation\n// landmark, so name it with `aria-label`.\n\nconst styles = {\n destinations: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kzQI83: \"x1iyjqo2\",\n kjj79g: \"xl56j7k\",\n k7Eaqz: \"xeuugli\",\n $$css: true\n }\n};\n\n// The window size the bar draws its horizontal form at, which the styles read\n// as `media.medium`. Spelled again for `matchMedia`, the one thing here that\n// has to know it outside a stylesheet — see `useCramped`.\nconst HORIZONTAL = '(width >= 600px)';\ntype NavigationBarProps = RenderComponentProps<'nav'> & {\n /**\n * The route of the current destination, matched exactly against each\n * destination's `href`. The match carries `aria-current=\"page\"` and the\n * active indicator. For a route nested under a destination, which no\n * `href` matches whole, mark that destination with its own `isCurrent`.\n */\n selectedRoute?: string;\n};\n\n/**\n * The bar of three to five top-level destinations a compact window keeps at\n * its bottom edge. Each destination is a link, so it routes through React\n * Aria's `RouterProvider` when the app has one. The bar is a navigation\n * landmark, so name it with `aria-label`, and give a badge its words in\n * `badgeLabel`, since the badge itself is hidden from assistive technology.\n *\n * Its form follows the window. Below 600px each destination is vertical, its\n * icon over its label, and the destinations share the bar's width; from 600px\n * each is a horizontal pill, once the window is wide enough for every label\n * to show whole.\n *\n * ```tsx\n * <NavigationBar aria-label=\"Label\" selectedRoute=\"/first\">\n * <NavigationBar.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationBar.Item>\n * <NavigationBar.Item\n * badge={3}\n * badgeLabel=\"3 new\"\n * href=\"/second\"\n * icon={<SecondIcon />}\n * >\n * Second item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/third\" icon={<ThirdIcon />}>\n * Third item\n * </NavigationBar.Item>\n * </NavigationBar>\n * ```\n *\n * The call site's `className` and `style` land on the `<nav>`. A bar kept at\n * the bottom edge of a phone's screen clears its home indicator with padding,\n * which adds to the bar's height rather than squeezing the destinations:\n *\n * ```tsx\n * <NavigationBar\n * aria-label=\"Label\"\n * style={{ paddingBlockEnd: 'env(safe-area-inset-bottom)' }}\n * >\n * ```\n */\nfunction NavigationBar({\n children,\n render,\n selectedRoute,\n ...props\n}: NavigationBarProps) {\n // The element, held as state rather than in a ref object, since the bar\n // measures it from an effect and has to run again when it changes.\n const [element, setElement] = useState<HTMLElement | null>(null);\n const isCramped = useCramped(element);\n // The call site's ref lands on the same element. Read off `props` rather\n // than destructured, as `useRender` reads it, so the compiler sees a prop\n // holding still rather than a ref read during render.\n const merged = useMemo(() => mergeRefs(setElement, props.ref ?? undefined), [props.ref]);\n const context = useMemo(() => ({\n form: isCramped ? 'barCramped' as const : 'bar' as const,\n selectedRoute\n }), [isCramped, selectedRoute]);\n const bar = useRender({\n defaultTagName: 'nav',\n props: {\n ...props,\n ...mergeStyles({\n className: \"x6s0dn4 x1mjdul6 x9f619 x78zum5 xh8yej3 x8nclml\"\n }, props),\n children: <NavigationList layout={styles.destinations}>{children}</NavigationList>,\n ref: merged\n },\n render\n });\n return <NavigationContext value={context}>{bar}</NavigationContext>;\n}\n\n/**\n * One destination of a navigation bar — an icon, a label and, when it is the\n * current one, the active indicator. See `NavigationBar`.\n *\n * Defined here rather than re-exported from `src/navigation`: a re-export\n * let the build hand the package entry that module directly, past this\n * module's client directive, and a server component importing it got the\n * component itself rather than a reference to a client one.\n */\nfunction NavigationBarItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>) {\n return <NavigationItem {...props} />;\n}\n\n/**\n * How much wider the bar would have to be for none of its labels to be cut\n * short: what each one lacks of its own width, summed. A label is the last\n * part of its destination's link, in its item of the bar's list.\n */\nfunction shortfallOf(bar: HTMLElement) {\n let total = 0;\n for (const destination of bar.querySelectorAll(':scope > ul > li > a')) {\n const label = destination.lastElementChild;\n if (label instanceof HTMLElement) {\n total += Math.max(0, label.scrollWidth - label.clientWidth);\n }\n }\n return total;\n}\n\n/**\n * Whether `bar`, at a width that draws its horizontal form, is too narrow\n * for it, so it draws the vertical one instead.\n *\n * The horizontal form is measured as it is drawn: where it cuts labels short,\n * the bar records the width it would need and switches, and it switches back\n * once it is that wide. A change to the destinations' text clears the record,\n * since what they need has changed with it. Measured in a layout effect, so\n * a bar that cannot fit is never painted cut short.\n */\nfunction useCramped(bar: HTMLElement | null) {\n // The bar's width the horizontal form needs, while it is wider than the\n // bar; undefined while the horizontal form fits, or has not been measured.\n const [needed, setNeeded] = useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n if (bar === null) {\n return undefined;\n }\n const measure = () => {\n if (needed !== undefined) {\n if (bar.clientWidth >= needed) {\n setNeeded(undefined);\n }\n return;\n }\n if (!window.matchMedia(HORIZONTAL).matches) {\n return;\n }\n const shortfall = shortfallOf(bar);\n if (shortfall > 0) {\n // A pixel over, so a bar exactly as wide as the sum of fractional\n // widths does not flip back and forth.\n setNeeded(bar.clientWidth + shortfall + 1);\n }\n };\n const relabel = () => {\n setNeeded(undefined);\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(bar);\n const text = new MutationObserver(relabel);\n text.observe(bar, {\n characterData: true,\n childList: true,\n subtree: true\n });\n return () => {\n resize.disconnect();\n text.disconnect();\n };\n }, [bar, needed]);\n return needed !== undefined;\n}\nNavigationBar.Item = NavigationBarItem;\nexport type { NavigationItemProps as NavigationBarItemProps, NavigationBarProps };\nexport { NavigationBarItem };\nexport default NavigationBar;"],"mappings":";;;;;;;;;;AAmDA,MAAMM,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAKA,MAAMC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDnB,SAAAE,cAAAC,IAAA;CAAA,MAAAC,IAAAlB,EAAA,EAAA;CAAA,IAAAmB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN;CAAA,IAAAG,EAAA,OAAAD,IAAA;EAAuB,CAAA,CAAAE,UAAAE,QAAAN,eAAA,GAAAK,SAAAH;EAKFC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAH;CAAA,OAAA;EAAAI,WAAAD,EAAA;EAAAE,QAAAF,EAAA;EAAAG,SAAAH,EAAA;EAAAH,gBAAAG,EAAA;CAAA;CAGnB,MAAA,CAAAI,SAAAC,cAA8BrB,SAA6B,IAAI;CAC/D,MAAAsB,YAAkBC,WAAWH,OAAO;CAIe,MAAAI,KAAAN,MAAKO,OAAL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B,KAAAA,GAAS;KACtB,IAAIa,IAAGa,eAAgBC,QACrBC,UAAU5B,KAAAA,CAAS;KACpB;IAAA;IAGH,IAAI,CAAC8B,OAAMC,WAAY7C,UAAU,CAAC,CAAA8C,SAAQ;IAG1C,MAAAC,YAAkBjB,YAAYH,GAAG;IACjC,IAAIoB,YAAY,GAGdL,UAAUf,IAAGa,cAAeO,YAAY,CAAC;GAC1C;GAEH,MAAAC,gBAAgB;IACdN,UAAU5B,KAAAA,CAAS;GAAC;GAEtB6B,QAAQ;GACR,MAAAM,SAAe,IAAIC,eAAeP,OAAO;GACzCM,OAAME,QAASxB,GAAG;GAClB,MAAAyB,OAAa,IAAIC,iBAAiBL,OAAO;GACzCI,KAAID,QAASxB,KAAK;IAAA2B,eACD;IAAIC,WACR;IAAIC,SACN;GACX,CAAC;GAAC,aACK;IACLP,OAAMQ,WAAY;IAClBL,KAAIK,WAAY;GAAC;EAClB;EACA7C,KAAA,CAACe,KAAKc,MAAM;EAACrC,EAAA,KAAAuB;EAAAvB,EAAA,KAAAqC;EAAArC,EAAA,KAAAD;EAAAC,EAAA,KAAAQ;CAAA,OAAA;EAAAT,KAAAC,EAAA;EAAAQ,KAAAR,EAAA;CAAA;CArChBjB,gBAAgBgB,IAqCbS,EAAa;CAAC,OACV6B,WAAW3B,KAAAA;AAAS;AAE7BZ,cAAcwD,OAAO7B"}
1
+ {"version":3,"file":"index.js","names":["_c","useLayoutEffect","useState","mergeRefs","useRender","mergeStyles","styles","destinations","kGNEyG","k1xSpc","kzQI83","kjj79g","k7Eaqz","$$css","HORIZONTAL","selectedRoute","NavigationBar","t0","$","children","props","render","element","setElement","isCramped","useCramped","t1","ref","undefined","t2","merged","t3","t4","form","context","t5","className","t6","t7","t8","defaultTagName","bar","t9","NavigationBarItem","shortfallOf","HTMLElement","total","destination","querySelectorAll","label","lastElementChild","Math","max","scrollWidth","clientWidth","needed","setNeeded","measure","window","matchMedia","matches","shortfall","relabel","resize","ResizeObserver","observe","text","MutationObserver","characterData","childList","subtree","disconnect","Item"],"sources":["../../../src/components/navigation-bar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useLayoutEffect, useMemo, useState } from 'react';\nimport type { NavigationItemProps } from '../../navigation';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { NavigationItem, NavigationList } from '../../navigation';\nimport { NavigationContext } from '../../navigation/context';\nimport { mergeRefs } from '../../render/ref';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors } from '../../tokens/design.tokens.stylex';\n\n// The navigation bar page's flexible bar: three to five destinations across\n// the bottom of a compact window, on the surface container, 64dp tall. Below\n// the medium breakpoint each destination is vertical and the destinations\n// share the bar's width equally; at it and above, each is the page's\n// horizontal pill, as wide as what it holds, and the group sits centred with\n// the spare width at the bar's ends. The destinations are `src/navigation`'s,\n// shared with NavigationRail, which holds the two forms' values.\n//\n// The 8dp between two horizontal pills is the library's own. The page puts\n// each pill in an item of a fixed width it does not give, and with no space\n// at all the pills met edge to edge.\n//\n// A horizontal destination is as wide as its icon, its label and 16dp either\n// side, so five of them need far more than the 600dp the breakpoint starts\n// at: five fifteen-letter labels come to about 780. Drawn anyway, every label\n// was cut short the moment the window crossed the breakpoint, while one\n// pixel narrower the vertical form showed them whole. So the bar measures\n// what its horizontal labels lack, and keeps the vertical form until it is\n// that much wider — see `useCramped`.\n//\n// A vertical destination's label stays on one line and is cut short with an\n// ellipsis where the destination's share of the bar ends, and a label cut\n// short shows its full text in the browser's tooltip on hover — see\n// `src/navigation`. The label is held 4dp in from either side of the share,\n// so an ellipsis never touches the label beside it. Five destinations give\n// each label 61dp at a 375dp window and 58dp at 360dp, about nine\n// characters of label medium, so five destinations' names have to be short.\n//\n// The 64dp is the destinations' row rather than the bar's height, and the\n// bar grows past it: by padding the call site gives it, such as the inset a\n// phone's home indicator asks for, and with its labels under a reader's\n// wider text spacing. The bar adds no inset of its own, since only the call\n// site knows whether the bar sits at the screen's edge.\n//\n// The bar is a `<nav>`, and a page usually has more than one navigation\n// landmark, so name it with `aria-label`.\n\nconst styles = {\n destinations: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kzQI83: \"x1iyjqo2\",\n kjj79g: \"xl56j7k\",\n k7Eaqz: \"xeuugli\",\n $$css: true\n }\n};\n\n// The window size the bar draws its horizontal form at, which the styles read\n// as `media.medium`. Spelled again for `matchMedia`, the one thing here that\n// has to know it outside a stylesheet — see `useCramped`.\nconst HORIZONTAL = '(width >= 600px)';\ntype NavigationBarProps = RenderComponentProps<'nav'> & {\n /**\n * The route of the current destination, matched exactly against each\n * destination's `href`. The match carries `aria-current=\"page\"` and the\n * active indicator. For a route nested under a destination, which no\n * `href` matches whole, mark that destination with its own `isCurrent`.\n */\n selectedRoute?: string;\n};\n\n/**\n * The bar of three to five top-level destinations a compact window keeps at\n * its bottom edge. Each destination is a link, so it routes through React\n * Aria's `RouterProvider` when the app has one. The bar is a navigation\n * landmark, so name it with `aria-label`, and give a badge its words in\n * `badgeLabel`, since the badge itself is hidden from assistive technology.\n *\n * Its form follows the window. Below 600px each destination is vertical, its\n * icon over its label, and the destinations share the bar's width; from 600px\n * each is a horizontal pill, once the window is wide enough for every label\n * to show whole.\n *\n * ```tsx\n * <NavigationBar aria-label=\"Label\" selectedRoute=\"/first\">\n * <NavigationBar.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationBar.Item>\n * <NavigationBar.Item\n * badge={3}\n * badgeLabel=\"3 new\"\n * href=\"/second\"\n * icon={<SecondIcon />}\n * >\n * Second item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/third\" icon={<ThirdIcon />}>\n * Third item\n * </NavigationBar.Item>\n * </NavigationBar>\n * ```\n *\n * The call site's `className` and `style` land on the `<nav>`. A bar kept at\n * the bottom edge of a phone's screen clears its home indicator with padding,\n * which adds to the bar's height rather than squeezing the destinations:\n *\n * ```tsx\n * <NavigationBar\n * aria-label=\"Label\"\n * style={{ paddingBlockEnd: 'env(safe-area-inset-bottom)' }}\n * >\n * ```\n */\nfunction NavigationBar({\n children,\n render,\n selectedRoute,\n ...props\n}: NavigationBarProps) {\n // The element, held as state rather than in a ref object, since the bar\n // measures it from an effect and has to run again when it changes.\n const [element, setElement] = useState<HTMLElement | null>(null);\n const isCramped = useCramped(element);\n // The call site's ref lands on the same element. Read off `props` rather\n // than destructured, as `useRender` reads it, so the compiler sees a prop\n // holding still rather than a ref read during render.\n const merged = useMemo(() => mergeRefs(setElement, props.ref ?? undefined), [props.ref]);\n const context = useMemo(() => ({\n form: isCramped ? 'barCramped' as const : 'bar' as const,\n selectedRoute\n }), [isCramped, selectedRoute]);\n const bar = useRender({\n defaultTagName: 'nav',\n props: {\n ...props,\n ...mergeStyles({\n className: \"x6s0dn4 x1mjdul6 x9f619 x78zum5 xh8yej3 x8nclml\"\n }, props),\n children: <NavigationList layout={styles.destinations}>{children}</NavigationList>,\n ref: merged\n },\n render\n });\n return <NavigationContext value={context}>{bar}</NavigationContext>;\n}\n\n/**\n * One destination of a navigation bar — an icon, a label and, when it is the\n * current one, the active indicator. See `NavigationBar`.\n *\n * Defined here rather than re-exported from `src/navigation`: a re-export\n * let the build hand the package entry that module directly, past this\n * module's client directive, and a server component importing it got the\n * component itself rather than a reference to a client one.\n */\nfunction NavigationBarItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>) {\n return <NavigationItem {...props} />;\n}\n\n/**\n * How much wider the bar would have to be for none of its labels to be cut\n * short: what each one lacks of its own width, summed. A label is the last\n * part of its destination's link, in its item of the bar's list.\n */\nfunction shortfallOf(bar: HTMLElement) {\n let total = 0;\n for (const destination of bar.querySelectorAll(':scope > ul > li > a')) {\n const label = destination.lastElementChild;\n if (label instanceof HTMLElement) {\n total += Math.max(0, label.scrollWidth - label.clientWidth);\n }\n }\n return total;\n}\n\n/**\n * Whether `bar`, at a width that draws its horizontal form, is too narrow\n * for it, so it draws the vertical one instead.\n *\n * The horizontal form is measured as it is drawn: where it cuts labels short,\n * the bar records the width it would need and switches, and it switches back\n * once it is that wide. A change to the destinations' text clears the record,\n * since what they need has changed with it. Measured in a layout effect, so\n * a bar that cannot fit is never painted cut short.\n */\nfunction useCramped(bar: HTMLElement | null) {\n // The bar's width the horizontal form needs, while it is wider than the\n // bar; undefined while the horizontal form fits, or has not been measured.\n const [needed, setNeeded] = useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n if (bar === null) {\n return undefined;\n }\n const measure = () => {\n if (needed !== undefined) {\n if (bar.clientWidth >= needed) {\n setNeeded(undefined);\n }\n return;\n }\n if (!window.matchMedia(HORIZONTAL).matches) {\n return;\n }\n const shortfall = shortfallOf(bar);\n if (shortfall > 0) {\n // A pixel over, so a bar exactly as wide as the sum of fractional\n // widths does not flip back and forth.\n setNeeded(bar.clientWidth + shortfall + 1);\n }\n };\n const relabel = () => {\n setNeeded(undefined);\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(bar);\n const text = new MutationObserver(relabel);\n text.observe(bar, {\n characterData: true,\n childList: true,\n subtree: true\n });\n return () => {\n resize.disconnect();\n text.disconnect();\n };\n }, [bar, needed]);\n return needed !== undefined;\n}\nNavigationBar.Item = NavigationBarItem;\nexport type { NavigationItemProps as NavigationBarItemProps, NavigationBarProps };\nexport { NavigationBarItem };\nexport default NavigationBar;"],"mappings":";;;;;;;;;;AAoDA,MAAMM,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAKA,MAAMC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDnB,SAAAE,cAAAC,IAAA;CAAA,MAAAC,IAAAlB,EAAA,EAAA;CAAA,IAAAmB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN;CAAA,IAAAG,EAAA,OAAAD,IAA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