@kanso-labs/kanso-ui 0.45.21 → 0.45.23

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 (269) hide show
  1. package/dist/badge/index.js.map +1 -1
  2. package/dist/button/context.js.map +1 -1
  3. package/dist/button/group.js.map +1 -1
  4. package/dist/button/hooks.js.map +1 -1
  5. package/dist/button/index.d.ts +3 -4
  6. package/dist/button/index.js.map +1 -1
  7. package/dist/button/styles.js.map +1 -1
  8. package/dist/button/toggle.js.map +1 -1
  9. package/dist/calendar/index.js +119 -11
  10. package/dist/calendar/index.js.map +1 -1
  11. package/dist/calendar/styles.js +19 -1
  12. package/dist/calendar/styles.js.map +1 -1
  13. package/dist/carousel/arrangement.d.ts +1 -2
  14. package/dist/carousel/arrangement.js.map +1 -1
  15. package/dist/chip/index.js.map +1 -1
  16. package/dist/chip/label.js.map +1 -1
  17. package/dist/chip/styles.js.map +1 -1
  18. package/dist/collection/empty.js.map +1 -1
  19. package/dist/collection/index.js.map +1 -1
  20. package/dist/collection/styles.js.map +1 -1
  21. package/dist/collection/text.js.map +1 -1
  22. package/dist/color-scheme.d.ts +1 -2
  23. package/dist/color-scheme.js.map +1 -1
  24. package/dist/components/app-bar/index.d.ts +9 -4
  25. package/dist/components/app-bar/index.js +123 -73
  26. package/dist/components/app-bar/index.js.map +1 -1
  27. package/dist/components/autocomplete/index.d.ts +1 -2
  28. package/dist/components/autocomplete/index.js.map +1 -1
  29. package/dist/components/avatar/index.d.ts +1 -2
  30. package/dist/components/avatar/index.js.map +1 -1
  31. package/dist/components/badge/index.d.ts +1 -2
  32. package/dist/components/badge/index.js.map +1 -1
  33. package/dist/components/breadcrumbs/index.d.ts +1 -2
  34. package/dist/components/breadcrumbs/index.js.map +1 -1
  35. package/dist/components/button/index.d.ts +1 -2
  36. package/dist/components/button/index.js.map +1 -1
  37. package/dist/components/button-group/index.d.ts +1 -2
  38. package/dist/components/button-group/index.js.map +1 -1
  39. package/dist/components/calendar/index.d.ts +4 -5
  40. package/dist/components/calendar/index.js +8 -19
  41. package/dist/components/calendar/index.js.map +1 -1
  42. package/dist/components/card/index.d.ts +1 -2
  43. package/dist/components/card/index.js.map +1 -1
  44. package/dist/components/carousel/index.d.ts +22 -4
  45. package/dist/components/carousel/index.js +26 -14
  46. package/dist/components/carousel/index.js.map +1 -1
  47. package/dist/components/checkbox/index.d.ts +1 -2
  48. package/dist/components/checkbox/index.js.map +1 -1
  49. package/dist/components/checkbox-group/index.d.ts +1 -2
  50. package/dist/components/checkbox-group/index.js.map +1 -1
  51. package/dist/components/chip/index.d.ts +1 -2
  52. package/dist/components/chip/index.js.map +1 -1
  53. package/dist/components/chip-group/index.d.ts +1 -2
  54. package/dist/components/chip-group/index.js +3 -0
  55. package/dist/components/chip-group/index.js.map +1 -1
  56. package/dist/components/code/index.d.ts +1 -2
  57. package/dist/components/code/index.js.map +1 -1
  58. package/dist/components/color-area/index.d.ts +1 -2
  59. package/dist/components/color-area/index.js.map +1 -1
  60. package/dist/components/color-field/index.d.ts +1 -2
  61. package/dist/components/color-field/index.js.map +1 -1
  62. package/dist/components/color-picker/index.d.ts +1 -2
  63. package/dist/components/color-picker/index.js +64 -46
  64. package/dist/components/color-picker/index.js.map +1 -1
  65. package/dist/components/color-slider/index.d.ts +1 -2
  66. package/dist/components/color-slider/index.js.map +1 -1
  67. package/dist/components/color-swatch/index.d.ts +1 -2
  68. package/dist/components/color-swatch/index.js +20 -16
  69. package/dist/components/color-swatch/index.js.map +1 -1
  70. package/dist/components/color-swatch-picker/index.d.ts +1 -2
  71. package/dist/components/color-swatch-picker/index.js.map +1 -1
  72. package/dist/components/color-wheel/index.d.ts +1 -2
  73. package/dist/components/color-wheel/index.js.map +1 -1
  74. package/dist/components/combo-box/index.d.ts +1 -2
  75. package/dist/components/combo-box/index.js.map +1 -1
  76. package/dist/components/container/index.d.ts +1 -2
  77. package/dist/components/container/index.js.map +1 -1
  78. package/dist/components/copy-field/index.d.ts +1 -2
  79. package/dist/components/copy-field/index.js +1 -0
  80. package/dist/components/copy-field/index.js.map +1 -1
  81. package/dist/components/currency/index.d.ts +1 -2
  82. package/dist/components/currency/index.js.map +1 -1
  83. package/dist/components/date-field/index.d.ts +1 -2
  84. package/dist/components/date-field/index.js.map +1 -1
  85. package/dist/components/date-picker/index.d.ts +1 -2
  86. package/dist/components/date-picker/index.js.map +1 -1
  87. package/dist/components/date-range-picker/index.d.ts +1 -2
  88. package/dist/components/date-range-picker/index.js +165 -81
  89. package/dist/components/date-range-picker/index.js.map +1 -1
  90. package/dist/components/dialog/index.d.ts +1 -2
  91. package/dist/components/dialog/index.js.map +1 -1
  92. package/dist/components/disclosure/index.d.ts +1 -2
  93. package/dist/components/disclosure/index.js.map +1 -1
  94. package/dist/components/disclosure-group/index.d.ts +1 -2
  95. package/dist/components/disclosure-group/index.js.map +1 -1
  96. package/dist/components/drop-zone/index.d.ts +1 -2
  97. package/dist/components/drop-zone/index.js.map +1 -1
  98. package/dist/components/drop-zone/styles.js.map +1 -1
  99. package/dist/components/fab/index.d.ts +1 -2
  100. package/dist/components/fab/index.js.map +1 -1
  101. package/dist/components/fab-menu/index.d.ts +1 -2
  102. package/dist/components/fab-menu/index.js.map +1 -1
  103. package/dist/components/feed/index.d.ts +1 -2
  104. package/dist/components/feed/index.js.map +1 -1
  105. package/dist/components/form/index.d.ts +1 -2
  106. package/dist/components/form/index.js.map +1 -1
  107. package/dist/components/icon-button/index.d.ts +1 -2
  108. package/dist/components/icon-button/index.js.map +1 -1
  109. package/dist/components/index.d.ts +2 -2
  110. package/dist/components/keycap/index.d.ts +1 -2
  111. package/dist/components/keycap/index.js.map +1 -1
  112. package/dist/components/link/index.d.ts +1 -2
  113. package/dist/components/link/index.js.map +1 -1
  114. package/dist/components/list/index.d.ts +1 -2
  115. package/dist/components/list/index.js.map +1 -1
  116. package/dist/components/list-box/index.d.ts +1 -2
  117. package/dist/components/list-box/index.js.map +1 -1
  118. package/dist/components/list-detail/index.d.ts +1 -2
  119. package/dist/components/list-detail/index.js.map +1 -1
  120. package/dist/components/list-item/index.d.ts +1 -2
  121. package/dist/components/list-item/index.js.map +1 -1
  122. package/dist/components/loading-indicator/index.d.ts +1 -2
  123. package/dist/components/loading-indicator/index.js.map +1 -1
  124. package/dist/components/menu/index.d.ts +1 -2
  125. package/dist/components/menu/index.js.map +1 -1
  126. package/dist/components/meter/index.d.ts +1 -2
  127. package/dist/components/meter/index.js.map +1 -1
  128. package/dist/components/navigation-bar/index.d.ts +1 -2
  129. package/dist/components/navigation-bar/index.js.map +1 -1
  130. package/dist/components/navigation-rail/index.d.ts +1 -2
  131. package/dist/components/navigation-rail/index.js.map +1 -1
  132. package/dist/components/navigation-tree/index.d.ts +1 -2
  133. package/dist/components/navigation-tree/index.js.map +1 -1
  134. package/dist/components/number-field/index.d.ts +1 -2
  135. package/dist/components/number-field/index.js.map +1 -1
  136. package/dist/components/popover/index.d.ts +1 -2
  137. package/dist/components/popover/index.js +14 -4
  138. package/dist/components/popover/index.js.map +1 -1
  139. package/dist/components/product-icon/index.d.ts +1 -2
  140. package/dist/components/product-icon/index.js.map +1 -1
  141. package/dist/components/progress-indicator/index.d.ts +1 -2
  142. package/dist/components/progress-indicator/index.js.map +1 -1
  143. package/dist/components/radio-group/index.d.ts +1 -2
  144. package/dist/components/radio-group/index.js.map +1 -1
  145. package/dist/components/range-calendar/index.d.ts +1 -2
  146. package/dist/components/range-calendar/index.js +53 -80
  147. package/dist/components/range-calendar/index.js.map +1 -1
  148. package/dist/components/search-field/index.d.ts +1 -2
  149. package/dist/components/search-field/index.js.map +1 -1
  150. package/dist/components/search-view/index.d.ts +1 -2
  151. package/dist/components/search-view/index.js.map +1 -1
  152. package/dist/components/segmented-button/index.d.ts +1 -2
  153. package/dist/components/segmented-button/index.js +261 -145
  154. package/dist/components/segmented-button/index.js.map +1 -1
  155. package/dist/components/select/index.d.ts +1 -2
  156. package/dist/components/select/index.js.map +1 -1
  157. package/dist/components/separator/index.d.ts +1 -2
  158. package/dist/components/separator/index.js.map +1 -1
  159. package/dist/components/sheet/index.d.ts +1 -2
  160. package/dist/components/sheet/index.js +149 -82
  161. package/dist/components/sheet/index.js.map +1 -1
  162. package/dist/components/slider/index.d.ts +1 -2
  163. package/dist/components/slider/index.js.map +1 -1
  164. package/dist/components/snackbar/index.d.ts +1 -2
  165. package/dist/components/snackbar/index.js.map +1 -1
  166. package/dist/components/split-button/index.d.ts +1 -2
  167. package/dist/components/split-button/index.js.map +1 -1
  168. package/dist/components/stack/index.d.ts +1 -2
  169. package/dist/components/stack/index.js.map +1 -1
  170. package/dist/components/supporting-pane/index.d.ts +1 -2
  171. package/dist/components/supporting-pane/index.js.map +1 -1
  172. package/dist/components/switch/index.d.ts +1 -2
  173. package/dist/components/switch/index.js.map +1 -1
  174. package/dist/components/table/index.d.ts +1 -2
  175. package/dist/components/table/index.js +251 -123
  176. package/dist/components/table/index.js.map +1 -1
  177. package/dist/components/tabs/index.d.ts +1 -2
  178. package/dist/components/tabs/index.js.map +1 -1
  179. package/dist/components/tag/index.d.ts +1 -2
  180. package/dist/components/tag/index.js.map +1 -1
  181. package/dist/components/text/index.d.ts +1 -2
  182. package/dist/components/text/index.js.map +1 -1
  183. package/dist/components/text-area/index.d.ts +1 -2
  184. package/dist/components/text-area/index.js.map +1 -1
  185. package/dist/components/text-field/index.d.ts +1 -2
  186. package/dist/components/text-field/index.js.map +1 -1
  187. package/dist/components/time-field/index.d.ts +1 -2
  188. package/dist/components/time-field/index.js.map +1 -1
  189. package/dist/components/time-picker/index.d.ts +1 -2
  190. package/dist/components/time-picker/index.js.map +1 -1
  191. package/dist/components/token-field/index.d.ts +1 -2
  192. package/dist/components/token-field/index.js.map +1 -1
  193. package/dist/components/toolbar/index.d.ts +1 -2
  194. package/dist/components/toolbar/index.js.map +1 -1
  195. package/dist/components/tooltip/index.d.ts +1 -2
  196. package/dist/components/tooltip/index.js.map +1 -1
  197. package/dist/components/tree/index.d.ts +1 -2
  198. package/dist/components/tree/index.js.map +1 -1
  199. package/dist/control/index.js.map +1 -1
  200. package/dist/control/styles.js.map +1 -1
  201. package/dist/drag/hooks.d.ts +1 -2
  202. package/dist/drag/hooks.js.map +1 -1
  203. package/dist/drag/index.js.map +1 -1
  204. package/dist/drag/styles.js.map +1 -1
  205. package/dist/fab/styles.js.map +1 -1
  206. package/dist/field/index.d.ts +3 -4
  207. package/dist/field/index.js.map +1 -1
  208. package/dist/field/press.js.map +1 -1
  209. package/dist/field/root.js.map +1 -1
  210. package/dist/field/styles.js.map +1 -1
  211. package/dist/glyphs/index.js.map +1 -1
  212. package/dist/glyphs/styles.js.map +1 -1
  213. package/dist/hooks/useAppBarScroll.d.ts +1 -2
  214. package/dist/hooks/useAppBarScroll.js.map +1 -1
  215. package/dist/hooks/useBottomEdge.js.map +1 -1
  216. package/dist/hooks/useClippedTitle.js.map +1 -1
  217. package/dist/hooks/useImageLoadingStatus.js.map +1 -1
  218. package/dist/hooks/useRipple.js +3 -2
  219. package/dist/hooks/useRipple.js.map +1 -1
  220. package/dist/hooks/useScrollStop.js.map +1 -1
  221. package/dist/hooks/useToggleGroupDisabled.js.map +1 -1
  222. package/dist/i18n/index.js.map +1 -1
  223. package/dist/i18n/messages.js.map +1 -1
  224. package/dist/index.d.ts +2 -2
  225. package/dist/indicator/index.js.map +1 -1
  226. package/dist/indicator/styles.d.ts +1 -2
  227. package/dist/indicator/styles.js.map +1 -1
  228. package/dist/kanso-ui-core/defaults-DMH0HWCw.d.ts +1 -2
  229. package/dist/keycap/context.js.map +1 -1
  230. package/dist/layout.d.ts +1 -2
  231. package/dist/layout.js.map +1 -1
  232. package/dist/mark/index.js.map +1 -1
  233. package/dist/mark/initials.js.map +1 -1
  234. package/dist/mark/styles.js.map +1 -1
  235. package/dist/navigation/context.js.map +1 -1
  236. package/dist/navigation/index.d.ts +2 -3
  237. package/dist/navigation/index.js.map +1 -1
  238. package/dist/navigation/styles.js.map +1 -1
  239. package/dist/overlay/index.js.map +1 -1
  240. package/dist/render/aria.js.map +1 -1
  241. package/dist/render/content.js.map +1 -1
  242. package/dist/render/name.d.ts +1 -2
  243. package/dist/render/ref.js.map +1 -1
  244. package/dist/render/useRender.d.ts +1 -2
  245. package/dist/render/useRender.js.map +1 -1
  246. package/dist/row/index.js.map +1 -1
  247. package/dist/row/styles.js.map +1 -1
  248. package/dist/segments/index.js +2 -1
  249. package/dist/segments/index.js.map +1 -1
  250. package/dist/segments/styles.js +5 -1
  251. package/dist/segments/styles.js.map +1 -1
  252. package/dist/styles/chequer.js.map +1 -1
  253. package/dist/styles/color.js.map +1 -1
  254. package/dist/styles/focus.js.map +1 -1
  255. package/dist/styles/icon-button.js.map +1 -1
  256. package/dist/styles/merge.js.map +1 -1
  257. package/dist/styles/overlay.d.ts +2 -3
  258. package/dist/styles/overlay.js.map +1 -1
  259. package/dist/styles/picker.js.map +1 -1
  260. package/dist/styles/ripple.js.map +1 -1
  261. package/dist/styles/scheme.js.map +1 -1
  262. package/dist/styles.css +40 -8
  263. package/dist/swatch/index.js +19 -0
  264. package/dist/swatch/index.js.map +1 -0
  265. package/dist/theme-scope.d.ts +1 -2
  266. package/dist/theme-scope.js.map +1 -1
  267. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  268. package/dist/tokens/values.js.map +1 -1
  269. package/package.json +16 -16
