@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","KeyboardEventHandler","ReactNode","RefAttributes","FocusableElement","Key","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","ToggleGroupState","stylex","createContext","createElement","useContext","useLayoutEffect","useState","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","LabelledByAttribute","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","GroupRender","Ripple","ReturnType","NonNullable","keyOf","segment","HTMLElement","written","dataset","key","undefined","JSON","parse","radioGroupRenderer","render","domProps","renderProps","merged","onKeyDownCapture","radioKeys","state","toolbar","HTMLDivElement","event","group","currentTarget","segments","querySelectorAll","filter","closest","from","findIndex","target","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","to","length","setSelected","rtl","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","PADDING_GIVE","md","FORCED_COLORS","styles","kgeoSG","kGOzcv","kpsdNU","kEoFBp","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k7Eaqz","k8WAf4","kg3NbH","kVAEAm","kIyJzY","k1ekBW","kAMwcw","$$css","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","spacer","kmuXW","kzqmXN","spacerHalf","spacerHolding","spacerIcon","SegmentedButtonProps","Omit","className","disallowEmptySelection","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","id","glyphFor","marked","isSelected","hasLabel","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","labelRef","element","HTMLSpanElement","labelTitle","labelled","reserves","glyph","drawn","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","t9","single","t10","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","label","setLabel","useTruncatedText","aria","disabledByGroup","stringify","handlers","segmentStyles","ring","text","setText","measure","cut","scrollWidth","clientWidth","textContent","resize","ResizeObserver","observe","relabel","MutationObserver","characterData","childList","subtree","disconnect","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps, ToggleGroupState } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, createElement, useContext, useLayoutEffect, useState } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { LabelledByAttribute } from '../../render/name';\nimport { CheckGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useToggleGroupDisabled } from '../../hooks/useToggleGroupDisabled';\nimport { ariaAttributesOf, toggleButtonRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The segmented buttons page's outlined segmented button: two to five\n// segments joined into one outlined track, of which one or several are\n// chosen. A segment is Button's default size and type role — a 40dp\n// container with a label-large label — which is what that page gives too.\n//\n// What a screen reader hears follows the selection mode, and React Aria\n// decides it rather than this component. Choosing one of the segments is a\n// radio group, so the track is a `radiogroup` and each segment a `radio`\n// reporting `aria-checked`; choosing several is a `toolbar` of buttons each\n// reporting `aria-pressed`. That is the right mapping for both, and it is\n// why the mode is a word on the group rather than two components.\n//\n// React Aria stops at the name, though: its single mode is announced as a\n// radio group and behaves as a toolbar. So that mode takes the rest of the\n// radio group pattern from the ARIA Authoring Practices, a deliberate\n// departure from React Aria's `ToggleButtonGroup`, in two parts. The chosen\n// segment cannot be pressed off, since a radio group always holds a choice\n// and the page's single-select set always keeps one segment chosen;\n// `disallowEmptySelection={false}` gives React Aria's default back. And the\n// arrow keys choose as they move, wrapping at either end, with Home and End\n// choosing the first and last segment. Under React Aria the arrows moved\n// focus alone and stopped at the ends, so a screen reader reached each radio\n// without it being checked, and choosing one took a separate Space. Choosing\n// several keeps React Aria's toolbar keys, where the arrows only move between\n// buttons and Space toggles one.\n//\n// Six things are this component's own.\n//\n// **The segments are one track, not a row of buttons.** Every segment\n// carries the page's 1dp outline, and each one after the first drops its\n// leading edge so neighbours share a single rule rather than drawing two\n// against each other. The outer ends are the page's fully rounded shape and\n// the inner joins are square.\n//\n// **Every segment is the same width.** The page gives the segment width as\n// the container's divided by their number, so the track is a grid of equal\n// columns; the container itself is still as wide as its widest label asks,\n// plus the room described next.\n//\n// **A chosen segment says so with a check.** The page draws it in the icon\n// slot, so a segment given an `icon` shows the icon while unselected and the\n// check once chosen. `showSelectedIcon` turns it off for a set whose labels\n// already read as chosen or not.\n//\n// Without the check, the page's chosen container is the only cue, and it is\n// about 1.2:1 against the page in the light theme, with the same label\n// colour either way — under WCAG's 3:1 for a state. So a set with the check\n// off draws its chosen segment on the secondary role instead, with the label\n// on it, which clears that comfortably. A departure from the page, taken\n// only where the page's own cue has been turned off; with the check drawn,\n// the chosen segment is the page's.\n//\n// A segment with an `icon` and no label is drawn that way whatever the set\n// says. It keeps its icon when chosen, since the icon is all that tells it\n// from its neighbours, and a check in its place would hide which of them is\n// the chosen one.\n//\n// Under forced colours a fill is painted in the page's own `Canvas`, so the\n// chosen container is `Highlight` with its label in `HighlightText` — the\n// pair the mode gives whatever is chosen — and a disabled chosen one keeps\n// a `GrayText` ring rather than a fill, which leaves its `GrayText` label\n// readable.\n//\n// Every segment that could ever draw that slot keeps room for it whether\n// or not it is drawing one. Sized by what it drew, the slot made the widest\n// segment whichever one was chosen, and the whole track changed width with\n// the choice — moving every label, and moving the ground under the chosen\n// container while it was sliding across it. The mechanism is Angular\n// Material's button toggle: the slot opens from 0 to 18dp and the space it\n// lands in opens beside it, both over `durationShort2`. Here that space is\n// two spacers either side of the label, which trade it between them: half\n// on each side while nothing is drawn, so a bare label stays centred, and\n// all of it on the leading side, where the slot sits, once something is.\n// Their total never changes, so neither does the segment's width. Angular\n// Material has no case of the first kind, since its toggles are sized by\n// their own content rather than by the widest of them.\n//\n// That room gives way before the label does. A track with room to spare is\n// the widest label plus 26dp per segment, which is what the widest column\n// already measured while its own segment was the chosen one. A track\n// squeezed below that — long labels on a phone — gives the reserve back\n// first, then the 4dp of the page's 12dp padding beyond the 8dp a segment\n// always keeps, and only then cuts a label short, with an ellipsis and a\n// `title` that shows it whole. A segment drawing a glyph keeps the glyph and\n// its 8dp gap, so the chosen label is the first to be cut. A label shows\n// whole in a segment 16dp wider than it, or 42dp while a glyph is drawn\n// beside it, plus the segment's rule. The track's width still never depends\n// on the choice: squeezed, its columns are the container's, shared equally.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\ntype GroupRender = RACToggleButtonGroupProps['render'];\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\n\n// A segment's key, back from the attribute `SegmentedButtonSegment` writes\n// it into. JSON rather than the key as written, so a numeric key comes back\n// a number and matches the one React Aria's selection holds.\nfunction keyOf(segment: HTMLElement): Key | null {\n const written = segment.dataset.key;\n if (written === undefined) {\n return null;\n }\n const key: unknown = JSON.parse(written);\n return typeof key === 'string' || typeof key === 'number' ? key : null;\n}\n\n// The group's element, with `radioKeys` in place of React Aria's keyboard\n// handler, then handed to the call site's own `render` if it passed one.\nfunction radioGroupRenderer(render: GroupRender): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to a segment\n// and choose it, wrapping at the ends and passing over a disabled segment,\n// which is what the toolbar's own handler would otherwise do with focus\n// alone. Everything else — Tab, and an arrow held with a modifier the\n// browser may want — is handed to the toolbar as before.\nfunction radioKeys(state: ToggleGroupState, toolbar: KeyboardEventHandler<HTMLDivElement> | undefined): KeyboardEventHandler<HTMLDivElement> {\n return event => {\n const group = event.currentTarget;\n const segments = [...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])')].filter(segment => segment.closest('[role=\"radiogroup\"]') === group);\n const from = segments.findIndex(segment => segment === event.target);\n const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === 'rtl');\n if (from === -1 || step === null) {\n toolbar?.(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const to = step === 'first' ? 0 : step === 'last' ? segments.length - 1 : (from + step + segments.length) % segments.length;\n const segment = segments[to];\n const key = keyOf(segment);\n if (key === null) {\n return;\n }\n segment.focus();\n state.setSelected(key, true);\n };\n}\n\n// Where a key moves the choice in a radio group: one segment on, one back,\n// or to either end. Right and left follow the direction the track is drawn\n// in, read off the track itself rather than the locale, so a `dir` on a\n// wrapper turns them over as it turns the track over; up and down, and Home\n// and End, follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown':\n {\n return 1;\n }\n case 'ArrowLeft':\n {\n return rtl ? 1 : -1;\n }\n case 'ArrowRight':\n {\n return rtl ? -1 : 1;\n }\n case 'ArrowUp':\n {\n return -1;\n }\n case 'End':\n {\n return 'last';\n }\n case 'Home':\n {\n return 'first';\n }\n default:\n {\n return null;\n }\n }\n}\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// plus the gap between it and the label. Half of that room sits on each side\n// of the label while nothing is drawn, which is what keeps a bare label\n// centred; see `labelReserved`.\nconst GLYPH_SIZE = '18px';\nconst GLYPH_RESERVE = `calc(${GLYPH_SIZE} + ${spacing.sm})`;\nconst GLYPH_RESERVE_HALF = `calc((${GLYPH_SIZE} + ${spacing.sm}) / 2)`;\n\n// The part of the page's 12dp padding a segment gives back on a narrow\n// track: the padding is 8dp, and the rest sits in the spacers, which shrink.\nconst PADDING_GIVE = `calc(${spacing.md} - ${spacing.sm})`;\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n segment: {\n \"--segment-indicator-radius-end\": \"x32u3vw x111hk5a\",\n \"--segment-indicator-radius-start\": \"xatjrgw x1syycwj\",\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x17kqlg\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kVAM5u: \"x1fwvt7v\",\n kT0f0o: \"x1fougng xkducg2\",\n kVL7Gh: \"x1prwiuu x1uwupfv\",\n k2ei4v: \"x120dh57 x14e42zd\",\n kfmiAY: \"x17hb1p4 x1a37zkv\",\n krdFHd: \"xwfph4i xb01x1j\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k7Eaqz: \"xeuugli\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xt3l3uh\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n segmentDisabled: {\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n segmentSelected: {\n kMwMTN: \"x1sawysd x1k5gbb1\",\n $$css: true\n },\n segmentSelectedUnmarked: {\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n segmentUnselected: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n spacer: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"xs83m0k\",\n kzqmXN: \"xbraz1g\",\n kjj79g: \"x13a6bvl\",\n k7Eaqz: \"xeuugli\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1pha8k4\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n spacerHalf: {\n kzqmXN: \"x154zo0h\",\n $$css: true\n },\n spacerHolding: {\n kzqmXN: \"x1n85vuq\",\n k7Eaqz: \"x36sgg7\",\n $$css: true\n },\n spacerIcon: {\n kzqmXN: \"x1iuy3mw\",\n k7Eaqz: \"x16xo4sp\",\n $$css: true\n }\n};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | 'disallowEmptySelection' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\n /**\n * Whether the chosen segment stays chosen when it is pressed again. On\n * by default while one is chosen, since a radio group always holds a\n * choice; `false` lets a press clear it, as React Aria's own default\n * does. Off by default while several may be, where any of them can be\n * turned off.\n * @default true while one is chosen, false while several may be\n */\n disallowEmptySelection?: boolean;\n /**\n * Whether a chosen segment draws a check before its label, as the page\n * has it. `false` leaves the segment's own icon in place while selected,\n * and draws the chosen segment on the stronger secondary container, since\n * the page's own is too faint to say which is chosen by itself.\n * @default true\n */\n showSelectedIcon?: boolean;\n /** A function may compute the style from the set's render state. */\n style?: RACToggleButtonGroupProps['style'];\n};\ntype SegmentedButtonSegmentProps = Omit<RACToggleButtonProps, 'children' | 'className' | 'id' | 'style'> & {\n /** The segment's label. */\n children?: ReactNode;\n /** A function may compute the class from the segment's render state. */\n className?: RACToggleButtonProps['className'];\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, in the page's 18dp size. Replaced by the check\n * while the segment is chosen, unless the set turns that off. An icon drawn\n * in `em` takes that size from the slot.\n *\n * Given with no label, the icon is the segment, centred in it and kept\n * while chosen; name the segment with `aria-label` then.\n */\n icon?: ReactNode;\n /**\n * The key selection is reported by. Required, because React Aria joins a\n * toggle to its group's selection by this key alone: a segment without one\n * keeps a pressed state of its own, so a set where one is chosen could hold\n * two, and it is announced as a pressed button rather than a radio.\n */\n id: Key;\n /** A function may compute the style from the segment's render state. */\n style?: RACToggleButtonProps['style'];\n};\n\n/**\n * What the glyph slot draws: the check on a chosen segment, or the segment's\n * own icon. `null` for a segment with neither, which leaves the slot empty\n * and closed rather than unrendered. Returns a node rather than letting the\n * type be inferred, since `ReactNode` is a union that includes a promise and\n * an inferred one has to be `async`.\n */\nfunction glyphFor(state: ToggleButtonRenderProps, icon: ReactNode, marked: boolean): ReactNode {\n if (state.isSelected && marked) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\n}\n\n// Whether a segment has a label, rather than an icon alone. An empty string\n// and a `false` from a condition at the call site are no label either.\nfunction hasLabel(children: ReactNode) {\n return children !== undefined && children !== null && children !== false && children !== '';\n}\n\n// The chosen container's class, from the segment's own state and the shared\n// element's. A function, because React Aria hands the indicator the entering\n// and leaving states the fade is drawn from, and those are the only two the\n// element knows about itself.\nfunction indicatorClassName(isDisabled: boolean, selectionMode: SelectionMode, marked: boolean): (state: SharedElementRenderProps) => string {\n return state => ({\n 0: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd\"\n },\n 8: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7\"\n },\n 4: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4\"\n },\n 12: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4\"\n },\n 2: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 10: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 6: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 14: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 1: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk\"\n },\n 9: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk\"\n },\n 5: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4 xg01cxk\"\n },\n 13: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4 xg01cxk\"\n },\n 3: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 11: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 7: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 15: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n }\n })[!!(selectionMode === 'multiple') << 3 | !!!marked << 2 | !!isDisabled << 1 | !!(state.isEntering || state.isExiting) << 0].className ?? '';\n}\n\n// What a segment 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 segmentContent(children: ReactNode, icon: ReactNode, ripple: Ripple, selectionMode: SelectionMode, marked: boolean, labelRef: (element: HTMLSpanElement | null) => void, labelTitle: string | undefined) {\n const labelled = hasLabel(children);\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track.\n const reserves = marked || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, marked);\n const drawn = glyph !== null;\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, marked)} />\n <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi xg01cxk x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4\"\n },\n 4: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xe2qvxb\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 6: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 1: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 5: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 3: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 7: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n }\n }[!!state.isHovered << 2 | !!state.isFocusVisible << 1 | !!state.isPressed << 0]} />\n <span {...stylex.props(styles.spacer, reserves && (drawn ? labelled ? styles.spacerHolding : styles.spacerIcon : styles.spacerHalf))}>\n {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1nsf9p3\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a x1nsf9p3\"\n }\n }[!!drawn << 1 | !!(drawn && labelled) << 0]}>\n {glyph}\n </span>}\n </span>\n {labelled && <span ref={labelRef} title={labelTitle} {...{\n 0: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft\"\n },\n 2: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8\"\n },\n 1: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1g12otp\"\n },\n 3: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8 x1g12otp\"\n }\n }[!!drawn << 1 | !!(state.isSelected && !state.isDisabled) << 0]}>\n {children}\n </span>}\n <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k xbraz1g x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7 x154zo0h\"\n }\n }[!!(reserves && !drawn) << 0]} />\n {ripple.surface}\n </>;\n };\n}\n\n/**\n * A row of two to five joined segments, of which one — or with\n * `selectionMode=\"multiple\"`, several — is chosen. Selection is React Aria's:\n * pass `selectedKeys` with `onSelectionChange` to control it, or\n * `defaultSelectedKeys` to let it keep its own. Give every segment an `id`,\n * which is the key selection is reported by.\n *\n * ```tsx\n * <SegmentedButton aria-label=\"Label\" defaultSelectedKeys={['first']}>\n * <SegmentedButton.Segment id=\"first\">First item</SegmentedButton.Segment>\n * <SegmentedButton.Segment id=\"second\">Second item</SegmentedButton.Segment>\n * </SegmentedButton>\n * ```\n *\n * Name the set with `aria-label` or `aria-labelledby`, one of which the\n * props require — nothing here labels it for you, and a set with no name is\n * a group a screen reader cannot announce. What it is announced as follows the selection mode: choosing one\n * is a radio group, choosing several a toolbar of two-state buttons. So does\n * how the chosen container moves: it slides between segments while one is\n * chosen, and fades in place while several may be.\n *\n * Choosing one behaves as a radio group too, which React Aria's\n * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is\n * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys\n * move to a segment and choose it, wrapping at either end, and Home and End\n * choose the first and last. Choosing several keeps React Aria's keys: the\n * arrows move between segments, and Space or Enter toggles the focused one.\n *\n * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n disallowEmptySelection,\n render,\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n const single = selectionMode === 'single';\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} disallowEmptySelection={disallowEmptySelection ?? single} render={single ? radioGroupRenderer(render) : render} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n // Whether this segment draws the check when chosen: the set's choice,\n // unless the segment has no label — see the header.\n const marked = useContext(ShowSelectedIconContext) && hasLabel(children);\n const [label, setLabel] = useState<HTMLSpanElement | null>(null);\n const labelTitle = useTruncatedText(label);\n // The `aria-*` props React Aria would drop and the keyboard handlers it\n // would wrap go on the element itself, as they do on Chip, Button and\n // IconButton; see src/render/aria.tsx.\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n // Off while disabled, as in Button: a control that cannot be pressed\n // should not answer a press with an animation. A disabled set disables\n // its segments through React Aria's group state rather than their props,\n // so the group is read as well.\n const disabledByGroup = useToggleGroupDisabled(props.id);\n // The call site's pointer handlers go through the ripple, which calls\n // them after its own. Spread beside the ripple's, one of the two sets\n // would write over the other.\n const ripple = useRipple<FocusableElement>(!disableRipple && props.isDisabled !== true && !disabledByGroup, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n return <RACToggleButton\n // The key the radio group's arrow keys choose this segment by; see\n // `radioKeys`. React Aria keeps a segment's key off its element.\n data-key={selectionMode === 'single' ? JSON.stringify(props.id) : undefined} render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(marked), props)}>\n {segmentContent(children, icon, ripple, selectionMode, marked, setLabel, labelTitle)}\n </RACToggleButton>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// segment's state comes from the render state React Aria hands its\n// className. `disabled` is applied last so its label colour wins over both\n// of the others. Built by a call, since a set that draws no check labels its\n// chosen segment for the container it draws instead.\nfunction segmentStyles(marked: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !marked && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\n\n// The text of a label its segment is cutting short, for a `title` that shows\n// it whole; undefined while it fits. Measured again whenever the label's box\n// or its text changes, which is when it can start or stop being cut.\nfunction useTruncatedText(label: HTMLElement | null): string | undefined {\n const [text, setText] = useState<string | undefined>(undefined);\n useLayoutEffect(() => {\n if (label === null) {\n return undefined;\n }\n const measure = () => {\n const cut = label.scrollWidth > label.clientWidth;\n setText(cut && label.textContent !== '' ? label.textContent : undefined);\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(label);\n const relabel = new MutationObserver(measure);\n relabel.observe(label, {\n characterData: true,\n childList: true,\n subtree: true\n });\n return () => {\n resize.disconnect();\n relabel.disconnect();\n };\n }, [label]);\n return text;\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\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;CAAA;CArBVjK,gBAAgBgK,IAqBbK,EAAO;CAAC,OACJ6B;AAAI;AAEbnC,gBAAgBmD,UAAUlC"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","createContext","createElement","useContext","useEffect","useLayoutEffect","useState","RACToggleButton","RACToggleButtonGroup","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","spacing","ShowSelectedIconContext","SelectionModeContext","CrowdingContext","crowded","report","undefined","key","keyOf","segment","written","dataset","JSON","parse","radioGroupRenderer","render","domProps","renderProps","merged","onKeyDownCapture","radioKeys","state","toolbar","event","group","currentTarget","segments","querySelectorAll","filter","closest","from","findIndex","target","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","length","setSelected","rtl","sm","md","styles","kgeoSG","kGOzcv","kpsdNU","kEoFBp","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k7Eaqz","k8WAf4","kg3NbH","kVAEAm","kIyJzY","k1ekBW","kAMwcw","$$css","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","spacer","kmuXW","kzqmXN","spacerHalf","spacerHolding","spacerIcon","className","disallowEmptySelection","showSelectedIcon","style","children","disableRipple","icon","id","glyphFor","marked","isSelected","hasLabel","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","labelRef","element","labelTitle","labelled","reserves","checks","shown","glyph","drawn","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","t1","t2","single","crowding","setCrowding","NONE_CROWDED","t3","Symbol","for","crowds","current","has","next","Set","add","delete","size","t4","crowdingValue","T0","T1","T2","T3","t5","t6","t7","t8","t9","t10","t11","title","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","label","setLabel","fit","useLabelFit","aria","disabledByGroup","stringify","handlers","segmentStyles","ring","setFit","FITS","parentElement","measure","scrollWidth","clientWidth","textContent","textWidthOf","Number","parseFloat","scrollMarginInlineStart","contentWidthOf","resize","ResizeObserver","observe","relabel","MutationObserver","characterData","childList","subtree","document","fonts","addEventListener","disconnect","removeEventListener","getBoundingClientRect","width","borderInlineStartWidth","borderInlineEndWidth","paddingInlineStart","paddingInlineEnd","reduce","sum","range","createRange","selectNodeContents","Segment","RACSelectionIndicator"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps, ToggleGroupState } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, createElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { LabelledByAttribute } from '../../render/name';\nimport { CheckGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useToggleGroupDisabled } from '../../hooks/useToggleGroupDisabled';\nimport { ariaAttributesOf, toggleButtonRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The segmented buttons page's outlined segmented button: two to five\n// segments joined into one outlined track, of which one or several are\n// chosen. A segment is Button's default size and type role — a 40dp\n// container with a label-large label — which is what that page gives too.\n//\n// What a screen reader hears follows the selection mode, and React Aria\n// decides it rather than this component. Choosing one of the segments is a\n// radio group, so the track is a `radiogroup` and each segment a `radio`\n// reporting `aria-checked`; choosing several is a `toolbar` of buttons each\n// reporting `aria-pressed`. That is the right mapping for both, and it is\n// why the mode is a word on the group rather than two components.\n//\n// React Aria stops at the name, though: its single mode is announced as a\n// radio group and behaves as a toolbar. So that mode takes the rest of the\n// radio group pattern from the ARIA Authoring Practices, a deliberate\n// departure from React Aria's `ToggleButtonGroup`, in two parts. The chosen\n// segment cannot be pressed off, since a radio group always holds a choice\n// and the page's single-select set always keeps one segment chosen;\n// `disallowEmptySelection={false}` gives React Aria's default back. And the\n// arrow keys choose as they move, wrapping at either end, with Home and End\n// choosing the first and last segment. Under React Aria the arrows moved\n// focus alone and stopped at the ends, so a screen reader reached each radio\n// without it being checked, and choosing one took a separate Space. Choosing\n// several keeps React Aria's toolbar keys, where the arrows only move between\n// buttons and Space toggles one.\n//\n// Six things are this component's own.\n//\n// **The segments are one track, not a row of buttons.** Every segment\n// carries the page's 1dp outline, and each one after the first drops its\n// leading edge so neighbours share a single rule rather than drawing two\n// against each other. The outer ends are the page's fully rounded shape and\n// the inner joins are square.\n//\n// **Every segment is the same width.** The page gives the segment width as\n// the container's divided by their number, so the track is a grid of equal\n// columns; the container itself is still as wide as its widest label asks,\n// plus the room described next.\n//\n// **A chosen segment says so with a check.** The page draws it in the icon\n// slot, so a segment given an `icon` shows the icon while unselected and the\n// check once chosen. `showSelectedIcon` turns it off for a set whose labels\n// already read as chosen or not.\n//\n// Without the check, the page's chosen container is the only cue, and it is\n// about 1.2:1 against the page in the light theme, with the same label\n// colour either way — under WCAG's 3:1 for a state. So a set with the check\n// off draws its chosen segment on the secondary role instead, with the label\n// on it, which clears that comfortably. A departure from the page, taken\n// only where the page's own cue has been turned off; with the check drawn,\n// the chosen segment is the page's.\n//\n// A segment with an `icon` and no label is drawn that way whatever the set\n// says. It keeps its icon when chosen, since the icon is all that tells it\n// from its neighbours, and a check in its place would hide which of them is\n// the chosen one.\n//\n// Under forced colours a fill is painted in the page's own `Canvas`, so the\n// chosen container is `Highlight` with its label in `HighlightText` — the\n// pair the mode gives whatever is chosen — and a disabled chosen one keeps\n// a `GrayText` ring rather than a fill, which leaves its `GrayText` label\n// readable.\n//\n// Every segment that could ever draw that slot keeps room for it whether\n// or not it is drawing one. Sized by what it drew, the slot made the widest\n// segment whichever one was chosen, and the whole track changed width with\n// the choice — moving every label, and moving the ground under the chosen\n// container while it was sliding across it. The mechanism is Angular\n// Material's button toggle: the slot opens from 0 to 18dp and the space it\n// lands in opens beside it, both over `durationShort2`. Here that space is\n// two spacers either side of the label, which trade it between them: half\n// on each side while nothing is drawn, so a bare label stays centred, and\n// all of it on the leading side, where the slot sits, once something is.\n// Their total never changes, so neither does the segment's width. Angular\n// Material has no case of the first kind, since its toggles are sized by\n// their own content rather than by the widest of them.\n//\n// That room gives way before the label does. A track with room to spare is\n// the widest label plus 26dp per segment, which is what the widest column\n// already measured while its own segment was the chosen one. A track\n// squeezed below that — long labels on a phone — gives the reserve back\n// first, then the 4dp of the page's 12dp padding beyond the 8dp a segment\n// always keeps, and then the glyphs themselves. A label shows whole in a\n// segment 16dp wider than it, or 42dp while a glyph is drawn beside it, plus\n// the segment's rule, so on a phone a check or an icon is what cuts a label\n// that would otherwise fit. Once any segment's label would be cut beside its\n// glyph, the whole set stops drawing them: no check and no icons, and the\n// chosen segment on the stronger container a set without a check draws, so\n// the choice still reads. The whole set rather than the one segment, since a\n// set choosing several would otherwise draw one chosen segment one way and\n// the next another. And any segment rather than the chosen one, since a\n// check that would cut a label only once its segment is chosen is the same\n// cut a moment later, and choosing should not turn the glyphs off or on.\n// Only past that is a label cut short, with an ellipsis\n// and a `title` that shows it whole. The track's width still never depends\n// on the choice: squeezed, its columns are the container's, shared equally,\n// and the glyphs giving way frees room inside them without moving them.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\n\n// Whether the set has stopped drawing glyphs because one would cut a label,\n// and how a segment says whether its own would. The segments measure, since\n// each holds its own label; the set decides, since the decision is the whole\n// set's. See the header.\nconst CrowdingContext = createContext<Crowding>({\n crowded: false,\n report: () => undefined\n});\ninterface Crowding {\n crowded: boolean;\n report: (key: Key, crowded: boolean) => void;\n}\ntype GroupRender = RACToggleButtonGroupProps['render'];\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\n\n// A segment's key, back from the attribute `SegmentedButtonSegment` writes\n// it into. JSON rather than the key as written, so a numeric key comes back\n// a number and matches the one React Aria's selection holds.\nfunction keyOf(segment: HTMLElement): Key | null {\n const written = segment.dataset.key;\n if (written === undefined) {\n return null;\n }\n const key: unknown = JSON.parse(written);\n return typeof key === 'string' || typeof key === 'number' ? key : null;\n}\n\n// The group's element, with `radioKeys` in place of React Aria's keyboard\n// handler, then handed to the call site's own `render` if it passed one.\nfunction radioGroupRenderer(render: GroupRender): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to a segment\n// and choose it, wrapping at the ends and passing over a disabled segment,\n// which is what the toolbar's own handler would otherwise do with focus\n// alone. Everything else — Tab, and an arrow held with a modifier the\n// browser may want — is handed to the toolbar as before.\nfunction radioKeys(state: ToggleGroupState, toolbar: KeyboardEventHandler<HTMLDivElement> | undefined): KeyboardEventHandler<HTMLDivElement> {\n return event => {\n const group = event.currentTarget;\n const segments = [...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])')].filter(segment => segment.closest('[role=\"radiogroup\"]') === group);\n const from = segments.findIndex(segment => segment === event.target);\n const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === 'rtl');\n if (from === -1 || step === null) {\n toolbar?.(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const to = step === 'first' ? 0 : step === 'last' ? segments.length - 1 : (from + step + segments.length) % segments.length;\n const segment = segments[to];\n const key = keyOf(segment);\n if (key === null) {\n return;\n }\n segment.focus();\n state.setSelected(key, true);\n };\n}\n\n// Where a key moves the choice in a radio group: one segment on, one back,\n// or to either end. Right and left follow the direction the track is drawn\n// in, read off the track itself rather than the locale, so a `dir` on a\n// wrapper turns them over as it turns the track over; up and down, and Home\n// and End, follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown':\n {\n return 1;\n }\n case 'ArrowLeft':\n {\n return rtl ? 1 : -1;\n }\n case 'ArrowRight':\n {\n return rtl ? -1 : 1;\n }\n case 'ArrowUp':\n {\n return -1;\n }\n case 'End':\n {\n return 'last';\n }\n case 'Home':\n {\n return 'first';\n }\n default:\n {\n return null;\n }\n }\n}\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// plus the gap between it and the label. Half of that room sits on each side\n// of the label while nothing is drawn, which is what keeps a bare label\n// centred; see `labelReserved`.\nconst GLYPH_SIZE = '18px';\nconst GLYPH_RESERVE = `calc(${GLYPH_SIZE} + ${spacing.sm})`;\nconst GLYPH_RESERVE_HALF = `calc((${GLYPH_SIZE} + ${spacing.sm}) / 2)`;\n\n// The part of the page's 12dp padding a segment gives back on a narrow\n// track: the padding is 8dp, and the rest sits in the spacers, which shrink.\nconst PADDING_GIVE = `calc(${spacing.md} - ${spacing.sm})`;\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n segment: {\n \"--segment-indicator-radius-end\": \"x32u3vw x111hk5a\",\n \"--segment-indicator-radius-start\": \"xatjrgw x1syycwj\",\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x17kqlg\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kVAM5u: \"x1fwvt7v\",\n kT0f0o: \"x1fougng xkducg2\",\n kVL7Gh: \"x1prwiuu x1uwupfv\",\n k2ei4v: \"x120dh57 x14e42zd\",\n kfmiAY: \"x17hb1p4 x1a37zkv\",\n krdFHd: \"xwfph4i xb01x1j\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k7Eaqz: \"xeuugli\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xt3l3uh\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n segmentDisabled: {\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n segmentSelected: {\n kMwMTN: \"x1sawysd x1k5gbb1\",\n $$css: true\n },\n segmentSelectedUnmarked: {\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n segmentUnselected: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n spacer: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"xs83m0k\",\n kzqmXN: \"xbraz1g\",\n kjj79g: \"x13a6bvl\",\n k7Eaqz: \"xeuugli\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1pha8k4\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n spacerHalf: {\n kzqmXN: \"x154zo0h\",\n $$css: true\n },\n spacerHolding: {\n kzqmXN: \"x1n85vuq\",\n k7Eaqz: \"x36sgg7\",\n $$css: true\n },\n spacerIcon: {\n kzqmXN: \"x1iuy3mw\",\n k7Eaqz: \"x16xo4sp\",\n $$css: true\n }\n};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | 'disallowEmptySelection' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\n /**\n * Whether the chosen segment stays chosen when it is pressed again. On\n * by default while one is chosen, since a radio group always holds a\n * choice; `false` lets a press clear it, as React Aria's own default\n * does. Off by default while several may be, where any of them can be\n * turned off.\n * @default true while one is chosen, false while several may be\n */\n disallowEmptySelection?: boolean;\n /**\n * Whether a chosen segment draws a check before its label, as the page\n * has it. `false` leaves the segment's own icon in place while selected,\n * and draws the chosen segment on the stronger secondary container, since\n * the page's own is too faint to say which is chosen by itself.\n * @default true\n */\n showSelectedIcon?: boolean;\n /** A function may compute the style from the set's render state. */\n style?: RACToggleButtonGroupProps['style'];\n};\ntype SegmentedButtonSegmentProps = Omit<RACToggleButtonProps, 'children' | 'className' | 'id' | 'style'> & {\n /** The segment's label. */\n children?: ReactNode;\n /** A function may compute the class from the segment's render state. */\n className?: RACToggleButtonProps['className'];\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, in the page's 18dp size. Replaced by the check\n * while the segment is chosen, unless the set turns that off. An icon drawn\n * in `em` takes that size from the slot.\n *\n * Given with no label, the icon is the segment, centred in it and kept\n * while chosen; name the segment with `aria-label` then.\n */\n icon?: ReactNode;\n /**\n * The key selection is reported by. Required, because React Aria joins a\n * toggle to its group's selection by this key alone: a segment without one\n * keeps a pressed state of its own, so a set where one is chosen could hold\n * two, and it is announced as a pressed button rather than a radio.\n */\n id: Key;\n /** A function may compute the style from the segment's render state. */\n style?: RACToggleButtonProps['style'];\n};\n\n/**\n * What the glyph slot draws: the check on a chosen segment, or the segment's\n * own icon. `null` for a segment with neither, which leaves the slot empty\n * and closed rather than unrendered. Returns a node rather than letting the\n * type be inferred, since `ReactNode` is a union that includes a promise and\n * an inferred one has to be `async`.\n */\nfunction glyphFor(state: ToggleButtonRenderProps, icon: ReactNode, marked: boolean): ReactNode {\n if (state.isSelected && marked) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\n}\n\n// Whether a segment has a label, rather than an icon alone. An empty string\n// and a `false` from a condition at the call site are no label either.\nfunction hasLabel(children: ReactNode) {\n return children !== undefined && children !== null && children !== false && children !== '';\n}\n\n// The chosen container's class, from the segment's own state and the shared\n// element's. A function, because React Aria hands the indicator the entering\n// and leaving states the fade is drawn from, and those are the only two the\n// element knows about itself.\nfunction indicatorClassName(isDisabled: boolean, selectionMode: SelectionMode, marked: boolean): (state: SharedElementRenderProps) => string {\n return state => ({\n 0: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd\"\n },\n 8: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7\"\n },\n 4: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4\"\n },\n 12: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4\"\n },\n 2: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 10: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 6: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 14: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 1: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk\"\n },\n 9: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk\"\n },\n 5: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4 xg01cxk\"\n },\n 13: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4 xg01cxk\"\n },\n 3: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 11: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 7: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 15: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n }\n })[!!(selectionMode === 'multiple') << 3 | !!!marked << 2 | !!isDisabled << 1 | !!(state.isEntering || state.isExiting) << 0].className ?? '';\n}\n\n// What a segment 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 segmentContent(children: ReactNode, icon: ReactNode, ripple: Ripple, selectionMode: SelectionMode, marked: boolean, crowded: boolean, labelRef: (element: HTMLSpanElement | null) => void, labelTitle: string | undefined) {\n const labelled = hasLabel(children);\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track. Read from the set's choice rather than from\n // what is drawn now, so a crowded set keeps the same reserve to give back.\n const reserves = marked || icon !== undefined;\n // A crowded set draws no glyph beside a label, and its chosen container is\n // the one a set without a check draws. An icon alone is untouched.\n const checks = marked && !crowded;\n const shown = crowded && labelled ? undefined : icon;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, shown, checks);\n const drawn = glyph !== null;\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, checks)} />\n <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi xg01cxk x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4\"\n },\n 4: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xe2qvxb\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 6: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 1: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 5: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 3: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 7: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n }\n }[!!state.isHovered << 2 | !!state.isFocusVisible << 1 | !!state.isPressed << 0]} />\n <span {...stylex.props(styles.spacer, reserves && (drawn ? labelled ? styles.spacerHolding : styles.spacerIcon : styles.spacerHalf))}>\n {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1nsf9p3\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a x1nsf9p3\"\n }\n }[!!drawn << 1 | !!(drawn && labelled) << 0]}>\n {glyph}\n </span>}\n </span>\n {labelled && <span ref={labelRef} title={labelTitle} {...{\n 0: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft\"\n },\n 2: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8\"\n },\n 1: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1g12otp\"\n },\n 3: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8 x1g12otp\"\n }\n }[!!drawn << 1 | !!(state.isSelected && !state.isDisabled) << 0]}>\n {children}\n </span>}\n <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k xbraz1g x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7 x154zo0h\"\n }\n }[!!(reserves && !drawn) << 0]} />\n {ripple.surface}\n </>;\n };\n}\n\n/**\n * A row of two to five joined segments, of which one — or with\n * `selectionMode=\"multiple\"`, several — is chosen. Selection is React Aria's:\n * pass `selectedKeys` with `onSelectionChange` to control it, or\n * `defaultSelectedKeys` to let it keep its own. Give every segment an `id`,\n * which is the key selection is reported by.\n *\n * ```tsx\n * <SegmentedButton aria-label=\"Label\" defaultSelectedKeys={['first']}>\n * <SegmentedButton.Segment id=\"first\">First item</SegmentedButton.Segment>\n * <SegmentedButton.Segment id=\"second\">Second item</SegmentedButton.Segment>\n * </SegmentedButton>\n * ```\n *\n * Name the set with `aria-label` or `aria-labelledby`, one of which the\n * props require — nothing here labels it for you, and a set with no name is\n * a group a screen reader cannot announce. What it is announced as follows the selection mode: choosing one\n * is a radio group, choosing several a toolbar of two-state buttons. So does\n * how the chosen container moves: it slides between segments while one is\n * chosen, and fades in place while several may be.\n *\n * Choosing one behaves as a radio group too, which React Aria's\n * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is\n * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys\n * move to a segment and choose it, wrapping at either end, and Home and End\n * choose the first and last. Choosing several keeps React Aria's keys: the\n * arrows move between segments, and Space or Enter toggles the focused one.\n *\n * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n disallowEmptySelection,\n render,\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n const single = selectionMode === 'single';\n // The segments whose label a glyph would cut, by key. The set is crowded\n // while it holds any.\n const [crowding, setCrowding] = useState<ReadonlySet<Key>>(NONE_CROWDED);\n // Kept the same across renders, so a segment's report does not run again\n // each time the set's answer changes.\n const report = useCallback((key: Key, crowds: boolean) => {\n setCrowding(current => {\n if (current.has(key) === crowds) {\n return current;\n }\n const next = new Set(current);\n if (crowds) {\n next.add(key);\n } else {\n next.delete(key);\n }\n return next;\n });\n }, []);\n const crowded = crowding.size > 0;\n const crowdingValue = useMemo(() => ({\n crowded,\n report\n }), [crowded, report]);\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <CrowdingContext value={crowdingValue}>\n <RACToggleButtonGroup {...props} disallowEmptySelection={disallowEmptySelection ?? single} render={single ? radioGroupRenderer(render) : render} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </CrowdingContext>\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\nconst NONE_CROWDED: ReadonlySet<Key> = new Set();\ninterface LabelFit {\n crowds: boolean;\n title: string | undefined;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n // Whether this segment draws the check when chosen: the set's choice,\n // unless the segment has no label — see the header.\n const marked = useContext(ShowSelectedIconContext) && hasLabel(children);\n const [label, setLabel] = useState<HTMLSpanElement | null>(null);\n const fit = useLabelFit(label);\n const {\n crowded,\n report\n } = useContext(CrowdingContext);\n // Each segment tells the set whether its own glyph would cut its label,\n // and takes the answer back for the whole set. Only a segment that could\n // ever draw one says so: a long label beside a slot it never fills is not\n // a reason for its neighbours to drop theirs. Withdrawn as the segment\n // goes, so a set that loses its one crowded segment draws glyphs again.\n const crowds = fit.crowds && (marked || icon !== undefined);\n useEffect(() => {\n report(props.id, crowds);\n return () => {\n report(props.id, false);\n };\n }, [crowds, props.id, report]);\n // The `aria-*` props React Aria would drop and the keyboard handlers it\n // would wrap go on the element itself, as they do on Chip, Button and\n // IconButton; see src/render/aria.tsx.\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n // Off while disabled, as in Button: a control that cannot be pressed\n // should not answer a press with an animation. A disabled set disables\n // its segments through React Aria's group state rather than their props,\n // so the group is read as well.\n const disabledByGroup = useToggleGroupDisabled(props.id);\n // The call site's pointer handlers go through the ripple, which calls\n // them after its own. Spread beside the ripple's, one of the two sets\n // would write over the other.\n const ripple = useRipple<FocusableElement>(!disableRipple && props.isDisabled !== true && !disabledByGroup, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n return <RACToggleButton\n // The key the radio group's arrow keys choose this segment by; see\n // `radioKeys`. React Aria keeps a segment's key off its element.\n data-key={selectionMode === 'single' ? JSON.stringify(props.id) : undefined} render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(marked && !crowded), props)}>\n {segmentContent(children, icon, ripple, selectionMode, marked, crowded, setLabel, fit.title)}\n </RACToggleButton>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// segment's state comes from the render state React Aria hands its\n// className. `disabled` is applied last so its label colour wins over both\n// of the others. Built by a call, since a set that draws no check labels its\n// chosen segment for the container it draws instead.\nfunction segmentStyles(marked: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !marked && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\n\n// Two readings of a label against its segment. `title` is the label's text\n// while the segment is cutting it short, for a `title` that shows it whole,\n// and undefined while it fits. `crowds` is whether the label would be cut\n// beside a glyph, which is what the set stops drawing glyphs for.\n//\n// `crowds` compares the label's own width with the segment's content box\n// less the glyph's room, and neither of those depends on whether a glyph is\n// drawn, so the set dropping its glyphs cannot flip the answer back. The\n// label's width is read off a range over its text rather than its\n// `scrollWidth`, which rounds up to a whole pixel and would call a label\n// that fits by a fraction cut.\n//\n// Measured again whenever the label's box, the segment's box or the label's\n// text changes, and once the fonts arrive, since a label still held at the\n// segment's width keeps its box while its text grows or shrinks inside it.\nfunction useLabelFit(label: HTMLElement | null): LabelFit {\n const [fit, setFit] = useState<LabelFit>(FITS);\n useLayoutEffect(() => {\n const segment = label?.parentElement;\n if (label === null || segment === null || segment === undefined) {\n return undefined;\n }\n const measure = () => {\n const cut = label.scrollWidth > label.clientWidth;\n const title = cut && label.textContent !== '' ? label.textContent : undefined;\n const crowds = textWidthOf(label) + Number.parseFloat(getComputedStyle(label).scrollMarginInlineStart) > contentWidthOf(segment);\n setFit(current => current.title === title && current.crowds === crowds ? current : {\n crowds,\n title\n });\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(label);\n resize.observe(segment);\n const relabel = new MutationObserver(measure);\n relabel.observe(label, {\n characterData: true,\n childList: true,\n subtree: true\n });\n document.fonts.addEventListener('loadingdone', measure);\n return () => {\n resize.disconnect();\n relabel.disconnect();\n document.fonts.removeEventListener('loadingdone', measure);\n };\n }, [label]);\n return fit;\n}\nconst FITS: LabelFit = {\n crowds: false,\n title: undefined\n};\n\n// The width a segment lays its label out in: its box less its rule and its\n// padding, the box the label's `100%` resolves against.\nfunction contentWidthOf(segment: HTMLElement) {\n const style = getComputedStyle(segment);\n return segment.getBoundingClientRect().width - [style.borderInlineStartWidth, style.borderInlineEndWidth, style.paddingInlineStart, style.paddingInlineEnd].reduce((sum, length) => sum + Number.parseFloat(length), 0);\n}\n\n// How wide a label's text is laid out, whether or not the label shows it\n// all: a range measures the text's own boxes, which run on past a label\n// that clips them.\nfunction textWidthOf(label: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(label);\n return range.getBoundingClientRect().width;\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default SegmentedButton;"],"mappings":";;;;;;;;;;;;;;AAwKA,MAAMiB,0BAA0Bf,cAAc,IAAI;AAKlD,MAAMgB,uBAAuBhB,cAA6B,QAAQ;AAMlE,MAAMiB,kBAAkBjB,cAAwB;CAC9CkB,SAAS;CACTC,cAAcC,KAAAA;AAChB,CAAC;AAYD,SAASE,MAAMC,SAAkC;CAC/C,MAAMC,UAAUD,QAAQE,QAAQJ;CAChC,IAAIG,YAAYJ,KAAAA,GACd,OAAO;CAET,MAAMC,MAAeK,KAAKC,MAAMH,OAAO;CACvC,OAAO,OAAOH,QAAQ,YAAY,OAAOA,QAAQ,WAAWA,MAAM;AACpE;AAIA,SAASO,mBAAmBC,QAA+C;CACzE,QAAQC,UAAUC,gBAAgB;EAChC,MAAMC,SAAS;GACb,GAAGF;GACHG,kBAAkBC,UAAUH,YAAYI,OAAOL,SAASG,gBAAgB;EAC1E;EACA,OAAOJ,WAAWT,KAAAA,IAAYnB,cAAc,OAAO+B,MAAM,IAAIH,OAAOG,QAAQD,WAAW;CACzF;AACF;AAQA,SAASG,UAAUC,OAAyBC,SAAiG;CAC3I,QAAOC,UAAS;EACd,MAAMC,QAAQD,MAAME;EACpB,MAAMC,WAAW,CAAC,GAAGF,MAAMG,iBAA8B,iCAAiC,CAAC,CAAC,CAACC,QAAOnB,YAAWA,QAAQoB,QAAQ,uBAAqB,MAAML,KAAK;EAC/J,MAAMM,OAAOJ,SAASK,WAAUtB,YAAWA,YAAYc,MAAMS,MAAM;EACnE,MAAMC,OAAOV,MAAMW,UAAUX,MAAMY,WAAWZ,MAAMa,UAAU,OAAOC,OAAOd,MAAMhB,KAAK+B,iB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element a layout positions.
82
82
  */
83
83
  declare function Select$1<T extends object = object>({ container, description, error, floatingLabel, isDisabled, label, leadingIcon, options, variant, ...props }: RefAttributes<HTMLDivElement> & SelectProps$1<T>): import("react").JSX.Element;
84
- export { type SelectProps$1 as SelectProps, Select$1 as default };
85
- //# sourceMappingURL=index.d.ts.map
84
+ export { type SelectProps$1 as SelectProps, Select$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","RefObject","PopoverRenderProps","SelectProps","RACSelectProps","SelectRenderProps","stylex","useContext","useRef","Popover","RACPopover","Select","RACSelect","SelectValue","RACSelectValue","SelectStateContext","FieldVariant","FieldBox","FieldMessage","FieldTrigger","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","mergeStatefulStyles","overlay","popupOrigin","colors","motion","radii","spacing","ListBox","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","HTMLDivElement","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","stylex.props","Select","_c","props","RACSelect","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list 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 list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field 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 state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled}\n // Opening the list moves focus into it, out of the box, so the box\n // is told it is focused while the list is open — otherwise its label\n // fell back onto the placeholder the select still shows.\n isFocused={state.isOpen} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\nexport type { SelectProps };\nexport default Select;"],"mappings":";;;;;;;;;;;;;AAiDA,MAAMoC,UAAU,oBAAC,cAAD,CAAa,CAAA;AAC7B,SAASC,WAAWC,QAAiB;CACnC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDC,WAAW,6DACb;EACA,GAAG,EACDA,WAAW,4DACb;CACF,EAAE,CAAC,CAACD,UAAU,GAAG,CAAA;AACnB;AAKA,SAASE,cAAcC,OAA2B;CAChD,OAAOhC,MAAaoB,QAAQc,OAAOC,OAAOC,MAAMf,YAAYW,MAAMK,SAAS,CAAC,CAAC,CAACP,aAAa;AAC7F;AACA,MAAMK,SAAS,EACbC,MAAM;CACJE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AAA;CAAA,MAAAC,IAAAnE,EAAA,CAAA;CAAuB,MAAA,EAAAqF,cAAAnB;CAMrB,MAAAqB,iBADc9E,WAAWQ,kBACFuB,CAAK,EAAAgD,iBAA+BC,aAAKC,QAAzC,OAAoD;CAAE,IAAAtB;CAAA,IAAAD,EAAA,OAAAwB,OAAAC,IAAA,2BAAA,GAAA;EAEzExB,KAAA,oBAACgC,aAAD,CAAe,CAAA;EAAGjC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAkB,aAAAlB,EAAA,OAAAoB,eAAA;EADfjB,KAAA,oBAAC,YAAD;GAAuBe;GAA0BE;GACpDnB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAkB;EAAAlB,EAAA,KAAAoB;EAAApB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","useContext","useRef","Select","RACSelect","SelectStateContext","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","overlay","popupOrigin","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","description","error","floatingLabel","label","leadingIcon","options","variant","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list 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 list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field 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 state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled}\n // Opening the list moves focus into it, out of the box, so the box\n // is told it is focused while the list is open — otherwise its label\n // fell back onto the placeholder the select still shows.\n isFocused={state.isOpen} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\nexport type { SelectProps };\nexport default Select;"],"mappings":";;;;;;;;;;;;;AAiDA,MAAMa,UAAU,oBAAC,cAAD,CAAa,CAAA;AAC7B,SAASC,WAAWC,QAAiB;CACnC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDC,WAAW,6DACb;EACA,GAAG,EACDA,WAAW,4DACb;CACF,EAAE,CAAC,CAACD,UAAU,GAAG,CAAA;AACnB;AAKA,SAASE,cAAcC,OAA2B;CAChD,OAAOjB,MAAaU,QAAQS,OAAOC,OAA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EAAA,UAAU7B,QAAiB,CAAA;EACjB,CAAA;CACd,EAAA,CAAA;AACJ;;;;;;AAOA,SAAAqB,cAAAnB,IAAA;CAAA,MAAAC,IAAA1C,EAAA,CAAA;CAAuB,MAAA,EAAA2D,cAAAlB;CAMrB,MAAAoB,iBADc3D,WAAWI,kBACFY,CAAK,EAAA4C,iBAA+BC,aAAKC,QAAzC,OAAoD;CAAE,IAAArB;CAAA,IAAAD,EAAA,OAAAuB,OAAAC,IAAA,2BAAA,GAAA;EAEzEvB,KAAA,oBAAC0B,aAAD,CAAe,CAAA;EAAG3B,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAiB,aAAAjB,EAAA,OAAAmB,eAAA;EADfhB,KAAA,oBAAC,YAAD;GAAuBc;GAA0BE;GACpDlB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAiB;EAAAjB,EAAA,KAAAmB;EAAAnB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
@@ -72,5 +72,4 @@ type SeparatorProps$1 = {
72
72
  * different element, and `render` is React Aria's function form.
73
73
  */
74
74
  declare function Separator$1({ decorative, inset, orientation, render, ...props }: RefAttributes<HTMLElement> & SeparatorProps$1): import("react").JSX.Element;
75
- export { type SeparatorInset, type SeparatorProps$1 as SeparatorProps, Separator$1 as default };
76
- //# sourceMappingURL=index.d.ts.map
75
+ export { type SeparatorInset, type SeparatorProps$1 as SeparatorProps, Separator$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","RefAttributes","SeparatorProps","RACSeparatorProps","stylex","createElement","Separator","RACSeparator","SeparatorContext","useSlottedContext","mergeStyles","colors","spacing","FORCED_COLORS","styles","base","kWkggS","kMzoRj","kB7OPa","kmuXW","kogj98","$$css","horizontal","kZKoxP","kLZC3w","kPef9Z","kEafiO","kzqmXN","vertical","kSGwAc","kGJrpR","kVhnKS","k2ei4v","k1xSpc","kAzted","kXLuUW","horizontalInsets","both","k71WvV","keTefX","none","start","verticalInsets","k1K539","keoZOQ","insets","SeparatorInset","decorative","inset","orientation","Omit","decorativeRenderer","element","render","NonNullable","domProps","renderProps","hidden","undefined","role","t0","$","t1","t2","props","context","slot","resolved","requested","elementType","T0","t3","t4","t5","Separator","_c","props","RACSeparator","stylex.props"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { SeparatorProps as RACSeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement } from 'react';\nimport { Separator as RACSeparator, SeparatorContext, useSlottedContext } from 'react-aria-components';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own — the design system treats the two as one\n// decision, and a separator that drifted from the borders around it would\n// read as a mistake.\n//\n// Drawn as a background on a 1px box rather than as a border, so the rule is\n// the element itself. A border would leave the element's own box at zero\n// size, which makes it invisible to flex `gap` and to anything measuring it.\n// The horizontal element is an <hr>, which arrives with a border and a\n// margin of its own; both are zeroed here so it is the same 1px box a <div>\n// would be.\n//\n// Vertical takes its length from the flex or grid parent through\n// `alignSelf: stretch`, since a divider between two columns should match\n// whatever they turn out to be rather than being told a height at the call\n// site. Anywhere else there is nothing to stretch to, so it falls back to\n// `1em`, one line of the text around it, and sits in that line as an inline\n// block rather than breaking it: between two words in a paragraph it is a\n// short upright bar, rather than a 1px box with no height that draws\n// nothing. The divider page gives no length for a vertical rule standing on\n// its own, so the `1em` is this library's choice. Inside a flex or grid\n// parent the inline display is blockified and the floor sits below any\n// length the parent stretches it to, so neither changes the rule there.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The\n// page names them \"inset\" and \"middle-inset\"; the prop says `start` and\n// `both` instead, since `inset=\"inset\"` reads as nothing at all and the two\n// words say which ends move.\n//\n// The inset is drawn as a margin on the logical axis the rule runs along, so\n// it follows the writing mode and works for a vertical rule as well — the\n// page only draws horizontal ones, but a shortened vertical rule between two\n// columns is the same idea and would otherwise have to be written at the\n// call site. An inset rule's length is `100%` less its margins: a margin\n// sits outside the box, so a full-width rule with one would overflow its\n// parent by exactly the inset, and `auto` in its place gives an empty `<hr>`\n// a width only where the parent stretches it — in a flex row, or a parent\n// centring its children, the rule came out 0 wide and vanished.\n//\n// The orientation is resolved rather than defaulted eagerly, so a container\n// that sets one through React Aria's separator context reaches it. Toolbar\n// is what needs that: a rule between two controls in a row is vertical, and\n// a `Separator` written inside one should not have to say so. React Aria's\n// own `Toolbar` sets no such context — it puts the orientation on itself and\n// nothing else — so ours provides it, and this is the half that reads it.\nconst styles = {\n base: {\n kWkggS: \"x1l12bh\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n horizontal: {\n kZKoxP: \"xjm9jq1\",\n kLZC3w: \"x19dwuzr\",\n kPef9Z: \"x4z998w\",\n kEafiO: \"x1lym3mf\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n vertical: {\n kSGwAc: \"xkh2ocl\",\n kGJrpR: \"xjslfuv\",\n kVhnKS: \"x1gbqego\",\n k2ei4v: \"xjg5lhu\",\n k1xSpc: \"x1rg5ohu\",\n kzqmXN: \"x1i1rx1s\",\n kAzted: \"x1xaadd7\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\n\n// The page's 16dp, on whichever axis the rule runs along. The length is the\n// full-width rule's `100%` less the margins, which keeps the rule inside its\n// parent — a margin outside a 100% box overflows by the inset — and still\n// gives it a width in every layout, where `auto` gives an `<hr>` with no\n// content one only in a parent that stretches it.\nconst horizontalInsets = {\n both: {\n kzqmXN: \"x1n0idw\",\n k71WvV: \"xdf1gh2\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n kzqmXN: \"x1u7osep\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n }\n};\n\n// A vertical rule takes its length from the parent through `alignSelf`, so\n// the margin shortens it from the end it is on rather than moving it. The\n// `1em` floor is the rule's own length and the margins sit outside it: a\n// stretched rule is shortened down to the floor and no further, and one with\n// no parent to stretch to keeps its `1em` and takes the inset as space above\n// and below, since there is no length of the parent's for it to hold off.\nconst verticalInsets = {\n both: {\n k1K539: \"xxkrg4w\",\n keoZOQ: \"xwf6w2j\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n keoZOQ: \"xwf6w2j\",\n $$css: true\n }\n};\nconst insets = {\n horizontal: horizontalInsets,\n vertical: verticalInsets\n};\ntype SeparatorInset = 'both' | 'none' | 'start';\ntype SeparatorProps = {\n /**\n * Takes the rule out of the accessibility tree, for a divider that only\n * draws a line between things that already say where each starts — the\n * sections of a `DisclosureGroup`, or rows that are each a control. A\n * reader then hears nothing between them rather than \"separator\" at every\n * one. The rule draws the same either way.\n * @default false\n */\n decorative?: boolean;\n /**\n * How far the rule is held off the edges it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both`\n * holds it off each end, which is its middle-inset one. The inset follows\n * the writing mode rather than a fixed side.\n * @default 'none'\n */\n inset?: SeparatorInset;\n /**\n * Which way the rule runs. A vertical separator takes its length from a\n * flex or grid parent, and is one line of the text around it, `1em`, in\n * any other. Defaults to whatever the container asks for — a `Toolbar`\n * asks for the rule across its own direction — and to horizontal outside\n * one.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n} & Omit<RACSeparatorProps, 'orientation'>;\n\n// A rule taken out of the accessibility tree. React Aria passes on neither\n// `aria-hidden` nor `role` from a separator's props, and sets the separator\n// role itself, so the element is rewritten in its render function, after\n// both: hidden, with the role and orientation it would be announced by\n// dropped. A render function from the call site still gets the last word.\nfunction decorativeRenderer(element: string, render: RACSeparatorProps['render']): NonNullable<RACSeparatorProps['render']> {\n return (domProps, renderProps) => {\n const hidden = {\n ...domProps,\n 'aria-hidden': true,\n 'aria-orientation': undefined,\n role: undefined\n };\n return render === undefined ? createElement(element, hidden) : render(hidden, renderProps);\n };\n}\n\n/**\n * A 1px rule between items: inset between list rows, across a toolbar's\n * direction among its controls, and as `Menu.Separator` between groups of a\n * menu's items.\n *\n * ```tsx\n * <Card padding=\"none\" variant=\"outlined\">\n * <ListItem>First item</ListItem>\n * <Separator inset=\"start\" />\n * <ListItem>Second item</ListItem>\n * </Card>\n *\n * <Toolbar aria-label=\"Label\">\n * <Button variant=\"text\">First</Button>\n * <Separator />\n * <Button variant=\"text\">Second</Button>\n * </Toolbar>\n *\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * <Menu.Separator />\n * <Menu.Item id=\"second\">Second item</Menu.Item>\n * </Menu.Content>\n * ```\n *\n * The orientation drives the accessibility tree as well as which side the\n * rule is drawn on: horizontal renders an `<hr>` and vertical a `<div>`, each\n * given the separator role, and the vertical one `aria-orientation=\"vertical\"`\n * besides. `decorative` takes the rule out of that tree altogether, for one\n * that only draws a line between items that already carry their own\n * structure.\n *\n * `inset` holds the rule off the ends it runs between — `start` off the\n * leading one, `both` off each — which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * React Aria's rather than a styled element of the library's own, so a\n * `Menu` or `Toolbar` around it reaches it through context — a separator\n * between menu items is part of the collection, and one in a toolbar takes\n * the rule across the toolbar's own direction. `elementType` picks a\n * different element, and `render` is React Aria's function form.\n */\nfunction Separator({\n decorative = false,\n inset = 'none',\n orientation,\n render,\n ...props\n}: RefAttributes<HTMLElement> & SeparatorProps) {\n const context = useSlottedContext(SeparatorContext, props.slot);\n const resolved = orientation ?? context?.orientation ?? 'horizontal';\n // The element React Aria renders, which its render function is held to:\n // an <hr> unless the call site or a container asks for another, and a\n // <div> in place of a vertical <hr>.\n const requested = props.elementType ?? context?.elementType ?? 'hr';\n const element = requested === 'hr' && resolved === 'vertical' ? 'div' : requested;\n return <RACSeparator orientation={resolved} render={decorative ? decorativeRenderer(element, render) : render} {...props} {...mergeStyles(stylex.props(styles.base, styles[resolved], insets[resolved][inset]), props)} />;\n}\nexport type { SeparatorInset, SeparatorProps };\nexport default Separator;"],"mappings":";;;;;;;;AA+DA,MAAMe,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRO,QAAQ;EACRC,QAAQ;EACRd,OAAO;CACT;AACF;AA4CA,MAAMwB,SAAS;CACbvB,YAAYc;EArCZC,MAAM;GACJV,QAAQ;GACRW,QAAQ;GACRC,QAAQ;GACRlB,OAAO;EACT;EACAmB,MAAM,EACJnB,OAAO,KACT;EACAoB,OAAO;GACLd,QAAQ;GACRY,QAAQ;GACRlB,OAAO;EACT;CAwBYe;CACZR,UAAUc;EAfVL,MAAM;GACJM,QAAQ;GACRC,QAAQ;GACRvB,OAAO;EACT;EACAmB,MAAM,EACJnB,OAAO,KACT;EACAoB,OAAO;GACLG,QAAQ;GACRvB,OAAO;EACT;CAIUqB;AACZ;AAoCA,SAASS,mBAAmBC,SAAiBC,QAA+E;CAC1H,QAAQE,UAAUC,gBAAgB;EAChC,MAAMC,SAAS;GACb,GAAGF;GACH,eAAe;GACf,oBAAoBG,KAAAA;GACpBC,MAAMD,KAAAA;EACR;EACA,OAAO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ator","RACSeparator","SeparatorContext","useSlottedContext","mergeStyles","styles","base","kWkggS","kMzoRj","kB7OPa","kmuXW","kogj98","$$css","horizontal","kZKoxP","kLZC3w","kPef9Z","kEafiO","kzqmXN","vertical","kSGwAc","kGJrpR","kVhnKS","k2ei4v","k1xSpc","kAzted","kXLuUW","horizontalInsets","both","k71WvV","keTefX","none","start","verticalInsets","k1K539","keoZOQ","insets","decorative","inset","orientation","decorativeRenderer","element","render","domProps","renderProps","hidden","undefined","role","t0","$","t1","t2","props","context","slot","resolved","requested","elementType","T0","t3","t4","t5"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { SeparatorProps as RACSeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement } from 'react';\nimport { Separator as RACSeparator, SeparatorContext, useSlottedContext } from 'react-aria-components';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own — the design system treats the two as one\n// decision, and a separator that drifted from the borders around it would\n// read as a mistake.\n//\n// Drawn as a background on a 1px box rather than as a border, so the rule is\n// the element itself. A border would leave the element's own box at zero\n// size, which makes it invisible to flex `gap` and to anything measuring it.\n// The horizontal element is an <hr>, which arrives with a border and a\n// margin of its own; both are zeroed here so it is the same 1px box a <div>\n// would be.\n//\n// Vertical takes its length from the flex or grid parent through\n// `alignSelf: stretch`, since a divider between two columns should match\n// whatever they turn out to be rather than being told a height at the call\n// site. Anywhere else there is nothing to stretch to, so it falls back to\n// `1em`, one line of the text around it, and sits in that line as an inline\n// block rather than breaking it: between two words in a paragraph it is a\n// short upright bar, rather than a 1px box with no height that draws\n// nothing. The divider page gives no length for a vertical rule standing on\n// its own, so the `1em` is this library's choice. Inside a flex or grid\n// parent the inline display is blockified and the floor sits below any\n// length the parent stretches it to, so neither changes the rule there.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The\n// page names them \"inset\" and \"middle-inset\"; the prop says `start` and\n// `both` instead, since `inset=\"inset\"` reads as nothing at all and the two\n// words say which ends move.\n//\n// The inset is drawn as a margin on the logical axis the rule runs along, so\n// it follows the writing mode and works for a vertical rule as well — the\n// page only draws horizontal ones, but a shortened vertical rule between two\n// columns is the same idea and would otherwise have to be written at the\n// call site. An inset rule's length is `100%` less its margins: a margin\n// sits outside the box, so a full-width rule with one would overflow its\n// parent by exactly the inset, and `auto` in its place gives an empty `<hr>`\n// a width only where the parent stretches it — in a flex row, or a parent\n// centring its children, the rule came out 0 wide and vanished.\n//\n// The orientation is resolved rather than defaulted eagerly, so a container\n// that sets one through React Aria's separator context reaches it. Toolbar\n// is what needs that: a rule between two controls in a row is vertical, and\n// a `Separator` written inside one should not have to say so. React Aria's\n// own `Toolbar` sets no such context — it puts the orientation on itself and\n// nothing else — so ours provides it, and this is the half that reads it.\nconst styles = {\n base: {\n kWkggS: \"x1l12bh\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n horizontal: {\n kZKoxP: \"xjm9jq1\",\n kLZC3w: \"x19dwuzr\",\n kPef9Z: \"x4z998w\",\n kEafiO: \"x1lym3mf\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n vertical: {\n kSGwAc: \"xkh2ocl\",\n kGJrpR: \"xjslfuv\",\n kVhnKS: \"x1gbqego\",\n k2ei4v: \"xjg5lhu\",\n k1xSpc: \"x1rg5ohu\",\n kzqmXN: \"x1i1rx1s\",\n kAzted: \"x1xaadd7\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\n\n// The page's 16dp, on whichever axis the rule runs along. The length is the\n// full-width rule's `100%` less the margins, which keeps the rule inside its\n// parent — a margin outside a 100% box overflows by the inset — and still\n// gives it a width in every layout, where `auto` gives an `<hr>` with no\n// content one only in a parent that stretches it.\nconst horizontalInsets = {\n both: {\n kzqmXN: \"x1n0idw\",\n k71WvV: \"xdf1gh2\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n kzqmXN: \"x1u7osep\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n }\n};\n\n// A vertical rule takes its length from the parent through `alignSelf`, so\n// the margin shortens it from the end it is on rather than moving it. The\n// `1em` floor is the rule's own length and the margins sit outside it: a\n// stretched rule is shortened down to the floor and no further, and one with\n// no parent to stretch to keeps its `1em` and takes the inset as space above\n// and below, since there is no length of the parent's for it to hold off.\nconst verticalInsets = {\n both: {\n k1K539: \"xxkrg4w\",\n keoZOQ: \"xwf6w2j\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n keoZOQ: \"xwf6w2j\",\n $$css: true\n }\n};\nconst insets = {\n horizontal: horizontalInsets,\n vertical: verticalInsets\n};\ntype SeparatorInset = 'both' | 'none' | 'start';\ntype SeparatorProps = {\n /**\n * Takes the rule out of the accessibility tree, for a divider that only\n * draws a line between things that already say where each starts — the\n * sections of a `DisclosureGroup`, or rows that are each a control. A\n * reader then hears nothing between them rather than \"separator\" at every\n * one. The rule draws the same either way.\n * @default false\n */\n decorative?: boolean;\n /**\n * How far the rule is held off the edges it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both`\n * holds it off each end, which is its middle-inset one. The inset follows\n * the writing mode rather than a fixed side.\n * @default 'none'\n */\n inset?: SeparatorInset;\n /**\n * Which way the rule runs. A vertical separator takes its length from a\n * flex or grid parent, and is one line of the text around it, `1em`, in\n * any other. Defaults to whatever the container asks for — a `Toolbar`\n * asks for the rule across its own direction — and to horizontal outside\n * one.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n} & Omit<RACSeparatorProps, 'orientation'>;\n\n// A rule taken out of the accessibility tree. React Aria passes on neither\n// `aria-hidden` nor `role` from a separator's props, and sets the separator\n// role itself, so the element is rewritten in its render function, after\n// both: hidden, with the role and orientation it would be announced by\n// dropped. A render function from the call site still gets the last word.\nfunction decorativeRenderer(element: string, render: RACSeparatorProps['render']): NonNullable<RACSeparatorProps['render']> {\n return (domProps, renderProps) => {\n const hidden = {\n ...domProps,\n 'aria-hidden': true,\n 'aria-orientation': undefined,\n role: undefined\n };\n return render === undefined ? createElement(element, hidden) : render(hidden, renderProps);\n };\n}\n\n/**\n * A 1px rule between items: inset between list rows, across a toolbar's\n * direction among its controls, and as `Menu.Separator` between groups of a\n * menu's items.\n *\n * ```tsx\n * <Card padding=\"none\" variant=\"outlined\">\n * <ListItem>First item</ListItem>\n * <Separator inset=\"start\" />\n * <ListItem>Second item</ListItem>\n * </Card>\n *\n * <Toolbar aria-label=\"Label\">\n * <Button variant=\"text\">First</Button>\n * <Separator />\n * <Button variant=\"text\">Second</Button>\n * </Toolbar>\n *\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * <Menu.Separator />\n * <Menu.Item id=\"second\">Second item</Menu.Item>\n * </Menu.Content>\n * ```\n *\n * The orientation drives the accessibility tree as well as which side the\n * rule is drawn on: horizontal renders an `<hr>` and vertical a `<div>`, each\n * given the separator role, and the vertical one `aria-orientation=\"vertical\"`\n * besides. `decorative` takes the rule out of that tree altogether, for one\n * that only draws a line between items that already carry their own\n * structure.\n *\n * `inset` holds the rule off the ends it runs between — `start` off the\n * leading one, `both` off each — which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * React Aria's rather than a styled element of the library's own, so a\n * `Menu` or `Toolbar` around it reaches it through context — a separator\n * between menu items is part of the collection, and one in a toolbar takes\n * the rule across the toolbar's own direction. `elementType` picks a\n * different element, and `render` is React Aria's function form.\n */\nfunction Separator({\n decorative = false,\n inset = 'none',\n orientation,\n render,\n ...props\n}: RefAttributes<HTMLElement> & SeparatorProps) {\n const context = useSlottedContext(SeparatorContext, props.slot);\n const resolved = orientation ?? context?.orientation ?? 'horizontal';\n // The element React Aria renders, which its render function is held to:\n // an <hr> unless the call site or a container asks for another, and a\n // <div> in place of a vertical <hr>.\n const requested = props.elementType ?? context?.elementType ?? 'hr';\n const element = requested === 'hr' && resolved === 'vertical' ? 'div' : requested;\n return <RACSeparator orientation={resolved} render={decorative ? decorativeRenderer(element, render) : render} {...props} {...mergeStyles(stylex.props(styles.base, styles[resolved], insets[resolved][inset]), props)} />;\n}\nexport type { SeparatorInset, SeparatorProps };\nexport default Separator;"],"mappings":";;;;;;;;AA+DA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRO,QAAQ;EACRC,QAAQ;EACRd,OAAO;CACT;AACF;AA4CA,MAAMwB,SAAS;CACbvB,YAAYc;EArCZC,MAAM;GACJV,QAAQ;GACRW,QAAQ;GACRC,QAAQ;GACRlB,OAAO;EACT;EACAmB,MAAM,EACJnB,OAAO,KACT;EACAoB,OAAO;GACLd,QAAQ;GACRY,QAAQ;GACRlB,OAAO;EACT;CAwBYe;CACZR,UAAUc;EAfVL,MAAM;GACJM,QAAQ;GACRC,QAAQ;GACRvB,OAAO;EACT;EACAmB,MAAM,EACJnB,OAAO,KACT;EACAoB,OAAO;GACLG,QAAQ;GACRvB,OAAO;EACT;CAIUqB;AACZ;AAoCA,SAASO,mBAAmBC,SAAiBC,QAA+E;CA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AAA,KAAAW;EAAAX,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAAnNY;AAAmN"}
@@ -163,5 +163,4 @@ type SheetProps = Omit<DialogTriggerProps, 'children'> & {
163
163
  children?: ReactNode;
164
164
  };
165
165
  type SheetTitleProps = HeadingProps;
166
- export { SheetBody, SheetContent$1 as SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Sheet$1 as default };
167
- //# sourceMappingURL=index.d.ts.map
166
+ export { SheetBody, SheetContent$1 as SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Sheet$1 as default };