@@ -90,5 +90,4 @@ type ListDetailProps = {
90
90
  * ```
91
91
  */
92
92
  declare function ListDetail({ detail, list, render, showing, ...props }: ListDetailProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
93
- export { type ListDetailProps, ListDetail as default };
94
- //# sourceMappingURL=index.d.ts.map
93
+ export { type ListDetailProps, ListDetail as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","stylex","RenderComponentProps","useRender","mergeStyles","container","spacing","LIST_PANE","LIST_PANE_EXTRA_LARGE","ListDetailProps","detail","list","showing","Omit","ListDetail","t0","$","render","t1","t2","t3","t4","t5","t6","t7","props","undefined","t8","Symbol","for","0","className","1","t9","t10","t11","t12","t13","children","defaultTagName","_c"],"sources":["../../../src/components/list-detail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { container, spacing } from '../../tokens/design.tokens.stylex';\n\n// Material Design's recommended snap widths for a fixed pane. The list is the\n// fixed one here — Material Design points a fixed pane at \"lists with light\n// information density\" — and the detail pane is the flexible one that absorbs\n// whatever is left, which satisfies the spec's rule that every layout carry at\n// least one flexible pane.\nconst LIST_PANE = '360px';\nconst LIST_PANE_EXTRA_LARGE = '412px';\n\n// One of Material Design's canonical layouts, and the fixed-and-flexible shape\n// of its two-pane layouts. Unlike SupportingPane, the detail pane here stands\n// on its own: a message, a product, a file. That is what makes showing it\n// *instead of* the list a coherent thing to do when only one pane fits, and\n// why this layout has to be told which pane is showing while SupportingPane\n// does not.\n//\n// Material Design puts the second pane on screen from expanded up. Below that\n// the spec shows one pane at a time, with selecting an item swapping to the\n// detail and back returning to the list — app navigation rather than layout,\n// which is why `showing` is controlled rather than held here.\n//\n// **The breakpoints are the layout's own width, not the window's.** The root\n// is a query container, and both panes ask it through `container` rather than\n// `media`: a list-detail beside a navigation drawer, or inside a sheet, has\n// less room than the window, and laying two panes out by the window's width\n// squeezed the detail to a sliver. The thresholds are still Material Design's\n// window size classes, compared against the room the layout is given.\n//\n// That is also why the root is a flex row rather than a grid. A container\n// query reaches the container's descendants and never the container itself,\n// so the root cannot change its own tracks by its width; the panes size\n// themselves instead.\n\ntype ListDetailProps = {\n /**\n * The selected item's content. Stands on its own, and takes the flexible\n * pane.\n */\n detail?: ReactNode;\n /**\n * The items to choose between. Takes the fixed pane — 360px wide, 412px at\n * extra-large.\n */\n list?: ReactNode;\n /**\n * Which pane to show while only one fits, while the layout is narrower than\n * the expanded breakpoint. Both are shown once it is that wide, where this\n * is ignored. The width is the layout's own rather than the window's.\n *\n * Controlled, with no uncontrolled fallback: the layout cannot know that an\n * item was selected or that the reader went back, so holding that state\n * here would only ever be wrong.\n *\n * **Moving focus into the revealed pane comes with flipping this.** The\n * pane being left is hidden outright, so a keyboard or screen reader inside\n * it lands on the body and the next Tab starts from the top of the page.\n * The same reason this prop is controlled is why the move is not made here:\n * only the call site knows whether a key, a pointer or the history put it\n * in that state, and what inside the pane to send focus to. Both panes hold\n * nodes it supplied, so it has something to aim at — a heading given\n * `tabIndex={-1}`, or a ref it already holds.\n * @default 'list'\n */\n showing?: 'detail' | 'list';\n} & Omit<RenderComponentProps<'div'>, 'children'>;\n\n/**\n * Material Design's list-detail layout: a fixed list pane beside a flexible\n * detail pane, collapsing to one pane at a time below the expanded breakpoint.\n *\n * The breakpoints are compared against the layout's own width, not the\n * window's, so a list-detail beside a navigation drawer or inside a sheet\n * shows one pane until it has the room for two. It takes that width from\n * its parent and none from its panes, so in a parent that shrinks to fit\n * what it holds — an inline-flex row, a float, a flex item with no basis —\n * give it a width of its own.\n *\n * Layout only — neither pane paints a surface of its own, so what goes inside\n * them is composed at the call site. `render` swaps the container's element,\n * for a layout that should be a `<main>` rather than a `<div>`.\n *\n * The panes are written to the DOM in the order they are shown, which is what\n * Material Design asks of co-planar panes: focus order has to match the\n * arrangement on screen.\n *\n * While only one pane fits, the pane that is not showing is hidden\n * outright, so focus inside it is dropped when `showing` changes. The call\n * site that changed it is what puts focus in the pane it revealed — see the\n * prop. `flushSync` commits the swap before focus moves, since a pane that is\n * still hidden cannot take it:\n *\n * ```tsx\n * const [showing, setShowing] = useState<'detail' | 'list'>('list')\n * const heading = useRef<HTMLHeadingElement>(null)\n * const opener = useRef<HTMLElement>(null)\n *\n * function open(event: MouseEvent<HTMLElement>) {\n * opener.current = event.currentTarget\n * flushSync(() => setShowing('detail'))\n * heading.current?.focus()\n * }\n *\n * function back() {\n * flushSync(() => setShowing('list'))\n * opener.current?.focus()\n * }\n *\n * <ListDetail\n * detail={\n * <>\n * <Button onPress={back} variant=\"text\">Back</Button>\n * <h2 ref={heading} tabIndex={-1}>Headline</h2>\n * </>\n * }\n * list={\n * <ListItem interactive onClick={open}>\n * First item\n * </ListItem>\n * }\n * showing={showing}\n * />\n * ```\n */\nfunction ListDetail({\n detail,\n list,\n render,\n showing = 'list',\n ...props\n}: ListDetailProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n children: <>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'detail') << 0]}>\n {list}\n </div>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'list') << 0]}>\n {detail}\n </div>\n </>,\n ...mergeStyles({\n className: \"x9f619 x12h1iku x78zum5 xj2l1yv\"\n }, props)\n },\n render\n });\n}\nexport type { ListDetailProps };\nexport default ListDetail;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,SAAAgB,WAAAC,IAAA;CAAA,MAAAC,IAAAjB,EAAA,EAAA;CAAA,IAAAkB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAoB,MAAA,EAAAL,QAAAC,MAAAM,QAAAM,IAAAX,SAAAY,IAAA,GAAAC,UAAAV;EAAAE,SAAAM;EAIlB,MAAAX,UAAAY,OAAAE,KAAAA,IAAA,SAAAF;EAGOrB,KAAAA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,KAAK;EAACT,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAL,SAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EA1BJG,KAAA;GAAA,GACFE;GAAKa,UACEnB;GAqBL,GACFC;EAGL;EAACJ,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,QAAAC,UAAAD,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EA7BcC,KAAA;GAAAe,gBACClB;GAAKI,OACdF;GA2BNN;EAEH;EAACD,EAAA,MAAAC;EAAAD,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OA/BMb,GAAUqB,EA+BhB;AAAC"}
1
+ {"version":3,"file":"index.js","names":["_c","useRender","mergeStyles","detail","list","showing","ListDetail","t0","$","render","t1","t2","t3","t4","t5","t6","t7","props","undefined","t8","Symbol","for","0","className","1","t9","t10","t11","t12","t13","children","defaultTagName"],"sources":["../../../src/components/list-detail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { container, spacing } from '../../tokens/design.tokens.stylex';\n\n// Material Design's recommended snap widths for a fixed pane. The list is the\n// fixed one here — Material Design points a fixed pane at \"lists with light\n// information density\" — and the detail pane is the flexible one that absorbs\n// whatever is left, which satisfies the spec's rule that every layout carry at\n// least one flexible pane.\nconst LIST_PANE = '360px';\nconst LIST_PANE_EXTRA_LARGE = '412px';\n\n// One of Material Design's canonical layouts, and the fixed-and-flexible shape\n// of its two-pane layouts. Unlike SupportingPane, the detail pane here stands\n// on its own: a message, a product, a file. That is what makes showing it\n// *instead of* the list a coherent thing to do when only one pane fits, and\n// why this layout has to be told which pane is showing while SupportingPane\n// does not.\n//\n// Material Design puts the second pane on screen from expanded up. Below that\n// the spec shows one pane at a time, with selecting an item swapping to the\n// detail and back returning to the list — app navigation rather than layout,\n// which is why `showing` is controlled rather than held here.\n//\n// **The breakpoints are the layout's own width, not the window's.** The root\n// is a query container, and both panes ask it through `container` rather than\n// `media`: a list-detail beside a navigation drawer, or inside a sheet, has\n// less room than the window, and laying two panes out by the window's width\n// squeezed the detail to a sliver. The thresholds are still Material Design's\n// window size classes, compared against the room the layout is given.\n//\n// That is also why the root is a flex row rather than a grid. A container\n// query reaches the container's descendants and never the container itself,\n// so the root cannot change its own tracks by its width; the panes size\n// themselves instead.\n\ntype ListDetailProps = {\n /**\n * The selected item's content. Stands on its own, and takes the flexible\n * pane.\n */\n detail?: ReactNode;\n /**\n * The items to choose between. Takes the fixed pane — 360px wide, 412px at\n * extra-large.\n */\n list?: ReactNode;\n /**\n * Which pane to show while only one fits, while the layout is narrower than\n * the expanded breakpoint. Both are shown once it is that wide, where this\n * is ignored. The width is the layout's own rather than the window's.\n *\n * Controlled, with no uncontrolled fallback: the layout cannot know that an\n * item was selected or that the reader went back, so holding that state\n * here would only ever be wrong.\n *\n * **Moving focus into the revealed pane comes with flipping this.** The\n * pane being left is hidden outright, so a keyboard or screen reader inside\n * it lands on the body and the next Tab starts from the top of the page.\n * The same reason this prop is controlled is why the move is not made here:\n * only the call site knows whether a key, a pointer or the history put it\n * in that state, and what inside the pane to send focus to. Both panes hold\n * nodes it supplied, so it has something to aim at — a heading given\n * `tabIndex={-1}`, or a ref it already holds.\n * @default 'list'\n */\n showing?: 'detail' | 'list';\n} & Omit<RenderComponentProps<'div'>, 'children'>;\n\n/**\n * Material Design's list-detail layout: a fixed list pane beside a flexible\n * detail pane, collapsing to one pane at a time below the expanded breakpoint.\n *\n * The breakpoints are compared against the layout's own width, not the\n * window's, so a list-detail beside a navigation drawer or inside a sheet\n * shows one pane until it has the room for two. It takes that width from\n * its parent and none from its panes, so in a parent that shrinks to fit\n * what it holds — an inline-flex row, a float, a flex item with no basis —\n * give it a width of its own.\n *\n * Layout only — neither pane paints a surface of its own, so what goes inside\n * them is composed at the call site. `render` swaps the container's element,\n * for a layout that should be a `<main>` rather than a `<div>`.\n *\n * The panes are written to the DOM in the order they are shown, which is what\n * Material Design asks of co-planar panes: focus order has to match the\n * arrangement on screen.\n *\n * While only one pane fits, the pane that is not showing is hidden\n * outright, so focus inside it is dropped when `showing` changes. The call\n * site that changed it is what puts focus in the pane it revealed — see the\n * prop. `flushSync` commits the swap before focus moves, since a pane that is\n * still hidden cannot take it:\n *\n * ```tsx\n * const [showing, setShowing] = useState<'detail' | 'list'>('list')\n * const heading = useRef<HTMLHeadingElement>(null)\n * const opener = useRef<HTMLElement>(null)\n *\n * function open(event: MouseEvent<HTMLElement>) {\n * opener.current = event.currentTarget\n * flushSync(() => setShowing('detail'))\n * heading.current?.focus()\n * }\n *\n * function back() {\n * flushSync(() => setShowing('list'))\n * opener.current?.focus()\n * }\n *\n * <ListDetail\n * detail={\n * <>\n * <Button onPress={back} variant=\"text\">Back</Button>\n * <h2 ref={heading} tabIndex={-1}>Headline</h2>\n * </>\n * }\n * list={\n * <ListItem interactive onClick={open}>\n * First item\n * </ListItem>\n * }\n * showing={showing}\n * />\n * ```\n */\nfunction ListDetail({\n detail,\n list,\n render,\n showing = 'list',\n ...props\n}: ListDetailProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n children: <>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'detail') << 0]}>\n {list}\n </div>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'list') << 0]}>\n {detail}\n </div>\n </>,\n ...mergeStyles({\n className: \"x9f619 x12h1iku x78zum5 xj2l1yv\"\n }, props)\n },\n render\n });\n}\nexport type { ListDetailProps };\nexport default ListDetail;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,SAAAM,WAAAC,IAAA;CAAA,MAAAC,IAAAR,EAAA,EAAA;CAAA,IAAAS;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAoB,MAAA,EAAAJ,QAAAC,MAAAK,QAAAM,IAAAV,SAAAW,IAAA,GAAAC,UAAAV;EAAAE,SAAAM;EAIlB,MAAAV,UAAAW,OAAAE,KAAAA,IAAA,SAAAF;EAGOf,KAAAA;EACWY,KAAA;EAEXI,KAAAA;EAAK,IAAAE;EAAA,IAAAX,EAAA,OAAAY,OAAAC,IAAA,2BAAA,GAAA;GAEKF,KAAA;IAAAG,GACN,EAAAC,WACU,6EACb;IAACC,GACE,EAAAD,WACU,8FACb;GACF;GAACf,EAAA,KAAAW;EAAA,OAAAA,KAAAX,EAAA;EAPU,MAAAiB,KAAAN,GAOT,CAAC,EAAEd,YAAY,aAAa;EAAE,IAAAqB;EAAA,IAAA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AA,IAAAO;CAAA,IAAAP,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EA1BJG,KAAA;GAAA,GACFE;GAAKa,UACEnB;GAqBL,GACFC;EAGL;EAACJ,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,QAAAC,UAAAD,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EA7BcC,KAAA;GAAAe,gBACClB;GAAKI,OACdF;GA2BNN;EAEH;EAACD,EAAA,MAAAC;EAAAD,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OA/BMP,GAAUe,EA+BhB;AAAC"}
@@ -78,5 +78,4 @@ type ListItemProps = {
78
78
  * ```
79
79
  */
80
80
  declare function ListItem({ children, interactive, isDisabled, leading, onClick, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, overline, ref, supporting, trailing, ...props }: ListItemProps & RefAttributes<HTMLButtonElement | HTMLDivElement>): import("react").JSX.Element;
81
- export { type ListItemProps, ListItem as default };
82
- //# sourceMappingURL=index.d.ts.map
81
+ export { type ListItemProps, ListItem as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","stylex","useRipple","hasContent","refCallback","RowContent","rowStyles","mergeStyles","ListItemProps","children","interactive","isDisabled","leading","overline","supporting","trailing","HTMLElement","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","ListItem","t0","$","t1","t2","ref","props","undefined","t3","ripple","extraLines","twoLine","threeLine","t4","forwarded","t5","content","handlers","base","list","disabled","t6","t7","t8","interactiveLayers","t9","surface","_c","props","stylex.props"],"sources":["../../../src/components/list-item/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useRipple } from '../../hooks/useRipple';\nimport { hasContent } from '../../render/content';\nimport { refCallback } from '../../render/ref';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStyles } from '../../styles/merge';\ntype ListItemProps = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Renders a `<button>` that ripples and tints on hover, for a row that is\n * itself pressable. Leave it off for a row that only presents.\n *\n * Only an interactive row takes `onClick`, `onContextMenu` and the pointer\n * handlers. A row that only presents is a `<div>` that cannot be focused or\n * operated from the keyboard, so a handler on it would answer a mouse and\n * nothing else.\n *\n * An interactive row's slots hold content and never a control. The row is\n * one button, and a checkbox, a switch, a link or a button inside it is\n * invalid HTML: axe reports it as nested interactive content, and React\n * warns as well when the control is itself a button. A row that carries a\n * control is a presenting row, or a `List.Item`, whose rows are built to\n * hold them.\n * @default false\n */\n interactive?: boolean;\n /**\n * Draws the row disabled, in the treatment every row in the library shares:\n * its text fades to on-surface at the disabled content opacity, overline\n * and supporting line included. An interactive row's button is disabled\n * outright: it takes no focus, no hover tint, no press and no ripple. A row\n * that only presents has nothing to disable, and is marked `aria-disabled`\n * instead so the state it draws is announced as well.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Content before the headline: an avatar, an icon, or on a row that is not\n * `interactive`, a checkbox.\n */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /**\n * Content after the headline, such as an amount, or on a row that is not\n * `interactive`, a control.\n */\n trailing?: ReactNode;\n} & HTMLAttributes<HTMLElement> &\n// The handlers a press delivers, which a row that only presents refuses:\n// with no role, no `tabIndex` and no key handler, it would run them for a\n// pointer alone. `never` rather than leaving them out, since an omitted key\n// is still accepted from the `HTMLAttributes` beside it.\n({\n interactive: true;\n} | {\n interactive?: false;\n onClick?: never;\n onContextMenu?: never;\n onPointerCancel?: never;\n onPointerDown?: never;\n onPointerLeave?: never;\n onPointerUp?: never;\n});\n\n/**\n * A static row: the row every list draws, on its own, as the lists spec page\n * gives it — a 56px one-line container, a body-large headline and a\n * body-medium supporting line. A second line takes it to the page's 72px\n * two-line container; an `overline` puts that second line above the headline\n * instead of below it, and an overline with a supporting line makes the\n * page's three-line item, an 88px container with the leading and trailing\n * slots held at the top rather than centred. The layout and the states are\n * the row module's in `src/row`, shared with every collection item; what is\n * here is the element around them — a `<div>` that presents, or a `<button>`\n * that ripples — and the props that fill the slots.\n *\n * ```tsx\n * <ListItem leading={<Avatar name=\"Ada Lovelace\" />} supporting=\"Supporting line\">\n * Headline\n * </ListItem>\n * ```\n */\nfunction ListItem({\n children,\n interactive = false,\n isDisabled = false,\n leading,\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n ref,\n supporting,\n trailing,\n ...props\n}: ListItemProps & RefAttributes<HTMLButtonElement | HTMLDivElement>) {\n // The consumer's own pointer handlers are handed to useRipple to merge\n // rather than left in `props` to be spread over its handlers afterwards,\n // which is what Card and Button do and for the same reason: a plain spread\n // means whichever object comes last silently wins, so an onClick on the\n // call site would replace the one that ends the press and the row would\n // stay visibly pressed. The hook runs its own handler first and the\n // consumer's second, and hands them straight back when the ripple is off,\n // which is what puts them on the presenting <div> below. The host is\n // `HTMLElement` rather than the button: the same handlers now reach both\n // elements, and only the type `ListItemProps` already declares is assignable\n // to a <div>'s props as well as a <button>'s.\n //\n // Off on a disabled row as well as on one that only presents. A press on a\n // disabled button still delivers its pointerdown and pointerup, and\n // withholds only the click, which is what ends a press — so a ripple left\n // on would start and then stay drawn.\n const ripple = useRipple<HTMLElement>(interactive && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n\n // Which of the page's three items this row is, read from the content rather\n // than taken as a prop: a row holding all three lines already says it is\n // three lines, and a word for it would be a second place to get it wrong.\n // A line that wraps grows the row past its container height on its own and\n // keeps its slots centred, which is the shorter item made taller rather\n // than the next one along.\n //\n // The three-line item is the only row whose slots move, which is why it\n // alone carries an alignment as well as a height.\n const extraLines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);\n const twoLine = extraLines === 1;\n const threeLine = extraLines === 2;\n\n // A presenting row is a <div> and an interactive one a <button>, so the\n // ref is typed as either and handed to each as the callback both accept —\n // see src/render/ref.ts.\n const forwarded = refCallback(ref);\n const content = <RowContent isDisabled={isDisabled} leading={leading} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>;\n\n // `disabled` goes last in both lists. On the button that is what lets it\n // win over the interactive style, as it does on every collection item:\n // StyleX replaces a property whole, which takes the hover, focus and\n // pressed layers and the pointer cursor with it.\n if (!interactive) {\n return <div aria-disabled={isDisabled || undefined} ref={forwarded} {...props} {...ripple.handlers} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n </div>;\n }\n return <button disabled={isDisabled} ref={forwarded} type=\"button\" {...ripple.handlers} {...props} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, rowStyles.interactiveLayers, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n {ripple.surface}\n </button>;\n}\nexport type { ListItemProps };\nexport default ListItem;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAA2B,SAAAC,IAAA;CAAA,MAAAC,IAAA5B,EAAA,EAAA;CAAkB,MAAA,EAAAY,UAAAC,aAAAgB,IAAAf,YAAAgB,IAAAf,SAAAK,SAAAC,eAAAC,iBAAAC,eAAAC,gBAAAC,aAAAT,UAAAe,KAAAd,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":"index.js","names":["_c","stylex","useRipple","hasContent","refCallback","rowStyles","mergeStyles","children","interactive","isDisabled","leading","overline","supporting","trailing","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","ListItem","t0","$","t1","t2","ref","props","undefined","t3","ripple","extraLines","twoLine","threeLine","t4","forwarded","t5","content","handlers","base","list","disabled","t6","t7","t8","interactiveLayers","t9","surface"],"sources":["../../../src/components/list-item/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useRipple } from '../../hooks/useRipple';\nimport { hasContent } from '../../render/content';\nimport { refCallback } from '../../render/ref';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStyles } from '../../styles/merge';\ntype ListItemProps = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Renders a `<button>` that ripples and tints on hover, for a row that is\n * itself pressable. Leave it off for a row that only presents.\n *\n * Only an interactive row takes `onClick`, `onContextMenu` and the pointer\n * handlers. A row that only presents is a `<div>` that cannot be focused or\n * operated from the keyboard, so a handler on it would answer a mouse and\n * nothing else.\n *\n * An interactive row's slots hold content and never a control. The row is\n * one button, and a checkbox, a switch, a link or a button inside it is\n * invalid HTML: axe reports it as nested interactive content, and React\n * warns as well when the control is itself a button. A row that carries a\n * control is a presenting row, or a `List.Item`, whose rows are built to\n * hold them.\n * @default false\n */\n interactive?: boolean;\n /**\n * Draws the row disabled, in the treatment every row in the library shares:\n * its text fades to on-surface at the disabled content opacity, overline\n * and supporting line included. An interactive row's button is disabled\n * outright: it takes no focus, no hover tint, no press and no ripple. A row\n * that only presents has nothing to disable, and is marked `aria-disabled`\n * instead so the state it draws is announced as well.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Content before the headline: an avatar, an icon, or on a row that is not\n * `interactive`, a checkbox.\n */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /**\n * Content after the headline, such as an amount, or on a row that is not\n * `interactive`, a control.\n */\n trailing?: ReactNode;\n} & HTMLAttributes<HTMLElement> &\n// The handlers a press delivers, which a row that only presents refuses:\n// with no role, no `tabIndex` and no key handler, it would run them for a\n// pointer alone. `never` rather than leaving them out, since an omitted key\n// is still accepted from the `HTMLAttributes` beside it.\n({\n interactive: true;\n} | {\n interactive?: false;\n onClick?: never;\n onContextMenu?: never;\n onPointerCancel?: never;\n onPointerDown?: never;\n onPointerLeave?: never;\n onPointerUp?: never;\n});\n\n/**\n * A static row: the row every list draws, on its own, as the lists spec page\n * gives it — a 56px one-line container, a body-large headline and a\n * body-medium supporting line. A second line takes it to the page's 72px\n * two-line container; an `overline` puts that second line above the headline\n * instead of below it, and an overline with a supporting line makes the\n * page's three-line item, an 88px container with the leading and trailing\n * slots held at the top rather than centred. The layout and the states are\n * the row module's in `src/row`, shared with every collection item; what is\n * here is the element around them — a `<div>` that presents, or a `<button>`\n * that ripples — and the props that fill the slots.\n *\n * ```tsx\n * <ListItem leading={<Avatar name=\"Ada Lovelace\" />} supporting=\"Supporting line\">\n * Headline\n * </ListItem>\n * ```\n */\nfunction ListItem({\n children,\n interactive = false,\n isDisabled = false,\n leading,\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n ref,\n supporting,\n trailing,\n ...props\n}: ListItemProps & RefAttributes<HTMLButtonElement | HTMLDivElement>) {\n // The consumer's own pointer handlers are handed to useRipple to merge\n // rather than left in `props` to be spread over its handlers afterwards,\n // which is what Card and Button do and for the same reason: a plain spread\n // means whichever object comes last silently wins, so an onClick on the\n // call site would replace the one that ends the press and the row would\n // stay visibly pressed. The hook runs its own handler first and the\n // consumer's second, and hands them straight back when the ripple is off,\n // which is what puts them on the presenting <div> below. The host is\n // `HTMLElement` rather than the button: the same handlers now reach both\n // elements, and only the type `ListItemProps` already declares is assignable\n // to a <div>'s props as well as a <button>'s.\n //\n // Off on a disabled row as well as on one that only presents. A press on a\n // disabled button still delivers its pointerdown and pointerup, and\n // withholds only the click, which is what ends a press — so a ripple left\n // on would start and then stay drawn.\n const ripple = useRipple<HTMLElement>(interactive && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n\n // Which of the page's three items this row is, read from the content rather\n // than taken as a prop: a row holding all three lines already says it is\n // three lines, and a word for it would be a second place to get it wrong.\n // A line that wraps grows the row past its container height on its own and\n // keeps its slots centred, which is the shorter item made taller rather\n // than the next one along.\n //\n // The three-line item is the only row whose slots move, which is why it\n // alone carries an alignment as well as a height.\n const extraLines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);\n const twoLine = extraLines === 1;\n const threeLine = extraLines === 2;\n\n // A presenting row is a <div> and an interactive one a <button>, so the\n // ref is typed as either and handed to each as the callback both accept —\n // see src/render/ref.ts.\n const forwarded = refCallback(ref);\n const content = <RowContent isDisabled={isDisabled} leading={leading} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>;\n\n // `disabled` goes last in both lists. On the button that is what lets it\n // win over the interactive style, as it does on every collection item:\n // StyleX replaces a property whole, which takes the hover, focus and\n // pressed layers and the pointer cursor with it.\n if (!interactive) {\n return <div aria-disabled={isDisabled || undefined} ref={forwarded} {...props} {...ripple.handlers} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n </div>;\n }\n return <button disabled={isDisabled} ref={forwarded} type=\"button\" {...ripple.handlers} {...props} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, rowStyles.interactiveLayers, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowSt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AhG,UAAA,CACFP,SACAP,OAAMiB,OACA;;EAAAxB,EAAA,MAAAc;EAAAd,EAAA,MAAAY;EAAAZ,EAAA,MAAAb;EAAAa,EAAA,MAAAI;EAAAJ,EAAA,MAAAO,OAAAQ;EAAAf,EAAA,MAAAO,OAAAiB;EAAAxB,EAAA,MAAAqB;EAAArB,EAAA,MAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAAA,OAHJuB;AAGI"}
@@ -24,5 +24,4 @@ type LoadingIndicatorProps = {
24
24
  * the element a layout positions.
25
25
  */
26
26
  declare function LoadingIndicator({ contained, ...props }: LoadingIndicatorProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
27
- export { type LoadingIndicatorProps, LoadingIndicator as default };
28
- //# sourceMappingURL=index.d.ts.map
27
+ export { type LoadingIndicatorProps, LoadingIndicator as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","RefAttributes","ProgressBarProps","RACProgressBarProps","stylex","ProgressBar","mergeStatefulStyles","colors","radii","SHAPES","cookie4Sided","cookie9Sided","oval","pentagon","pill","softBurst","sunny","const","MORPH_MS","MORPH_CYCLE_MS","TURN_CYCLE_MS","SPIN_MS","SLOWDOWN","SPRING","FORCED_COLORS","REDUCED_MOTION","morph","turn","spin","LoadingIndicatorProps","className","contained","style","Omit","LoadingIndicator","t0","$","T0","t1","t2","t3","t4","props","undefined","0","1","Symbol","for","t5","_c"],"sources":["../../../src/components/loading-indicator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { ProgressBarProps as RACProgressBarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ProgressBar } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii } from '../../tokens/design.tokens.stylex';\n\n// The loading indicator page's indicator, at\n// https://m3.material.io/components/loading-indicator/specs: a shape that\n// morphs through a sequence of seven while it turns, for a wait short\n// enough that how long it takes is not worth showing. It is indeterminate:\n// it says that something is happening, and React Aria's `ProgressBar` gives\n// it the role a screen reader announces that by.\n//\n// The page's tokens are a 48dp container with a full corner and a 38dp\n// active indicator inside it. Uncontained, the container is transparent and\n// the shape is primary; contained, the container is primary container and\n// the shape on primary container, for an indicator drawn over content rather\n// than beside it.\n//\n// The seven shapes are the page's, in its order: soft burst, nine-sided\n// cookie, pentagon, pill, sunny, four-sided cookie and oval. Each is the\n// polygon Material's own shape library builds for it, rounded the way that\n// library rounds a corner and normalised to the same box, then traced as 90\n// points at 4° steps around its centre — one list of points per shape, all\n// the same length, which is what lets `clip-path` interpolate from each to\n// the next. They share one scale, the largest at which the widest of them\n// still fits the 38dp indicator at every angle it turns through.\n//\n// The timing is Material's too. Each morph takes the 650ms interval it\n// starts, on a spring of damping ratio 0.6 and stiffness 200, which\n// overshoots by about a tenth and settles inside the interval; `SPRING` is\n// that curve sampled for `linear()`. Every morph turns the shape a further\n// quarter on the same spring, and the whole indicator turns once every\n// 4666ms underneath, at a constant rate. The quarter turns run on a cycle of\n// their own, four of them to a full turn, beside the morph's cycle of seven,\n// so each animation loops back to where it started.\n//\n// Under `prefers-reduced-motion` it slows rather than stopping, as the\n// progress indicator's ring does and for its reason: an indicator that\n// freezes stops saying the work is going on. The multiplier is the ring's.\n//\n// Under forced colours the shape is `CanvasText`, with the mode's own\n// adjustment turned off for it, since the mode would otherwise paint its\n// fill as the page's background and draw nothing at all.\n\n// The shapes as `clip-path` polygons over the 48dp container, generated from\n// the definitions in Material's shape library rather than drawn by hand. Each\n// starts at three o'clock and runs clockwise, so the nth point of one shape\n// becomes the nth point of the next.\nconst SHAPES = {\n cookie4Sided: 'polygon(79% 50%, 79.1% 52%, 79.6% 54.2%, 80.4% 56.5%, 81.5% 59%, 82.5% 61.8%, 82.9% 64.7%, 82.9% 67.5%, 82.4% 70.3%, 81.5% 72.9%, 80.2% 75.3%, 78.5% 77.5%, 76.4% 79.4%, 74.1% 80.9%, 71.6% 82%, 68.9% 82.7%, 66.1% 83%, 63.2% 82.8%, 60.4% 82.1%, 57.7% 80.9%, 55.3% 79.9%, 53.1% 79.3%, 51% 79%, 49% 79%, 46.9% 79.3%, 44.7% 79.9%, 42.3% 81%, 39.6% 82.1%, 36.8% 82.8%, 33.9% 83%, 31.1% 82.7%, 28.4% 82%, 25.9% 80.9%, 23.6% 79.4%, 21.5% 77.5%, 19.8% 75.3%, 18.5% 72.9%, 17.6% 70.3%, 17.1% 67.5%, 17.1% 64.7%, 17.5% 61.8%, 18.5% 59%, 19.6% 56.5%, 20.4% 54.2%, 20.9% 52%, 21% 50%, 20.9% 48%, 20.4% 45.8%, 19.6% 43.5%, 18.5% 41%, 17.5% 38.2%, 17.1% 35.3%, 17.1% 32.5%, 17.6% 29.7%, 18.5% 27.1%, 19.8% 24.7%, 21.5% 22.5%, 23.6% 20.6%, 25.9% 19.1%, 28.4% 18%, 31.1% 17.3%, 33.9% 17%, 36.8% 17.2%, 39.6% 17.9%, 42.3% 19.1%, 44.7% 20.1%, 46.9% 20.7%, 49% 21%, 51% 21%, 53.1% 20.7%, 55.3% 20.1%, 57.7% 19%, 60.4% 17.9%, 63.2% 17.2%, 66.1% 17%, 68.9% 17.3%, 71.6% 18%, 74.1% 19.1%, 76.4% 20.6%, 78.5% 22.5%, 80.2% 24.7%, 81.5% 27.1%, 82.4% 29.7%, 82.9% 32.5%, 82.9% 35.3%, 82.5% 38.2%, 81.5% 41%, 80.4% 43.5%, 79.6% 45.8%, 79.1% 48%)',\n cookie9Sided: 'polygon(82.5% 50%, 81.4% 52.2%, 80.4% 54.3%, 79.9% 56.4%, 79.8% 58.6%, 80.2% 61%, 80.2% 63.4%, 79.6% 65.8%, 78.6% 67.9%, 77.1% 69.7%, 75.2% 71.1%, 72.9% 72.1%, 70.8% 73.1%, 69.1% 74.4%, 67.6% 76.1%, 66.3% 78.3%, 64.7% 80.1%, 62.7% 81.4%, 60.5% 82.3%, 58.1% 82.6%, 55.7% 82.4%, 53.3% 81.7%, 51.1% 81.2%, 48.9% 81.2%, 46.7% 81.7%, 44.3% 82.4%, 41.9% 82.6%, 39.5% 82.3%, 37.3% 81.4%, 35.3% 80.1%, 33.7% 78.3%, 32.4% 76.1%, 30.9% 74.4%, 29.2% 73.1%, 27.1% 72.1%, 24.8% 71.1%, 22.9% 69.7%, 21.4% 67.9%, 20.4% 65.8%, 19.8% 63.4%, 19.8% 61%, 20.2% 58.6%, 20.1% 56.4%, 19.6% 54.3%, 18.6% 52.2%, 17.5% 50%, 17.1% 47.7%, 17.1% 45.4%, 17.7% 43.1%, 18.7% 41%, 20.3% 39.2%, 22.1% 37.6%, 23.4% 35.9%, 24.4% 34%, 24.9% 31.8%, 25.5% 29.5%, 26.6% 27.4%, 28.1% 25.6%, 29.9% 24.2%, 32% 23.3%, 34.3% 22.8%, 36.7% 22.7%, 38.8% 22.4%, 40.8% 21.6%, 42.6% 20.4%, 44.5% 18.9%, 46.6% 17.9%, 48.9% 17.4%, 51.1% 17.4%, 53.4% 17.9%, 55.5% 18.9%, 57.4% 20.4%, 59.2% 21.6%, 61.2% 22.4%, 63.3% 22.7%, 65.7% 22.8%, 68% 23.3%, 70.1% 24.2%, 71.9% 25.6%, 73.4% 27.4%, 74.5% 29.5%, 75.1% 31.8%, 75.6% 34%, 76.6% 35.9%, 77.9% 37.6%, 79.7% 39.2%, 81.3% 41%, 82.3% 43.1%, 82.9% 45.4%, 82.9% 47.7%)',\n oval: 'polygon(80% 50%, 79% 52%, 78.1% 53.9%, 77.1% 55.8%, 76% 57.5%, 75% 59.1%, 73.9% 60.6%, 72.8% 62.1%, 71.7% 63.5%, 70.5% 64.9%, 69.3% 66.2%, 68.1% 67.5%, 66.8% 68.7%, 65.6% 69.9%, 64.2% 71.1%, 62.8% 72.2%, 61.4% 73.3%, 59.9% 74.4%, 58.3% 75.5%, 56.6% 76.6%, 54.9% 77.6%, 53% 78.6%, 51% 79.5%, 48.9% 80.4%, 46.7% 81.2%, 44.4% 81.9%, 41.9% 82.4%, 39.3% 82.8%, 36.7% 83%, 34% 82.9%, 31.2% 82.5%, 28.6% 81.8%, 26.1% 80.6%, 23.8% 79.1%, 21.7% 77.3%, 20.1% 75.1%, 18.8% 72.7%, 17.8% 70.1%, 17.3% 67.4%, 17% 64.7%, 17.1% 62%, 17.4% 59.4%, 17.8% 56.8%, 18.5% 54.4%, 19.2% 52.2%, 20% 50%, 21% 48%, 21.9% 46.1%, 22.9% 44.2%, 24% 42.5%, 25% 40.9%, 26.1% 39.4%, 27.2% 37.9%, 28.3% 36.5%, 29.5% 35.1%, 30.7% 33.8%, 31.9% 32.5%, 33.2% 31.3%, 34.4% 30.1%, 35.8% 28.9%, 37.2% 27.8%, 38.6% 26.7%, 40.1% 25.6%, 41.7% 24.5%, 43.4% 23.4%, 45.1% 22.4%, 47% 21.4%, 49% 20.5%, 51.1% 19.6%, 53.3% 18.8%, 55.6% 18.1%, 58.1% 17.6%, 60.7% 17.2%, 63.3% 17%, 66% 17.1%, 68.8% 17.5%, 71.4% 18.2%, 73.9% 19.4%, 76.2% 20.9%, 78.3% 22.7%, 79.9% 24.9%, 81.2% 27.3%, 82.2% 29.9%, 82.7% 32.6%, 83% 35.3%, 82.9% 38%, 82.6% 40.6%, 82.2% 43.2%, 81.5% 45.6%, 80.8% 47.8%)',\n pentagon: 'polygon(82% 50%, 81.3% 52.2%, 80.6% 54.3%, 79.9% 56.4%, 79.2% 58.4%, 78.5% 60.4%, 77.9% 62.4%, 77.2% 64.5%, 76.5% 66.5%, 75.8% 68.7%, 75% 71%, 74.2% 73.4%, 73.1% 75.7%, 71.6% 77.7%, 69.7% 79.2%, 67.5% 80.3%, 65.1% 80.9%, 62.5% 81%, 60.1% 81%, 57.7% 81%, 55.5% 81%, 53.3% 81%, 51.1% 81%, 48.9% 81%, 46.7% 81%, 44.5% 81%, 42.3% 81%, 39.9% 81%, 37.5% 81%, 34.9% 80.9%, 32.5% 80.3%, 30.3% 79.2%, 28.4% 77.7%, 26.9% 75.7%, 25.8% 73.4%, 25% 71%, 24.2% 68.7%, 23.5% 66.5%, 22.8% 64.5%, 22.1% 62.4%, 21.5% 60.4%, 20.8% 58.4%, 20.1% 56.4%, 19.4% 54.3%, 18.7% 52.2%, 18% 50%, 17.3% 47.7%, 17% 45.4%, 17.3% 43%, 18% 40.8%, 19.2% 38.8%, 20.9% 37%, 22.9% 35.6%, 24.8% 34.2%, 26.6% 33%, 28.3% 31.8%, 29.9% 30.6%, 31.5% 29.5%, 33.1% 28.4%, 34.7% 27.3%, 36.2% 26.1%, 37.8% 25%, 39.4% 23.9%, 41.1% 22.7%, 42.9% 21.4%, 44.8% 20.3%, 46.8% 19.4%, 48.9% 19%, 51.1% 19%, 53.2% 19.4%, 55.2% 20.3%, 57.1% 21.4%, 58.9% 22.7%, 60.6% 23.9%, 62.2% 25%, 63.8% 26.1%, 65.3% 27.3%, 66.9% 28.4%, 68.5% 29.5%, 70.1% 30.6%, 71.7% 31.8%, 73.4% 33%, 75.2% 34.2%, 77.1% 35.6%, 79.1% 37%, 80.8% 38.8%, 82% 40.8%, 82.7% 43%, 83% 45.4%, 82.7% 47.7%)',\n pill: 'polygon(82.6% 50%, 82.1% 52.2%, 81.4% 54.4%, 80.6% 56.5%, 79.7% 58.5%, 78.6% 60.4%, 77.4% 62.2%, 76.1% 63.9%, 74.7% 65.4%, 73.2% 66.9%, 71.8% 68.3%, 70.4% 69.7%, 69% 71.1%, 67.6% 72.5%, 66.2% 73.9%, 64.7% 75.4%, 63.1% 76.8%, 61.3% 78%, 59.5% 79.2%, 57.5% 80.2%, 55.5% 81.1%, 53.3% 81.8%, 51.1% 82.4%, 48.9% 82.7%, 46.5% 83%, 44.2% 82.9%, 41.9% 82.6%, 39.5% 82.2%, 37.2% 81.7%, 34.9% 80.9%, 32.7% 79.9%, 30.6% 78.7%, 28.6% 77.4%, 26.7% 75.9%, 25% 74.2%, 23.4% 72.4%, 21.9% 70.4%, 20.7% 68.3%, 19.6% 66.2%, 18.7% 63.9%, 18% 61.6%, 17.5% 59.3%, 17.2% 57%, 17% 54.6%, 17.1% 52.3%, 17.4% 50%, 17.9% 47.8%, 18.6% 45.6%, 19.4% 43.5%, 20.3% 41.5%, 21.4% 39.6%, 22.6% 37.8%, 23.9% 36.1%, 25.3% 34.6%, 26.8% 33.1%, 28.2% 31.7%, 29.6% 30.3%, 31% 28.9%, 32.4% 27.5%, 33.8% 26.1%, 35.3% 24.6%, 36.9% 23.2%, 38.7% 22%, 40.5% 20.8%, 42.5% 19.8%, 44.5% 18.9%, 46.7% 18.2%, 48.9% 17.6%, 51.1% 17.3%, 53.5% 17%, 55.8% 17.1%, 58.1% 17.4%, 60.5% 17.8%, 62.8% 18.3%, 65.1% 19.1%, 67.3% 20.1%, 69.4% 21.3%, 71.4% 22.6%, 73.3% 24.1%, 75% 25.8%, 76.6% 27.6%, 78.1% 29.6%, 79.3% 31.7%, 80.4% 33.8%, 81.3% 36.1%, 82% 38.4%, 82.5% 40.7%, 82.8% 43%, 83% 45.4%, 82.9% 47.7%)',\n softBurst: 'polygon(76% 50%, 76.5% 51.9%, 78.3% 54%, 80.4% 56.5%, 81.5% 59%, 80.8% 61.2%, 78.3% 62.6%, 75.2% 63.4%, 72.5% 64.1%, 71% 65.3%, 70.4% 67.1%, 70.5% 69.8%, 70.8% 73.1%, 70.2% 75.9%, 68.3% 77.2%, 65.5% 76.9%, 62.5% 75.6%, 60% 74.6%, 58% 74.7%, 56.4% 75.8%, 55% 78.1%, 53.2% 80.9%, 51.1% 82.8%, 48.9% 82.8%, 46.8% 80.8%, 45% 78.1%, 43.6% 75.8%, 42% 74.7%, 40% 74.7%, 37.5% 75.7%, 34.5% 76.9%, 31.6% 77.2%, 29.8% 75.9%, 29.2% 73%, 29.5% 69.8%, 29.6% 67.1%, 29% 65.3%, 27.5% 64.1%, 24.8% 63.4%, 21.6% 62.6%, 19.2% 61.2%, 18.5% 59%, 19.7% 56.4%, 21.8% 54%, 23.5% 51.9%, 24% 50%, 23.5% 48.1%, 21.7% 46%, 19.6% 43.5%, 18.5% 41%, 19.2% 38.8%, 21.7% 37.4%, 24.8% 36.6%, 27.5% 35.9%, 29% 34.7%, 29.6% 32.9%, 29.5% 30.2%, 29.2% 26.9%, 29.8% 24.1%, 31.7% 22.8%, 34.5% 23.1%, 37.5% 24.4%, 40% 25.4%, 42% 25.3%, 43.6% 24.2%, 45% 21.9%, 46.8% 19.1%, 48.9% 17.2%, 51.1% 17.2%, 53.2% 19.2%, 55% 21.9%, 56.4% 24.2%, 58% 25.3%, 60% 25.3%, 62.5% 24.3%, 65.5% 23.1%, 68.4% 22.8%, 70.2% 24.1%, 70.8% 27%, 70.5% 30.2%, 70.4% 32.9%, 71% 34.7%, 72.5% 35.9%, 75.2% 36.6%, 78.4% 37.4%, 80.8% 38.8%, 81.5% 41%, 80.3% 43.6%, 78.2% 46%, 76.5% 48.1%)',\n sunny: 'polygon(83% 50%, 82.5% 52.3%, 80.9% 54.3%, 79.3% 56.2%, 77.8% 58%, 76.4% 59.6%, 75.6% 61.4%, 75.4% 63.5%, 75.2% 65.7%, 75% 68.2%, 74.7% 70.8%, 73.7% 72.9%, 71.9% 74.3%, 69.4% 74.9%, 66.9% 75.1%, 64.6% 75.3%, 62.4% 75.4%, 60.5% 75.9%, 58.8% 77.1%, 57.1% 78.6%, 55.3% 80.1%, 53.3% 81.8%, 51.1% 82.9%, 48.9% 82.9%, 46.7% 81.8%, 44.7% 80.1%, 42.9% 78.6%, 41.2% 77.1%, 39.5% 75.9%, 37.6% 75.4%, 35.4% 75.3%, 33.1% 75.1%, 30.6% 74.9%, 28.1% 74.3%, 26.3% 72.9%, 25.3% 70.8%, 25% 68.2%, 24.8% 65.7%, 24.6% 63.5%, 24.4% 61.4%, 23.6% 59.6%, 22.2% 58%, 20.7% 56.2%, 19.1% 54.3%, 17.5% 52.3%, 17% 50%, 17.5% 47.7%, 19.1% 45.7%, 20.7% 43.8%, 22.2% 42%, 23.6% 40.4%, 24.4% 38.6%, 24.6% 36.5%, 24.8% 34.3%, 25% 31.8%, 25.3% 29.2%, 26.3% 27.1%, 28.1% 25.7%, 30.6% 25.1%, 33.1% 24.9%, 35.4% 24.7%, 37.6% 24.6%, 39.5% 24.1%, 41.2% 22.9%, 42.9% 21.4%, 44.7% 19.9%, 46.7% 18.2%, 48.9% 17.1%, 51.1% 17.1%, 53.3% 18.2%, 55.3% 19.9%, 57.1% 21.4%, 58.8% 22.9%, 60.5% 24.1%, 62.4% 24.6%, 64.6% 24.7%, 66.9% 24.9%, 69.4% 25.1%, 71.9% 25.7%, 73.7% 27.1%, 74.7% 29.2%, 75% 31.8%, 75.2% 34.3%, 75.4% 36.5%, 75.6% 38.6%, 76.4% 40.4%, 77.8% 42%, 79.3% 43.8%, 80.9% 45.7%, 82.5% 47.7%)'\n} as const;\n\n// One morph's interval, the morph's cycle through all seven, and the quarter\n// turns' cycle of four.\nconst MORPH_MS = 650;\nconst MORPH_CYCLE_MS = MORPH_MS * 7;\nconst TURN_CYCLE_MS = MORPH_MS * 4;\nconst SPIN_MS = 4666;\n\n// What `prefers-reduced-motion` slows every animation by.\nconst SLOWDOWN = 1.25;\n\n// The spring, sampled every 25ms of the 650ms interval. It is within half a\n// percent of rest by the end, and the last sample is rest itself, so a morph\n// lands exactly on its shape before the next begins.\nconst SPRING = 'linear(0, 0.054, 0.185, 0.352, 0.527, 0.69, 0.827, 0.934, 1.011, 1.06, 1.086, 1.095, 1.091, 1.079, 1.063, 1.047, 1.031, 1.018, 1.007, 1, 0.995, 0.992, 0.991, 0.991, 0.992, 0.994, 1)';\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst REDUCED_MOTION = '@media (prefers-reduced-motion: reduce)';\nconst morph = \"x1v8p8us-B\";\nconst turn = \"x1kc2w18-B\";\nconst spin = \"x1wc8ddo-B\";\ntype LoadingIndicatorProps = {\n /** A function may compute the class from the indicator's render state. */\n className?: RACProgressBarProps['className'];\n /**\n * Draws the shape on a circular container in the primary container pair,\n * for an indicator drawn over content — a list being refreshed, an image\n * being fetched — where a bare shape would have nothing behind it to read\n * against.\n * @default false\n */\n contained?: boolean;\n /** A function may compute the style from the indicator's render state. */\n style?: RACProgressBarProps['style'];\n} & Omit<RACProgressBarProps, 'children' | 'className' | 'formatOptions' | 'isIndeterminate' | 'maxValue' | 'minValue' | 'style' | 'value' | 'valueLabel'>;\n\n/**\n * A shape morphing as it turns, for a wait of a few seconds whose length is\n * not worth showing — where it would otherwise be an indeterminate ring.\n * Name it with `aria-label`, or `aria-labelledby` where something on the\n * page already says what is loading.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction LoadingIndicator({\n contained = false,\n ...props\n}: LoadingIndicatorProps & RefAttributes<HTMLDivElement>) {\n return <ProgressBar {...props} isIndeterminate {...mergeStatefulStyles({\n 0: {\n className: \"x6s0dn4 xsdox4t x16fbrrb x9f619 x3nfvp2 x2lah0s x1useyqa xl56j7k x1mxwv8y\"\n },\n 1: {\n className: \"x6s0dn4 xsdox4t x16fbrrb x9f619 x3nfvp2 x2lah0s x1useyqa xl56j7k xp89om9 xscdzaa\"\n }\n }[!!contained << 0], props)}>\n <span aria-hidden=\"true\" className=\"xojko4r xa4qsjk x1aerksh x1esw782 x5yr21d x9f619 x1lliihq xh8yej3 x1224tbv\">\n <span className=\"x1q58mop x77zgwx x13hkq4m xlges3w xtwfq29 xwvh9j7 x5yr21d x9f619 xiiw7xq x1lliihq x1g12otp xh8yej3 x1vsa048\" />\n </span>\n </ProgressBar>;\n}\nexport type { LoadingIndicatorProps };\nexport default LoadingIndicator;"],"mappings":";;;;;;;;;;;;;;;AA0GA,SAAAmC,iBAAAC,IAAA;CAAA,MAAAC,IAAApC,EAAA,EAAA;CAAA,IAAAqC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAD,IAAA;EAA0B,MAAA,EAAAJ,WAAAU,IAAA,GAAAC,UAAAP;EACxB,MAAAJ,YAAAU,OAAAE,KAAAA,IAAA,QAAAF;EAGQJ,KAAAhC;EAAgBqC,KAAAA;EAAOH,KAAA;EAAoBC,KAAAlC,oBAAoB;GAAAsC,GAClE,EAAAd,WACU,4EACb;GAACe,GACE,EAAAf,WACU,mFACb;EACF,EAAE,CAAC,CAACC,aAAa,IAAIW,KAAK;EAACN,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,IAAAK;CAAA,IAAAL,EAAA,OAAAU,OAAAC,IAAA,2BAAA,GAAA;EACvBN,KAAA,oBAAA,QAAA;GAAkB,eAAA;GAAiB,WAAA;GACjC,UAAA,oBAAA,QAAA,EAAgB,WAAA,8GAA6G,CAAA;EACxH,CAAA;EAAAL,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAC,MAAAD,EAAA,OAAAE,MAAAF,EAAA,OAAAG,MAAAH,EAAA,OAAAI,IAAA;EAVJQ,KAAA,oBAAC,IAAD;GAAY,GAAKN;GAAO,iBAAAH;GAAe,GAAKC;GAQ/CC,UAAAA;EARe,CAAA;EAWHL,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAXTY;AAWS"}
1
+ {"version":3,"file":"index.js","names":["_c","ProgressBar","mergeStatefulStyles","className","contained","LoadingIndicator","t0","$","T0","t1","t2","t3","t4","props","undefined","0","1","Symbol","for","t5"],"sources":["../../../src/components/loading-indicator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { ProgressBarProps as RACProgressBarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ProgressBar } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii } from '../../tokens/design.tokens.stylex';\n\n// The loading indicator page's indicator, at\n// https://m3.material.io/components/loading-indicator/specs: a shape that\n// morphs through a sequence of seven while it turns, for a wait short\n// enough that how long it takes is not worth showing. It is indeterminate:\n// it says that something is happening, and React Aria's `ProgressBar` gives\n// it the role a screen reader announces that by.\n//\n// The page's tokens are a 48dp container with a full corner and a 38dp\n// active indicator inside it. Uncontained, the container is transparent and\n// the shape is primary; contained, the container is primary container and\n// the shape on primary container, for an indicator drawn over content rather\n// than beside it.\n//\n// The seven shapes are the page's, in its order: soft burst, nine-sided\n// cookie, pentagon, pill, sunny, four-sided cookie and oval. Each is the\n// polygon Material's own shape library builds for it, rounded the way that\n// library rounds a corner and normalised to the same box, then traced as 90\n// points at 4° steps around its centre — one list of points per shape, all\n// the same length, which is what lets `clip-path` interpolate from each to\n// the next. They share one scale, the largest at which the widest of them\n// still fits the 38dp indicator at every angle it turns through.\n//\n// The timing is Material's too. Each morph takes the 650ms interval it\n// starts, on a spring of damping ratio 0.6 and stiffness 200, which\n// overshoots by about a tenth and settles inside the interval; `SPRING` is\n// that curve sampled for `linear()`. Every morph turns the shape a further\n// quarter on the same spring, and the whole indicator turns once every\n// 4666ms underneath, at a constant rate. The quarter turns run on a cycle of\n// their own, four of them to a full turn, beside the morph's cycle of seven,\n// so each animation loops back to where it started.\n//\n// Under `prefers-reduced-motion` it slows rather than stopping, as the\n// progress indicator's ring does and for its reason: an indicator that\n// freezes stops saying the work is going on. The multiplier is the ring's.\n//\n// Under forced colours the shape is `CanvasText`, with the mode's own\n// adjustment turned off for it, since the mode would otherwise paint its\n// fill as the page's background and draw nothing at all.\n\n// The shapes as `clip-path` polygons over the 48dp container, generated from\n// the definitions in Material's shape library rather than drawn by hand. Each\n// starts at three o'clock and runs clockwise, so the nth point of one shape\n// becomes the nth point of the next.\nconst SHAPES = {\n cookie4Sided: 'polygon(79% 50%, 79.1% 52%, 79.6% 54.2%, 80.4% 56.5%, 81.5% 59%, 82.5% 61.8%, 82.9% 64.7%, 82.9% 67.5%, 82.4% 70.3%, 81.5% 72.9%, 80.2% 75.3%, 78.5% 77.5%, 76.4% 79.4%, 74.1% 80.9%, 71.6% 82%, 68.9% 82.7%, 66.1% 83%, 63.2% 82.8%, 60.4% 82.1%, 57.7% 80.9%, 55.3% 79.9%, 53.1% 79.3%, 51% 79%, 49% 79%, 46.9% 79.3%, 44.7% 79.9%, 42.3% 81%, 39.6% 82.1%, 36.8% 82.8%, 33.9% 83%, 31.1% 82.7%, 28.4% 82%, 25.9% 80.9%, 23.6% 79.4%, 21.5% 77.5%, 19.8% 75.3%, 18.5% 72.9%, 17.6% 70.3%, 17.1% 67.5%, 17.1% 64.7%, 17.5% 61.8%, 18.5% 59%, 19.6% 56.5%, 20.4% 54.2%, 20.9% 52%, 21% 50%, 20.9% 48%, 20.4% 45.8%, 19.6% 43.5%, 18.5% 41%, 17.5% 38.2%, 17.1% 35.3%, 17.1% 32.5%, 17.6% 29.7%, 18.5% 27.1%, 19.8% 24.7%, 21.5% 22.5%, 23.6% 20.6%, 25.9% 19.1%, 28.4% 18%, 31.1% 17.3%, 33.9% 17%, 36.8% 17.2%, 39.6% 17.9%, 42.3% 19.1%, 44.7% 20.1%, 46.9% 20.7%, 49% 21%, 51% 21%, 53.1% 20.7%, 55.3% 20.1%, 57.7% 19%, 60.4% 17.9%, 63.2% 17.2%, 66.1% 17%, 68.9% 17.3%, 71.6% 18%, 74.1% 19.1%, 76.4% 20.6%, 78.5% 22.5%, 80.2% 24.7%, 81.5% 27.1%, 82.4% 29.7%, 82.9% 32.5%, 82.9% 35.3%, 82.5% 38.2%, 81.5% 41%, 80.4% 43.5%, 79.6% 45.8%, 79.1% 48%)',\n cookie9Sided: 'polygon(82.5% 50%, 81.4% 52.2%, 80.4% 54.3%, 79.9% 56.4%, 79.8% 58.6%, 80.2% 61%, 80.2% 63.4%, 79.6% 65.8%, 78.6% 67.9%, 77.1% 69.7%, 75.2% 71.1%, 72.9% 72.1%, 70.8% 73.1%, 69.1% 74.4%, 67.6% 76.1%, 66.3% 78.3%, 64.7% 80.1%, 62.7% 81.4%, 60.5% 82.3%, 58.1% 82.6%, 55.7% 82.4%, 53.3% 81.7%, 51.1% 81.2%, 48.9% 81.2%, 46.7% 81.7%, 44.3% 82.4%, 41.9% 82.6%, 39.5% 82.3%, 37.3% 81.4%, 35.3% 80.1%, 33.7% 78.3%, 32.4% 76.1%, 30.9% 74.4%, 29.2% 73.1%, 27.1% 72.1%, 24.8% 71.1%, 22.9% 69.7%, 21.4% 67.9%, 20.4% 65.8%, 19.8% 63.4%, 19.8% 61%, 20.2% 58.6%, 20.1% 56.4%, 19.6% 54.3%, 18.6% 52.2%, 17.5% 50%, 17.1% 47.7%, 17.1% 45.4%, 17.7% 43.1%, 18.7% 41%, 20.3% 39.2%, 22.1% 37.6%, 23.4% 35.9%, 24.4% 34%, 24.9% 31.8%, 25.5% 29.5%, 26.6% 27.4%, 28.1% 25.6%, 29.9% 24.2%, 32% 23.3%, 34.3% 22.8%, 36.7% 22.7%, 38.8% 22.4%, 40.8% 21.6%, 42.6% 20.4%, 44.5% 18.9%, 46.6% 17.9%, 48.9% 17.4%, 51.1% 17.4%, 53.4% 17.9%, 55.5% 18.9%, 57.4% 20.4%, 59.2% 21.6%, 61.2% 22.4%, 63.3% 22.7%, 65.7% 22.8%, 68% 23.3%, 70.1% 24.2%, 71.9% 25.6%, 73.4% 27.4%, 74.5% 29.5%, 75.1% 31.8%, 75.6% 34%, 76.6% 35.9%, 77.9% 37.6%, 79.7% 39.2%, 81.3% 41%, 82.3% 43.1%, 82.9% 45.4%, 82.9% 47.7%)',\n oval: 'polygon(80% 50%, 79% 52%, 78.1% 53.9%, 77.1% 55.8%, 76% 57.5%, 75% 59.1%, 73.9% 60.6%, 72.8% 62.1%, 71.7% 63.5%, 70.5% 64.9%, 69.3% 66.2%, 68.1% 67.5%, 66.8% 68.7%, 65.6% 69.9%, 64.2% 71.1%, 62.8% 72.2%, 61.4% 73.3%, 59.9% 74.4%, 58.3% 75.5%, 56.6% 76.6%, 54.9% 77.6%, 53% 78.6%, 51% 79.5%, 48.9% 80.4%, 46.7% 81.2%, 44.4% 81.9%, 41.9% 82.4%, 39.3% 82.8%, 36.7% 83%, 34% 82.9%, 31.2% 82.5%, 28.6% 81.8%, 26.1% 80.6%, 23.8% 79.1%, 21.7% 77.3%, 20.1% 75.1%, 18.8% 72.7%, 17.8% 70.1%, 17.3% 67.4%, 17% 64.7%, 17.1% 62%, 17.4% 59.4%, 17.8% 56.8%, 18.5% 54.4%, 19.2% 52.2%, 20% 50%, 21% 48%, 21.9% 46.1%, 22.9% 44.2%, 24% 42.5%, 25% 40.9%, 26.1% 39.4%, 27.2% 37.9%, 28.3% 36.5%, 29.5% 35.1%, 30.7% 33.8%, 31.9% 32.5%, 33.2% 31.3%, 34.4% 30.1%, 35.8% 28.9%, 37.2% 27.8%, 38.6% 26.7%, 40.1% 25.6%, 41.7% 24.5%, 43.4% 23.4%, 45.1% 22.4%, 47% 21.4%, 49% 20.5%, 51.1% 19.6%, 53.3% 18.8%, 55.6% 18.1%, 58.1% 17.6%, 60.7% 17.2%, 63.3% 17%, 66% 17.1%, 68.8% 17.5%, 71.4% 18.2%, 73.9% 19.4%, 76.2% 20.9%, 78.3% 22.7%, 79.9% 24.9%, 81.2% 27.3%, 82.2% 29.9%, 82.7% 32.6%, 83% 35.3%, 82.9% 38%, 82.6% 40.6%, 82.2% 43.2%, 81.5% 45.6%, 80.8% 47.8%)',\n pentagon: 'polygon(82% 50%, 81.3% 52.2%, 80.6% 54.3%, 79.9% 56.4%, 79.2% 58.4%, 78.5% 60.4%, 77.9% 62.4%, 77.2% 64.5%, 76.5% 66.5%, 75.8% 68.7%, 75% 71%, 74.2% 73.4%, 73.1% 75.7%, 71.6% 77.7%, 69.7% 79.2%, 67.5% 80.3%, 65.1% 80.9%, 62.5% 81%, 60.1% 81%, 57.7% 81%, 55.5% 81%, 53.3% 81%, 51.1% 81%, 48.9% 81%, 46.7% 81%, 44.5% 81%, 42.3% 81%, 39.9% 81%, 37.5% 81%, 34.9% 80.9%, 32.5% 80.3%, 30.3% 79.2%, 28.4% 77.7%, 26.9% 75.7%, 25.8% 73.4%, 25% 71%, 24.2% 68.7%, 23.5% 66.5%, 22.8% 64.5%, 22.1% 62.4%, 21.5% 60.4%, 20.8% 58.4%, 20.1% 56.4%, 19.4% 54.3%, 18.7% 52.2%, 18% 50%, 17.3% 47.7%, 17% 45.4%, 17.3% 43%, 18% 40.8%, 19.2% 38.8%, 20.9% 37%, 22.9% 35.6%, 24.8% 34.2%, 26.6% 33%, 28.3% 31.8%, 29.9% 30.6%, 31.5% 29.5%, 33.1% 28.4%, 34.7% 27.3%, 36.2% 26.1%, 37.8% 25%, 39.4% 23.9%, 41.1% 22.7%, 42.9% 21.4%, 44.8% 20.3%, 46.8% 19.4%, 48.9% 19%, 51.1% 19%, 53.2% 19.4%, 55.2% 20.3%, 57.1% 21.4%, 58.9% 22.7%, 60.6% 23.9%, 62.2% 25%, 63.8% 26.1%, 65.3% 27.3%, 66.9% 28.4%, 68.5% 29.5%, 70.1% 30.6%, 71.7% 31.8%, 73.4% 33%, 75.2% 34.2%, 77.1% 35.6%, 79.1% 37%, 80.8% 38.8%, 82% 40.8%, 82.7% 43%, 83% 45.4%, 82.7% 47.7%)',\n pill: 'polygon(82.6% 50%, 82.1% 52.2%, 81.4% 54.4%, 80.6% 56.5%, 79.7% 58.5%, 78.6% 60.4%, 77.4% 62.2%, 76.1% 63.9%, 74.7% 65.4%, 73.2% 66.9%, 71.8% 68.3%, 70.4% 69.7%, 69% 71.1%, 67.6% 72.5%, 66.2% 73.9%, 64.7% 75.4%, 63.1% 76.8%, 61.3% 78%, 59.5% 79.2%, 57.5% 80.2%, 55.5% 81.1%, 53.3% 81.8%, 51.1% 82.4%, 48.9% 82.7%, 46.5% 83%, 44.2% 82.9%, 41.9% 82.6%, 39.5% 82.2%, 37.2% 81.7%, 34.9% 80.9%, 32.7% 79.9%, 30.6% 78.7%, 28.6% 77.4%, 26.7% 75.9%, 25% 74.2%, 23.4% 72.4%, 21.9% 70.4%, 20.7% 68.3%, 19.6% 66.2%, 18.7% 63.9%, 18% 61.6%, 17.5% 59.3%, 17.2% 57%, 17% 54.6%, 17.1% 52.3%, 17.4% 50%, 17.9% 47.8%, 18.6% 45.6%, 19.4% 43.5%, 20.3% 41.5%, 21.4% 39.6%, 22.6% 37.8%, 23.9% 36.1%, 25.3% 34.6%, 26.8% 33.1%, 28.2% 31.7%, 29.6% 30.3%, 31% 28.9%, 32.4% 27.5%, 33.8% 26.1%, 35.3% 24.6%, 36.9% 23.2%, 38.7% 22%, 40.5% 20.8%, 42.5% 19.8%, 44.5% 18.9%, 46.7% 18.2%, 48.9% 17.6%, 51.1% 17.3%, 53.5% 17%, 55.8% 17.1%, 58.1% 17.4%, 60.5% 17.8%, 62.8% 18.3%, 65.1% 19.1%, 67.3% 20.1%, 69.4% 21.3%, 71.4% 22.6%, 73.3% 24.1%, 75% 25.8%, 76.6% 27.6%, 78.1% 29.6%, 79.3% 31.7%, 80.4% 33.8%, 81.3% 36.1%, 82% 38.4%, 82.5% 40.7%, 82.8% 43%, 83% 45.4%, 82.9% 47.7%)',\n softBurst: 'polygon(76% 50%, 76.5% 51.9%, 78.3% 54%, 80.4% 56.5%, 81.5% 59%, 80.8% 61.2%, 78.3% 62.6%, 75.2% 63.4%, 72.5% 64.1%, 71% 65.3%, 70.4% 67.1%, 70.5% 69.8%, 70.8% 73.1%, 70.2% 75.9%, 68.3% 77.2%, 65.5% 76.9%, 62.5% 75.6%, 60% 74.6%, 58% 74.7%, 56.4% 75.8%, 55% 78.1%, 53.2% 80.9%, 51.1% 82.8%, 48.9% 82.8%, 46.8% 80.8%, 45% 78.1%, 43.6% 75.8%, 42% 74.7%, 40% 74.7%, 37.5% 75.7%, 34.5% 76.9%, 31.6% 77.2%, 29.8% 75.9%, 29.2% 73%, 29.5% 69.8%, 29.6% 67.1%, 29% 65.3%, 27.5% 64.1%, 24.8% 63.4%, 21.6% 62.6%, 19.2% 61.2%, 18.5% 59%, 19.7% 56.4%, 21.8% 54%, 23.5% 51.9%, 24% 50%, 23.5% 48.1%, 21.7% 46%, 19.6% 43.5%, 18.5% 41%, 19.2% 38.8%, 21.7% 37.4%, 24.8% 36.6%, 27.5% 35.9%, 29% 34.7%, 29.6% 32.9%, 29.5% 30.2%, 29.2% 26.9%, 29.8% 24.1%, 31.7% 22.8%, 34.5% 23.1%, 37.5% 24.4%, 40% 25.4%, 42% 25.3%, 43.6% 24.2%, 45% 21.9%, 46.8% 19.1%, 48.9% 17.2%, 51.1% 17.2%, 53.2% 19.2%, 55% 21.9%, 56.4% 24.2%, 58% 25.3%, 60% 25.3%, 62.5% 24.3%, 65.5% 23.1%, 68.4% 22.8%, 70.2% 24.1%, 70.8% 27%, 70.5% 30.2%, 70.4% 32.9%, 71% 34.7%, 72.5% 35.9%, 75.2% 36.6%, 78.4% 37.4%, 80.8% 38.8%, 81.5% 41%, 80.3% 43.6%, 78.2% 46%, 76.5% 48.1%)',\n sunny: 'polygon(83% 50%, 82.5% 52.3%, 80.9% 54.3%, 79.3% 56.2%, 77.8% 58%, 76.4% 59.6%, 75.6% 61.4%, 75.4% 63.5%, 75.2% 65.7%, 75% 68.2%, 74.7% 70.8%, 73.7% 72.9%, 71.9% 74.3%, 69.4% 74.9%, 66.9% 75.1%, 64.6% 75.3%, 62.4% 75.4%, 60.5% 75.9%, 58.8% 77.1%, 57.1% 78.6%, 55.3% 80.1%, 53.3% 81.8%, 51.1% 82.9%, 48.9% 82.9%, 46.7% 81.8%, 44.7% 80.1%, 42.9% 78.6%, 41.2% 77.1%, 39.5% 75.9%, 37.6% 75.4%, 35.4% 75.3%, 33.1% 75.1%, 30.6% 74.9%, 28.1% 74.3%, 26.3% 72.9%, 25.3% 70.8%, 25% 68.2%, 24.8% 65.7%, 24.6% 63.5%, 24.4% 61.4%, 23.6% 59.6%, 22.2% 58%, 20.7% 56.2%, 19.1% 54.3%, 17.5% 52.3%, 17% 50%, 17.5% 47.7%, 19.1% 45.7%, 20.7% 43.8%, 22.2% 42%, 23.6% 40.4%, 24.4% 38.6%, 24.6% 36.5%, 24.8% 34.3%, 25% 31.8%, 25.3% 29.2%, 26.3% 27.1%, 28.1% 25.7%, 30.6% 25.1%, 33.1% 24.9%, 35.4% 24.7%, 37.6% 24.6%, 39.5% 24.1%, 41.2% 22.9%, 42.9% 21.4%, 44.7% 19.9%, 46.7% 18.2%, 48.9% 17.1%, 51.1% 17.1%, 53.3% 18.2%, 55.3% 19.9%, 57.1% 21.4%, 58.8% 22.9%, 60.5% 24.1%, 62.4% 24.6%, 64.6% 24.7%, 66.9% 24.9%, 69.4% 25.1%, 71.9% 25.7%, 73.7% 27.1%, 74.7% 29.2%, 75% 31.8%, 75.2% 34.3%, 75.4% 36.5%, 75.6% 38.6%, 76.4% 40.4%, 77.8% 42%, 79.3% 43.8%, 80.9% 45.7%, 82.5% 47.7%)'\n} as const;\n\n// One morph's interval, the morph's cycle through all seven, and the quarter\n// turns' cycle of four.\nconst MORPH_MS = 650;\nconst MORPH_CYCLE_MS = MORPH_MS * 7;\nconst TURN_CYCLE_MS = MORPH_MS * 4;\nconst SPIN_MS = 4666;\n\n// What `prefers-reduced-motion` slows every animation by.\nconst SLOWDOWN = 1.25;\n\n// The spring, sampled every 25ms of the 650ms interval. It is within half a\n// percent of rest by the end, and the last sample is rest itself, so a morph\n// lands exactly on its shape before the next begins.\nconst SPRING = 'linear(0, 0.054, 0.185, 0.352, 0.527, 0.69, 0.827, 0.934, 1.011, 1.06, 1.086, 1.095, 1.091, 1.079, 1.063, 1.047, 1.031, 1.018, 1.007, 1, 0.995, 0.992, 0.991, 0.991, 0.992, 0.994, 1)';\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst REDUCED_MOTION = '@media (prefers-reduced-motion: reduce)';\nconst morph = \"x1v8p8us-B\";\nconst turn = \"x1kc2w18-B\";\nconst spin = \"x1wc8ddo-B\";\ntype LoadingIndicatorProps = {\n /** A function may compute the class from the indicator's render state. */\n className?: RACProgressBarProps['className'];\n /**\n * Draws the shape on a circular container in the primary container pair,\n * for an indicator drawn over content — a list being refreshed, an image\n * being fetched — where a bare shape would have nothing behind it to read\n * against.\n * @default false\n */\n contained?: boolean;\n /** A function may compute the style from the indicator's render state. */\n style?: RACProgressBarProps['style'];\n} & Omit<RACProgressBarProps, 'children' | 'className' | 'formatOptions' | 'isIndeterminate' | 'maxValue' | 'minValue' | 'style' | 'value' | 'valueLabel'>;\n\n/**\n * A shape morphing as it turns, for a wait of a few seconds whose length is\n * not worth showing — where it would otherwise be an indeterminate ring.\n * Name it with `aria-label`, or `aria-labelledby` where something on the\n * page already says what is loading.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction LoadingIndicator({\n contained = false,\n ...props\n}: LoadingIndicatorProps & RefAttributes<HTMLDivElement>) {\n return <ProgressBar {...props} isIndeterminate {...mergeStatefulStyles({\n 0: {\n className: \"x6s0dn4 xsdox4t x16fbrrb x9f619 x3nfvp2 x2lah0s x1useyqa xl56j7k x1mxwv8y\"\n },\n 1: {\n className: \"x6s0dn4 xsdox4t x16fbrrb x9f619 x3nfvp2 x2lah0s x1useyqa xl56j7k xp89om9 xscdzaa\"\n }\n }[!!contained << 0], props)}>\n <span aria-hidden=\"true\" className=\"xojko4r xa4qsjk x1aerksh x1esw782 x5yr21d x9f619 x1lliihq xh8yej3 x1224tbv\">\n <span className=\"x1q58mop x77zgwx x13hkq4m xlges3w xtwfq29 xwvh9j7 x5yr21d x9f619 xiiw7xq x1lliihq x1g12otp xh8yej3 x1vsa048\" />\n </span>\n </ProgressBar>;\n}\nexport type { LoadingIndicatorProps };\nexport default LoadingIndicator;"],"mappings":";;;;;;;;;;;;;;;AA0GA,SAAAK,iBAAAC,IAAA;CAAA,MAAAC,IAAAP,EAAA,EA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ens it, then the `Menu.Content` it opens.
202
202
  */
203
203
  declare function MenuSubmenu(props: MenuSubmenuProps): import("react").JSX.Element;
204
- export { type MenuAlign, MenuContent, type MenuContentProps, MenuItem$1 as MenuItem, type MenuItemProps$1 as MenuItemProps, MenuLoadMore, type MenuLoadMoreProps, type MenuProps$1 as MenuProps, MenuSection$1 as MenuSection, type MenuSectionProps$1 as MenuSectionProps, MenuSeparator, type MenuSeparatorProps, type MenuSide, MenuSubmenu, type MenuSubmenuProps, Menu$1 as default };
205
- //# sourceMappingURL=index.d.ts.map
204
+ export { type MenuAlign, MenuContent, type MenuContentProps, MenuItem$1 as MenuItem, type MenuItemProps$1 as MenuItemProps, MenuLoadMore, type MenuLoadMoreProps, type MenuProps$1 as MenuProps, MenuSection$1 as MenuSection, type MenuSectionProps$1 as MenuSectionProps, MenuSeparator, type MenuSeparatorProps, type MenuSide, MenuSubmenu, type MenuSubmenuProps, Menu$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ComponentProps","ReactElement","ReactNode","RefAttributes","ClassNameOrFunction","MenuItemRenderProps","PopoverRenderProps","MenuItemProps","RACMenuItemProps","MenuLoadMoreItemProps","RACMenuLoadMoreItemProps","MenuProps","RACMenuProps","MenuSectionProps","RACMenuSectionProps","MenuTriggerProps","RACMenuTriggerProps","StyleOrFunction","stylex","useContext","useEffect","useRef","AutocompleteStateContext","Header","Keyboard","Menu","RACMenu","MenuItem","RACMenuItem","MenuLoadMoreItem","RACMenuLoadMoreItem","MenuSection","RACMenuSection","MenuTrigger","RACMenuTrigger","Popover","RACPopover","SubmenuTrigger","RACSubmenuTrigger","Text","OverlayAlign","OverlaySide","CollectionEmpty","CollectionLoadMore","CollectionStatus","textOf","CheckGlyph","ChevronEndGlyph","useRipple","KeycapToneContext","RowContent","rowStyles","supportingTone","mergeStatefulStyles","mergeStyles","overlay","placementOf","popupOrigin","colors","radii","sizing","spacing","typography","Separator","MENU_MIN","MENU_MAX","styles","content","kWkggS","kaIpWk","ks0D6T","k7Eaqz","k3XXqK","k8WAf4","$$css","shortcut","kMwMTN","MenuAlign","MenuContentProps","align","alignOffset","className","container","Element","renderEmptyState","T","search","side","MenuSide","sideOffset","style","Omit","children","leading","trailing","MenuLoadMoreProps","label","header","MenuSeparatorProps","MenuSubmenuProps","trigger","delay","emptyState","itemContent","ripple","state","check","isSelected","undefined","hasLeading","isDisabled","trailingOf","itemStyles","props","base","menu","selectedMenu","isHovered","hovered","isFocusVisible","focusVisible","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","stylex.props","Menu","_c","RACMenuTrigger","RACMenu","RACPopover","MenuItem","RACMenuItem","RACMenuLoadMoreItem","MenuSection","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.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,MAAMoE,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,SAAS4B,aAAa;CACpB,OAAO,oBAAC,iBAAD,EAAiB,SAAQ,OAAM,CAAA;AACxC;AAiBA,SAASC,YAAYX,UAAqBC,SAAoBlB,UAAqBmB,UAAqBU,QAAmB;CACzH,QAAQC,UAA+B;EACrC,MAAMC,QAAQD,MAAME,aAAa,oBAAC,YAAD,EAAY,WAAU,iCAAgC,CAAA,IAAMC,KAAAA;EAC7F,MAAMC,aAAahB,YAAYe,KAAAA,KAAaf,YAAY;EACxD,OAAO,qBAAA,YAAA,EAAA,UAAA,CACH,oBAAC,YAAD;GAAY,YAAYY,MAAMK;GAAY,YAAYL,MAAME;GAAY,SAASE,aAAaH,SAASb,UAAUe,KAAAA;GAAW,UAAUG,WAAWN,OAAO9B,UAAUmB,UAAUe,aAAaD,KAAAA,IAAYF,KAAK;GAAG,SAAQ;GACnN,UAAA,oBAAC,MAAD;IAAM,MAAK;IAASd;GAAe,CAAA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,IAAAC;CAAA,IAAAP,EAAA,OAAAjC,UAAA;EACCwC,KAAA,oBAAA,OAAA;GAAUJ;GAAe,WAAA;GAC3BpC;EACG,CAAA;EAAAiC,EAAA,KAAAjC;EAAAiC,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAFDO;AAEC;AAOV,SAASF,cAAczB,OAA2B;CAChD,OAAOvF,MAAaqC,QAAQsG,OAAO3F,OAAOC,SAASV,YAAYgD,MAAMqD,SAAS,CAAC;AACjF;;;AAIA,SAAS/C,WAAWN,OAA4B9B,UAAqBmB,UAAqBY,OAAkB;CAC1G,IAAID,MAAMsD,YACR,OAAO,qBAAA,YAAA,EAAA,UAAA,CACFjE,UACD,oBAAC,iBAAD,EAAiB,WAAU,qCAAoC,CAAA,CACjE,EAAA,CAAA;CAEJ,IAAInB,aAAaiC,KAAAA,KAAad,aAAac,KAAAA,KAAaF,UAAUE,KAAAA,GAChE;CAEF,OAAO,qBAAA,YAAA,EAAA,UAAA;EACFd;EACAnB,aAAaiC,KAAAA,IAAY,OAAO,oBAAC,UAAD;GAAU,GAAI1F,MAAagD,OAAOS,UAAUvB,eAAe,QAAQqD,KAAK,CAAC;GACtG,UAAA,oBAAC,mBAAD;IAAmB,OAAOA,MAAMK,cAAcL,MAAME,aAAa,YAAY;IAC1EhC,UAAAA;GACgB,CAAA;EACX,CAAA;EACX+B;CACH,EAAA,CAAA;AACJ;AACAjF,OAAKuI,UAAUjC;AACftG,OAAKwI,OAAOtI;AACZF,OAAKyI,WAAWjB;AAChBxH,OAAK0I,UAAUpI;AACfN,OAAKsC,YAAYmF;AACjBzH,OAAK2I,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","check","isSelected","undefined","hasLeading","isDisabled","trailingOf","itemStyles","props","base","menu","selectedMenu","isHovered","hovered","isFocusVisible","focusVisible","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.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,SAAoBX,UAAqBY,UAAqBK,QAAmB;CACzH,QAAQC,UAA+B;EACrC,MAAMC,QAAQD,MAAME,aAAa,oBAAC,YAAD,EAAY,WAAU,iCAAgC,CAAA,IAAMC,KAAAA;EAC7F,MAAMC,aAAaX,YAAYU,KAAAA,KAAaV,YAAY;EACxD,OAAO,qBAAA,YAAA,EAAA,UAAA,CACH,oBAAC,YAAD;GAAY,YAAYO,MAAMK;GAAY,YAAYL,MAAME;GAAY,SAASE,aAAaH,SAASR,UAAUU,KAAAA;GAAW,UAAUG,WAAWN,OAAOlB,UAAUY,UAAUU,aAAaD,KAAAA,IAAYF,KAAK;GAAG,SAAQ;GACnN,UAAA,oBAAC,MAAD;IAAM,MAAK;IAAST;GAAe,CAAA;EACzB,CAAA,GACXQ,MAAMK,aAAa,OAAON,MAC7B,EAAA,CAAA;CACJ;AACF;AAeA,SAASQ,WAAWP,OAA4B;CAC9C,OAAO/C,MAAaY,UAAU4C,MAAM5C,UAAU6C,MAAMV,MAAME,cAAcrC,UAA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A,OAFDO;AAEC;AAOV,SAASF,cAAczB,OAA2B;CAChD,OAAO/C,MAAagB,QAAQmF,OAAO/E,OAAOC,SAASH,YAAY6B,MAAMqD,SAAS,CAAC;AACjF;;;AAIA,SAAS/C,WAAWN,OAA4BlB,UAAqBY,UAAqBO,OAAkB;CAC1G,IAAID,MAAMsD,YACR,OAAO,qBAAA,YAAA,EAAA,UAAA,CACF5D,UACD,oBAAC,iBAAD,EAAiB,WAAU,qCAAoC,CAAA,CACjE,EAAA,CAAA;CAEJ,IAAIZ,aAAaqB,KAAAA,KAAaT,aAAaS,KAAAA,KAAaF,UAAUE,KAAAA,GAChE;CAEF,OAAO,qBAAA,YAAA,EAAA,UAAA;EACFT;EACAZ,aAAaqB,KAAAA,IAAY,OAAO,oBAAC,UAAD;GAAU,GAAIlD,MAAaoB,OAAOS,UAAUhB,eAAe,QAAQkC,KAAK,CAAC;GACtG,UAAA,oBAAC,mBAAD;IAAmB,OAAOA,MAAMK,cAAcL,MAAME,aAAa,YAAY;IAC1EpB,UAAAA;GACgB,CAAA;EACX,CAAA;EACXmB;CACH,EAAA,CAAA;AACJ;AACA3C,OAAKiG,UAAUjC;AACfhE,OAAKkG,OAAOjG;AACZD,OAAKmG,WAAWjB;AAChBlF,OAAKoG,UAAUhG;AACfJ,OAAKc,YAAYqE;AACjBnF,OAAKqG,UAAUjB"}
@@ -46,5 +46,4 @@ type MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>;
46
46
  * which is the element a layout positions.
47
47
  */
48
48
  declare function Meter$1({ label, maxValue, minValue, showValue, tone, ...props }: MeterProps$1 & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
49
- export { type MeterProps$1 as MeterProps, type MeterTone, Meter$1 as default };
50
- //# sourceMappingURL=index.d.ts.map
49
+ export { type MeterProps$1 as MeterProps, type MeterTone, Meter$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","MeterRenderProps","MeterProps","RACMeterProps","stylex","Meter","RACMeter","IndicatorTone","CheckCircleGlyph","ErrorGlyph","IndicatorLabels","IndicatorLine","indicatorStyles","mergeStatefulStyles","colors","Omit","className","label","showValue","style","tone","MeterTone","Extract","t0","$","T0","t1","t2","t3","t4","t5","maxValue","t6","minValue","t7","t8","t9","props","undefined","root","meterContent","state","statusOf","valueText","percentage","Meter","_c","props","RACMeter","stylex.props"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { MeterRenderProps, MeterProps as RACMeterProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Meter as RACMeter } from 'react-aria-components';\nimport type { IndicatorTone } from '../../indicator/styles';\nimport { CheckCircleGlyph, ErrorGlyph } from '../../glyphs';\nimport { IndicatorLabels, IndicatorLine } from '../../indicator';\nimport { indicatorStyles } from '../../indicator/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors } from '../../tokens/design.tokens.stylex';\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task: the same three parts at the same 4dp, the same\n// label row above them, and the same motion when the number changes. All of\n// that is `src/indicator`, shared with ProgressIndicator, so what is here is\n// the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. React Aria's `Meter` reports `meter` rather than\n// `progressbar`, and a screen reader says the two differently: one is how\n// full something is, the other how far along something is. That difference\n// is the whole reason both exist, and it is why a meter has no\n// indeterminate state to offer — a measurement whose value is unknown is\n// not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for\n// a task: progress does not become good or bad on its way to done. A\n// measurement does — a disk at 96% and a signal at 96% mean opposite\n// things — so `negative` and `positive` recolour the active indicator and\n// the stop indicator while leaving the track alone. A column of meters then\n// reads as one scale with bars of different colours, rather than as several\n// gauges that happen to sit together. Which tone a value deserves is the\n// call site's to decide: nothing here reads the number and picks one, since\n// where the line falls between good and bad is the measurement's own\n// business.\n//\n// Colour alone does not carry it. The two roles are drawn from the same\n// tone of their palettes, as error is, so their bars are equally light —\n// 1.00:1 in the light theme — and a reader who cannot tell red from green\n// sees two bars of one colour, while forced colours paint both in\n// `Highlight`. So each draws a glyph before the value as well: an\n// exclamation mark in a filled circle for `negative` and a check in one for\n// `positive`, at the chips page's 18dp beside label-large text, in the\n// tone's own colour. The circles are one outline with a different mark\n// inside, which is what tells them apart in grey and under a forced palette.\n// No Material Design page draws a meter, so the glyph is this library's;\n// it is hidden from a screen reader, which hears the label and the value\n// instead, and the tone's JSDoc says to state the status there.\n//\n// The value is shown by default, where a progress indicator hides it. A\n// meter is the number — a bar with no figure beside it says only \"some\" —\n// and `formatOptions` is what makes that figure read as a percentage, bytes\n// or a plain count, in the page's locale.\n\ntype MeterProps = Omit<RACMeterProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the meter's render state. */\n className?: RACMeterProps['className'];\n /**\n * What is being measured, shown above the line. A screen reader reads it\n * as the meter's name; a meter whose surroundings name it takes\n * `aria-label` instead and leaves this out.\n */\n label?: ReactNode;\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the meter's render state. */\n style?: RACMeterProps['style'];\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator and the stop indicator, leaving the track\n * in its secondary container so a column of meters still shares one\n * track. Each also draws a glyph before the value, an exclamation mark\n * for `negative` and a check for `positive`, so the tone reads without\n * its colour. A screen reader hears neither, so say the status in `label`\n * or `valueLabel` as well.\n * @default 'primary'\n */\n tone?: MeterTone;\n};\n// The three of the shared line's four tones a meter draws. The fourth,\n// `inherit`, is for an indicator inside something that carries its own\n// colour, which is a pending button rather than a measurement.\ntype MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>;\n\n/**\n * How full something is, on a scale it names: disk used, storage left,\n * a rating out of five. Pass `value` between `minValue` and `maxValue`, and\n * `formatOptions` to say how the number reads. For how far along a task is,\n * reach for ProgressIndicator instead — a meter has no indeterminate state,\n * because a measurement always has a value.\n *\n * ```tsx\n * <Meter label=\"Label\" maxValue={5} value={3} />\n * ```\n *\n * The call site's `className` and `style` land on the meter as a whole,\n * which is the element a layout positions.\n */\nfunction Meter({\n label,\n maxValue = 100,\n minValue = 0,\n showValue = true,\n tone = 'primary',\n ...props\n}: MeterProps & RefAttributes<HTMLDivElement>) {\n return <RACMeter maxValue={maxValue} minValue={minValue} {...props} {...mergeStatefulStyles(stylex.props(indicatorStyles.root), props)}>\n {meterContent(label, showValue, tone)}\n </RACMeter>;\n}\n\n// What the meter 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.\nfunction meterContent(label: ReactNode, showValue: boolean, tone: MeterTone) {\n return (state: MeterRenderProps) => <>\n <IndicatorLabels label={label} status={statusOf(tone)} value={showValue ? state.valueText : undefined} />\n <IndicatorLine percentage={state.percentage} tone={tone} />\n </>;\n}\n\n// The glyph a tone draws before the value — see the comment at the top.\nfunction statusOf(tone: MeterTone) {\n if (tone === 'negative') {\n return <ErrorGlyph className=\"xamitd3 xmix8c7 x9f619 x2lah0s x1xp8n7a x12gp0t\" />;\n }\n if (tone === 'positive') {\n return <CheckCircleGlyph className=\"xamitd3 xmix8c7 x9f619 x2lah0s x1xp8n7a x4no3js\" />;\n }\n return undefined;\n}\nexport type { MeterProps, MeterTone };\nexport default Meter;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwGA,SAAAQ,QAAAkB,IAAA;CAAA,MAAAC,IAAA1B,EAAA,EAAA;CAAA,IAAA2B;CAAA,IAAAR;CAAA,IAAAC;CAAA,IAAAQ;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAT;CAAA,IAAAI,EAAA,OAAAD,IAAA;EAAe,MAAA,EAAAN,OAAAa,IAAAC,UAAAC,IAAAC,UAAAC,IAAAhB,WAAAiB,IA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AA,MAAAC;EAAAD,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAFNQ;AAEM;AAOf,SAASQ,aAAavB,OAAkBC,WAAoBE,MAAiB;CAC3E,QAAQqB,UAA4B,qBAAA,UAAA,EAAA,UAAA,CAChC,oBAAC,iBAAD;EAAwBxB;EAAO,QAAQyB,SAAStB,IAAI;EAAG,OAAOF,YAAYuB,MAAME,YAAYL,KAAAA;CAAU,CAAA,GACtG,oBAAC,eAAD;EAAe,YAAYG,MAAMG;EAAkBxB;CAAK,CAAA,CAC1D,EAAA,CAAA;AACJ;AAGA,SAASsB,SAAStB,MAAiB;CACjC,IAAIA,SAAS,YACX,OAAO,oBAAC,YAAD,EAAY,WAAU,kDAAiD,CAAA;CAEhF,IAAIA,SAAS,YACX,OAAO,oBAAC,kBAAD,EAAkB,WAAU,kDAAiD,CAAA;AAGxF"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","Meter","RACMeter","indicatorStyles","mergeStatefulStyles","label","showValue","tone","t0","$","T0","t1","t2","t3","t4","t5","maxValue","t6","minValue","t7","t8","t9","props","undefined","root","meterContent","state","statusOf","valueText","percentage"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { MeterRenderProps, MeterProps as RACMeterProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Meter as RACMeter } from 'react-aria-components';\nimport type { IndicatorTone } from '../../indicator/styles';\nimport { CheckCircleGlyph, ErrorGlyph } from '../../glyphs';\nimport { IndicatorLabels, IndicatorLine } from '../../indicator';\nimport { indicatorStyles } from '../../indicator/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors } from '../../tokens/design.tokens.stylex';\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task: the same three parts at the same 4dp, the same\n// label row above them, and the same motion when the number changes. All of\n// that is `src/indicator`, shared with ProgressIndicator, so what is here is\n// the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. React Aria's `Meter` reports `meter` rather than\n// `progressbar`, and a screen reader says the two differently: one is how\n// full something is, the other how far along something is. That difference\n// is the whole reason both exist, and it is why a meter has no\n// indeterminate state to offer — a measurement whose value is unknown is\n// not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for\n// a task: progress does not become good or bad on its way to done. A\n// measurement does — a disk at 96% and a signal at 96% mean opposite\n// things — so `negative` and `positive` recolour the active indicator and\n// the stop indicator while leaving the track alone. A column of meters then\n// reads as one scale with bars of different colours, rather than as several\n// gauges that happen to sit together. Which tone a value deserves is the\n// call site's to decide: nothing here reads the number and picks one, since\n// where the line falls between good and bad is the measurement's own\n// business.\n//\n// Colour alone does not carry it. The two roles are drawn from the same\n// tone of their palettes, as error is, so their bars are equally light —\n// 1.00:1 in the light theme — and a reader who cannot tell red from green\n// sees two bars of one colour, while forced colours paint both in\n// `Highlight`. So each draws a glyph before the value as well: an\n// exclamation mark in a filled circle for `negative` and a check in one for\n// `positive`, at the chips page's 18dp beside label-large text, in the\n// tone's own colour. The circles are one outline with a different mark\n// inside, which is what tells them apart in grey and under a forced palette.\n// No Material Design page draws a meter, so the glyph is this library's;\n// it is hidden from a screen reader, which hears the label and the value\n// instead, and the tone's JSDoc says to state the status there.\n//\n// The value is shown by default, where a progress indicator hides it. A\n// meter is the number — a bar with no figure beside it says only \"some\" —\n// and `formatOptions` is what makes that figure read as a percentage, bytes\n// or a plain count, in the page's locale.\n\ntype MeterProps = Omit<RACMeterProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the meter's render state. */\n className?: RACMeterProps['className'];\n /**\n * What is being measured, shown above the line. A screen reader reads it\n * as the meter's name; a meter whose surroundings name it takes\n * `aria-label` instead and leaves this out.\n */\n label?: ReactNode;\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the meter's render state. */\n style?: RACMeterProps['style'];\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator and the stop indicator, leaving the track\n * in its secondary container so a column of meters still shares one\n * track. Each also draws a glyph before the value, an exclamation mark\n * for `negative` and a check for `positive`, so the tone reads without\n * its colour. A screen reader hears neither, so say the status in `label`\n * or `valueLabel` as well.\n * @default 'primary'\n */\n tone?: MeterTone;\n};\n// The three of the shared line's four tones a meter draws. The fourth,\n// `inherit`, is for an indicator inside something that carries its own\n// colour, which is a pending button rather than a measurement.\ntype MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>;\n\n/**\n * How full something is, on a scale it names: disk used, storage left,\n * a rating out of five. Pass `value` between `minValue` and `maxValue`, and\n * `formatOptions` to say how the number reads. For how far along a task is,\n * reach for ProgressIndicator instead — a meter has no indeterminate state,\n * because a measurement always has a value.\n *\n * ```tsx\n * <Meter label=\"Label\" maxValue={5} value={3} />\n * ```\n *\n * The call site's `className` and `style` land on the meter as a whole,\n * which is the element a layout positions.\n */\nfunction Meter({\n label,\n maxValue = 100,\n minValue = 0,\n showValue = true,\n tone = 'primary',\n ...props\n}: MeterProps & RefAttributes<HTMLDivElement>) {\n return <RACMeter maxValue={maxValue} minValue={minValue} {...props} {...mergeStatefulStyles(stylex.props(indicatorStyles.root), props)}>\n {meterContent(label, showValue, tone)}\n </RACMeter>;\n}\n\n// What the meter 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.\nfunction meterContent(label: ReactNode, showValue: boolean, tone: MeterTone) {\n return (state: MeterRenderProps) => <>\n <IndicatorLabels label={label} status={statusOf(tone)} value={showValue ? state.valueText : undefined} />\n <IndicatorLine percentage={state.percentage} tone={tone} />\n </>;\n}\n\n// The glyph a tone draws before the value — see the comment at the top.\nfunction statusOf(tone: MeterTone) {\n if (tone === 'negative') {\n return <ErrorGlyph className=\"xamitd3 xmix8c7 x9f619 x2lah0s x1xp8n7a x12gp0t\" />;\n }\n if (tone === 'positive') {\n return <CheckCircleGlyph className=\"xamitd3 xmix8c7 x9f619 x2lah0s x1xp8n7a x4no3js\" />;\n }\n return undefined;\n}\nexport type { MeterProps, MeterTone };\nexport default Meter;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwGA,SAAAE,QAAAO,IAAA;CAAA,MAAAC,IAAAV,EAAA,EAAA;CAAA,IAAAW;CAAA,IAAAL;CAAA,IAAAC;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP;CAAA,IAAAE,EAAA,OAAAD,IAAA;EAAe,MAAA,EAAAH,OAAAU,IAAAC,UAAAC,IAAAC,UAAAC,IAAAb,WAAAc,IAAAb,MAAAc,IAAA,GAAAC,YAAAd;EAAAH,QAAAU;EAEb,MAAAC,WAAAC,OAAAM,KAAAA,IAAA,MAAAN;EACA,MAAAC,WAAAC,OAAAI,KAAAA,IAAA,IAAAJ;EACAb,YAAAc,OAAAG,KAAAA,IAAA,OAAAH;EACAb,OAAAc,OAAAE,KAAAA,IAAA,YAAAF;EAGQX,KAAAR;EAAmBc,KAAAA;EAAoBE,KAAAA;EAAcI,KAAAA;EAAWR,KAAAV,oBAAoBJ,MAAaG,gBAAeqB,IAAK,GAAGF,OAAK;EAACb,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAJ;EAAAI,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAF;CAAA,OAAA;EAAAG,KAAAD,EAAA;EAAAJ,QAAAI,EAAA;EAAAH,YAAAG,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA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declare namespace NavigationBar {
66
66
  * component itself rather than a reference to a client one.
67
67
  */
68
68
  declare function NavigationBarItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>): import("react").JSX.Element;
69
- export { NavigationBarItem, type NavigationItemProps as NavigationBarItemProps, type NavigationBarProps, NavigationBar as default };
70
- //# sourceMappingURL=index.d.ts.map
69
+ export { NavigationBarItem, type NavigationItemProps as NavigationBarItemProps, type NavigationBarProps, NavigationBar as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","RefAttributes","stylex","useLayoutEffect","useMemo","useState","NavigationItemProps","RenderComponentProps","NavigationItem","NavigationList","NavigationContext","mergeRefs","useRender","mergeStyles","colors","styles","destinations","kGNEyG","k1xSpc","kzQI83","kjj79g","k7Eaqz","$$css","HORIZONTAL","NavigationBarProps","selectedRoute","NavigationBar","t0","$","children","props","render","element","setElement","isCramped","useCramped","t1","ref","undefined","t2","merged","t3","const","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","NavigationBarItemProps","_c"],"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,MAAMgB,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAKA,MAAMC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDnB,SAAAG,cAAAC,IAAA;CAAA,MAAAC,IAAA5B,EAAA,EAAA;CAAA,IAAA6B;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,cAA8B5B,SAA6B,IAAI;CAC/D,MAAA6B,YAAkBC,WAAWH,OAAO;CAIe,MAAAI,KAAAN,MAAKO,OAALC,KAAAA;CAAsB,IAAAC;CAAA,IAAAX,EAAA,OAAAQ,IAAA;EAA5CG,KAAA5B,UAAUsB,YAAYG,EAAsB;EAACR,EAAA,KAAAQ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AAY/C,UAAU,CAAC,CAAAgD,SAAQ;IAG1C,MAAAC,YAAkBjB,YAAYH,GAAG;IACjC,IAAIoB,YAAY,GAGdL,UAAUf,IAAGa,cAAeO,YAAY,CAAC;GAC1C;GAEH,MAAAC,gBAAgB;IACdN,UAAU7B,KAAAA,CAAS;GAAC;GAEtB8B,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;EACA9C,KAAA,CAACgB,KAAKc,MAAM;EAACtC,EAAA,KAAAwB;EAAAxB,EAAA,KAAAsC;EAAAtC,EAAA,KAAAD;EAAAC,EAAA,KAAAQ;CAAA,OAAA;EAAAT,KAAAC,EAAA;EAAAQ,KAAAR,EAAA;CAAA;CArChBzB,gBAAgBwB,IAqCbS,EAAa;CAAC,OACV8B,WAAW5B,KAAAA;AAAS;AAE7BZ,cAAcyD,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`. 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,K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CAGE,MAAA,CAAAuD,QAAAC,aAA4BtD,SAA6B0B,KAAAA,CAAS;CAAE,IAAAX;CAAA,IAAAS;CAAA,IAAAR,EAAA,OAAAuB,OAAAvB,EAAA,OAAAqC,QAAA;EACpDtC,WAAA;GACd,IAAIwB,QAAQ,MAAI;GAGhB,MAAAgB,gBAAgB;IACd,IAAIF,WAAW3B,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"}
@@ -54,5 +54,4 @@ declare namespace NavigationRail {
54
54
  * component itself rather than a reference to a client one.
55
55
  */
56
56
  declare function NavigationRailItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>): import("react").JSX.Element;
57
- export { NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationRail as default };
58
- //# sourceMappingURL=index.d.ts.map
57
+ export { NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationRail as default };