@kanso-labs/kanso-ui 0.45.34 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/button/index.js +13 -9
  2. package/dist/button/index.js.map +1 -1
  3. package/dist/calendar/styles.js +12 -7
  4. package/dist/calendar/styles.js.map +1 -1
  5. package/dist/chip/styles.js +1 -0
  6. package/dist/chip/styles.js.map +1 -1
  7. package/dist/collection/styles.js +1 -1
  8. package/dist/collection/styles.js.map +1 -1
  9. package/dist/components/breadcrumbs/index.js +4 -1
  10. package/dist/components/breadcrumbs/index.js.map +1 -1
  11. package/dist/components/button-group/index.d.ts +16 -3
  12. package/dist/components/button-group/index.js +53 -86
  13. package/dist/components/button-group/index.js.map +1 -1
  14. package/dist/components/calendar/index.d.ts +3 -3
  15. package/dist/components/calendar/index.js.map +1 -1
  16. package/dist/components/card/index.js +5 -1
  17. package/dist/components/card/index.js.map +1 -1
  18. package/dist/components/carousel/index.js +162 -105
  19. package/dist/components/carousel/index.js.map +1 -1
  20. package/dist/components/chip/index.d.ts +38 -15
  21. package/dist/components/chip/index.js +104 -8
  22. package/dist/components/chip/index.js.map +1 -1
  23. package/dist/components/color-area/index.d.ts +5 -3
  24. package/dist/components/color-area/index.js +5 -3
  25. package/dist/components/color-area/index.js.map +1 -1
  26. package/dist/components/color-picker/index.js +6 -3
  27. package/dist/components/color-picker/index.js.map +1 -1
  28. package/dist/components/color-swatch-picker/index.js +24 -9
  29. package/dist/components/color-swatch-picker/index.js.map +1 -1
  30. package/dist/components/combo-box/index.d.ts +11 -3
  31. package/dist/components/combo-box/index.js +66 -62
  32. package/dist/components/combo-box/index.js.map +1 -1
  33. package/dist/components/copy-field/index.js +1 -0
  34. package/dist/components/copy-field/index.js.map +1 -1
  35. package/dist/components/date-picker/index.d.ts +22 -3
  36. package/dist/components/date-picker/index.js +234 -45
  37. package/dist/components/date-picker/index.js.map +1 -1
  38. package/dist/components/date-range-picker/index.d.ts +3 -1
  39. package/dist/components/date-range-picker/index.js +6 -4
  40. package/dist/components/date-range-picker/index.js.map +1 -1
  41. package/dist/components/disclosure/index.d.ts +4 -3
  42. package/dist/components/disclosure/index.js +159 -101
  43. package/dist/components/disclosure/index.js.map +1 -1
  44. package/dist/components/fab/index.d.ts +3 -1
  45. package/dist/components/fab/index.js +25 -12
  46. package/dist/components/fab/index.js.map +1 -1
  47. package/dist/components/fab-menu/index.js +1 -1
  48. package/dist/components/fab-menu/index.js.map +1 -1
  49. package/dist/components/icon-button/index.js.map +1 -1
  50. package/dist/components/index.d.ts +2 -2
  51. package/dist/components/menu/index.js +1 -1
  52. package/dist/components/menu/index.js.map +1 -1
  53. package/dist/components/navigation-rail/index.js +4 -4
  54. package/dist/components/navigation-rail/index.js.map +1 -1
  55. package/dist/components/navigation-tree/index.js +16 -13
  56. package/dist/components/navigation-tree/index.js.map +1 -1
  57. package/dist/components/popover/index.js +35 -33
  58. package/dist/components/popover/index.js.map +1 -1
  59. package/dist/components/range-calendar/index.js +41 -7
  60. package/dist/components/range-calendar/index.js.map +1 -1
  61. package/dist/components/segmented-button/index.d.ts +3 -2
  62. package/dist/components/segmented-button/index.js +46 -95
  63. package/dist/components/segmented-button/index.js.map +1 -1
  64. package/dist/components/select/index.js +5 -2
  65. package/dist/components/select/index.js.map +1 -1
  66. package/dist/components/slider/index.js +42 -10
  67. package/dist/components/slider/index.js.map +1 -1
  68. package/dist/components/time-picker/index.js +2 -0
  69. package/dist/components/time-picker/index.js.map +1 -1
  70. package/dist/components/token-field/index.js +89 -66
  71. package/dist/components/token-field/index.js.map +1 -1
  72. package/dist/components/toolbar/index.d.ts +4 -0
  73. package/dist/components/toolbar/index.js +16 -5
  74. package/dist/components/toolbar/index.js.map +1 -1
  75. package/dist/components/tree/index.js +1 -1
  76. package/dist/components/tree/index.js.map +1 -1
  77. package/dist/fab/styles.js +12 -0
  78. package/dist/fab/styles.js.map +1 -1
  79. package/dist/field/styles.js +2 -2
  80. package/dist/field/styles.js.map +1 -1
  81. package/dist/hooks/useDockedMonths.js +36 -0
  82. package/dist/hooks/useDockedMonths.js.map +1 -0
  83. package/dist/i18n/index.js +1 -0
  84. package/dist/i18n/index.js.map +1 -1
  85. package/dist/i18n/messages.js +34 -0
  86. package/dist/i18n/messages.js.map +1 -1
  87. package/dist/index.d.ts +2 -2
  88. package/dist/navigation/index.js +5 -5
  89. package/dist/navigation/index.js.map +1 -1
  90. package/dist/navigation/styles.js +4 -0
  91. package/dist/navigation/styles.js.map +1 -1
  92. package/dist/row/context.js +6 -0
  93. package/dist/row/context.js.map +1 -0
  94. package/dist/row/index.js +77 -66
  95. package/dist/row/index.js.map +1 -1
  96. package/dist/row/styles.js +15 -0
  97. package/dist/row/styles.js.map +1 -1
  98. package/dist/segments/index.js +2 -1
  99. package/dist/segments/index.js.map +1 -1
  100. package/dist/segments/styles.js +4 -0
  101. package/dist/segments/styles.js.map +1 -1
  102. package/dist/styles/chequer.js +1 -0
  103. package/dist/styles/chequer.js.map +1 -1
  104. package/dist/styles/focus.js.map +1 -1
  105. package/dist/styles.css +158 -35
  106. package/dist/toggle-group/index.js +133 -0
  107. package/dist/toggle-group/index.js.map +1 -0
  108. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","RangeCalendar","RACRangeCalendar","calendarStyles","dateLayers","focus","mergeStatefulStyles","className","showMonthYearMenus","cellClassName","state","isDisabled","isHovered","isPressed","isSelected","isSelectionEnd","isSelectionStart","isToday","isUnavailable","isEnd","props","cell","ring","cellToday","cellInRange","cellRangeStart","cellRangeEnd","cellSelected","selectedHovered","inRangeHovered","plainHovered","selectedPressed","inRangePressed","plainPressed","cellUnavailable","cellDisabled","gridCell","date","t0","$","T0","t1","t2","t3","t4","undefined","root","visibleDuration","months","t5","t6","t7","RACCalendarCell"],"sources":["../../../src/components/range-calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { DateValue, RangeCalendarProps as RACRangeCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CalendarCell as RACCalendarCell, RangeCalendar as RACRangeCalendar } from 'react-aria-components';\nimport { CalendarFrame, CalendarMonths } from '../../calendar';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's calendar again, picking two dates rather than one.\n// Every part it draws is Calendar's, from `src/calendar` — the container, the\n// grid, the weekday row, the chevrons and the date circle — so the two cannot\n// come apart.\n//\n// What a range adds is the band between its two ends. The docked token set\n// stops at the selected date, so the band's colours are the modal date\n// picker's range-selection tokens — the secondary container, one step down\n// from the primary the two ends take — and its reasons are in\n// `src/calendar/styles.ts` where it is defined.\n//\n// Two things follow from drawing a band across a grid whose cells are spaced\n// apart.\n//\n// **The band is square and the ends are round.** A range of consecutive days\n// reads as one shape rather than a row of circles, and the first and last day\n// round only their outer edge, which is what makes the band begin and end at\n// a circle.\n//\n// **The band fills the whole of each day's 48dp.** A day in the range drops\n// the 4dp margin either side that every other date keeps and takes the full\n// width of its cell, so one day's band meets the next one's. Without it the\n// band arrives as a dashed run of separate blocks.\n\ntype RangeCalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACRangeCalendarProps<T>['className'];\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as `Calendar`'s does. The\n * year list runs a century either side of the year shown, or to\n * `minValue` and `maxValue` where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACRangeCalendarProps<T>['style'];\n} & Omit<RACRangeCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order is what makes a range read as one shape. Every selected day takes\n// the band; the two ends then take the circle over it, and round the outer\n// edge the band does not continue past. The hover and pressed layers come\n// next, each written for the ground under it — the circle, the band, or\n// nothing — a press over a hover. `unavailable` comes after those, so a\n// ruled-out day inside a range keeps the band and takes the strikethrough\n// over it. `disabled` is last of all, and StyleX replaces a property whole,\n// so it takes the branches above it with it.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n isSelectionEnd: boolean;\n isSelectionStart: boolean;\n isToday: boolean;\n isUnavailable: boolean;\n}) {\n const isEnd = state.isSelected && (state.isSelectionStart || state.isSelectionEnd);\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellInRange, state.isSelected && state.isSelectionStart && calendarStyles.cellRangeStart, state.isSelected && state.isSelectionEnd && calendarStyles.cellRangeEnd, isEnd && calendarStyles.cellSelected, state.isHovered && (isEnd ? dateLayers.selectedHovered : state.isSelected ? dateLayers.inRangeHovered : dateLayers.plainHovered), state.isPressed && (isEnd ? dateLayers.selectedPressed : state.isSelected ? dateLayers.inRangePressed : dateLayers.plainPressed), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\n\n/**\n * A calendar for picking a range of dates. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as a `{ start, end }` pair of `@internationalized/date` values\n * from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <RangeCalendar\n * aria-label=\"Label\"\n * defaultValue={{\n * start: new CalendarDate(2026, 9, 8),\n * end: new CalendarDate(2026, 9, 15),\n * }}\n * />\n * ```\n *\n * The two ends take the circle a selected date takes in `Calendar`, and the\n * days between them a band in the secondary container. `minValue`,\n * `maxValue`, `isDateUnavailable` and `visibleDuration` are the same props\n * `Calendar` takes, and `allowsNonContiguousRanges` lets a range skip the\n * dates ruled out inside it rather than stopping at the first.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction RangeCalendar<T extends DateValue>({\n showMonthYearMenus = false,\n ...props\n}: RangeCalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACRangeCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <CalendarMonths months={props.visibleDuration?.months ?? 1}>\n {gridCell}\n </CalendarMonths>\n </CalendarFrame>\n </RACRangeCalendar>;\n}\nexport type { RangeCalendarProps };\nexport default RangeCalendar;"],"mappings":";;;;;;;;;;AAmEA,SAASU,cAAcC,OASpB;CACD,MAAMS,QAAQT,MAAMI,eAAeJ,MAAMM,oBAAoBN,MAAMK;CACnE,OAAOf,MAAaG,eAAekB,MAAMhB,MAAMiB,MAAMZ,MAAMO,WAAWd,eAAeoB,WAAWb,MAAMI,cAAcX,eAAeqB,aAAad,MAAMI,cAAcJ,MAAMM,oBAAoBb,eAAesB,gBAAgBf,MAAMI,cAAcJ,MAAMK,kBAAkBZ,eAAeuB,cAAcP,SAAShB,eAAewB,cAAcjB,MAAME,cAAcO,QAAQf,WAAWwB,kBAAkBlB,MAAMI,aAAaV,WAAWyB,iBAAiBzB,WAAW0B,eAAepB,MAAMG,cAAcM,QAAQf,WAAW2B,kBAAkBrB,MAAMI,aAAaV,WAAW4B,iBAAiB5B,WAAW6B,eAAevB,MAAMQ,iBAAiBf,eAAe+B,iBAAiBxB,MAAMC,cAAcR,eAAegC,YAAY,CAAC,CAAC5B,aAAa;AACvsB;AACA,SAAS6B,SAASC,MAAkC;CAClD,OAAO,oBAACe,cAAD;EAAiB,WAAW3C;EAAqB4B;C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,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,QAAAC,MAAAD,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAW,IAAA;EALbC,KAAA,oBAAC,IAAD;GAAiB,GAAQ/B;GAAK,GAAMsB;GACvCQ,UAAAA;EADoB,CAAA;EAMHX,EAAA,MAAAC;EAAAD,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAW;EAAAX,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OANdY;AAMc"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","useContext","RangeCalendar","RACRangeCalendar","RangeCalendarStateContext","calendarStyles","dateLayers","focus","mergeStatefulStyles","className","showMonthYearMenus","cellClassName","state","isInRange","isEnd","isSelected","isSelectionStart","isSelectionEnd","isBand","isDisabled","isLayered","isUnavailable","props","cell","ring","isToday","cellToday","cellInRange","cellRangeStart","cellRangeEnd","cellSelected","isHovered","selectedHovered","inRangeHovered","plainHovered","isPressed","selectedPressed","inRangePressed","plainPressed","cellUnavailableInRange","cellUnavailable","cellDisabled","cellClassNameIn","DateCell","t0","$","date","highlighted","highlightedRange","compare","start","end","t1","t2","gridCell","T0","t3","t4","undefined","root","visibleDuration","months","t5","t6","t7","RACCalendarCell"],"sources":["../../../src/components/range-calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { CalendarCellRenderProps, DateValue, RangeCalendarProps as RACRangeCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CalendarCell as RACCalendarCell, RangeCalendar as RACRangeCalendar, RangeCalendarStateContext } from 'react-aria-components';\nimport { CalendarFrame, CalendarMonths } from '../../calendar';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's calendar again, picking two dates rather than one.\n// Every part it draws is Calendar's, from `src/calendar` — the container, the\n// grid, the weekday row, the chevrons and the date circle — so the two cannot\n// come apart.\n//\n// What a range adds is the band between its two ends. The docked token set\n// stops at the selected date, so the band's colours are the modal date\n// picker's range-selection tokens — the secondary container, one step down\n// from the primary the two ends take — and its reasons are in\n// `src/calendar/styles.ts` where it is defined.\n//\n// Two things follow from drawing a band across a grid whose cells are spaced\n// apart.\n//\n// **The band is square and the ends are round.** A range of consecutive days\n// reads as one shape rather than a row of circles, and the first and last day\n// round only their outer edge, which is what makes the band begin and end at\n// a circle.\n//\n// **The band fills the whole of each day's 48dp.** A day in the range drops\n// the 4dp margin either side that every other date keeps and takes the full\n// width of its cell, so one day's band meets the next one's. Without it the\n// band arrives as a dashed run of separate blocks.\n\ntype RangeCalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACRangeCalendarProps<T>['className'];\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as `Calendar`'s does. The\n * year list runs a century either side of the year shown, or to\n * `minValue` and `maxValue` where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACRangeCalendarProps<T>['style'];\n} & Omit<RACRangeCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order is what makes a range read as one shape. Every selected day takes\n// the band; the two ends then take the circle over it, and round the outer\n// edge the band does not continue past. The hover and pressed layers come\n// next, each written for the ground under it — the circle, the band, or\n// nothing — a press over a hover. `unavailable` comes after those and takes\n// the layers away, since a ruled-out day is not one a press picks; inside a\n// range it keeps the band and takes the strikethrough over it. `disabled` is\n// last of all, and StyleX replaces a property whole, so it takes the branches\n// above it with it.\n//\n// The band is `isInRange`, not React Aria's `isSelected`: React Aria leaves a\n// ruled-out day out of the dates it selects, even between the two ends, so a\n// band drawn from `isSelected` alone stopped square either side of it and the\n// range read as two blocks with a hole between them.\nfunction cellClassName(state: CalendarCellRenderProps, isInRange: boolean) {\n const isEnd = state.isSelected && (state.isSelectionStart || state.isSelectionEnd);\n const isBand = state.isSelected || isInRange && !state.isDisabled;\n const isLayered = !state.isUnavailable;\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, isBand && calendarStyles.cellInRange, state.isSelected && state.isSelectionStart && calendarStyles.cellRangeStart, state.isSelected && state.isSelectionEnd && calendarStyles.cellRangeEnd, isEnd && calendarStyles.cellSelected, isLayered && state.isHovered && (isEnd ? dateLayers.selectedHovered : isBand ? dateLayers.inRangeHovered : dateLayers.plainHovered), isLayered && state.isPressed && (isEnd ? dateLayers.selectedPressed : isBand ? dateLayers.inRangePressed : dateLayers.plainPressed), state.isUnavailable && (isBand ? calendarStyles.cellUnavailableInRange : calendarStyles.cellUnavailable), state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\n\n// A date's classes, bound once per date. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after.\nfunction cellClassNameIn(isInRange: boolean) {\n return (state: CalendarCellRenderProps) => cellClassName(state, isInRange);\n}\n\n/**\n * One date. React Aria's cell, with whether the date lies inside the range\n * read from React Aria's range state: between the two ends of the value, or\n * of the range being picked while one end is down, which is the same range\n * React Aria draws `isSelected` from. The classes leave a disabled date out\n * of the band, so a date of a neighbouring month or outside the bounds draws\n * none.\n */\nfunction DateCell({\n date\n}: {\n date: CalendarDate;\n}): ReactElement {\n const highlighted = useContext(RangeCalendarStateContext)?.highlightedRange;\n const isInRange = highlighted != null && date.compare(highlighted.start) >= 0 && date.compare(highlighted.end) <= 0;\n return <RACCalendarCell className={cellClassNameIn(isInRange)} date={date} />;\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <DateCell date={date} />;\n}\n\n/**\n * A calendar for picking a range of dates. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as a `{ start, end }` pair of `@internationalized/date` values\n * from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <RangeCalendar\n * aria-label=\"Label\"\n * defaultValue={{\n * start: new CalendarDate(2026, 9, 8),\n * end: new CalendarDate(2026, 9, 15),\n * }}\n * />\n * ```\n *\n * The two ends take the circle a selected date takes in `Calendar`, and the\n * days between them a band in the secondary container. `minValue`,\n * `maxValue`, `isDateUnavailable` and `visibleDuration` are the same props\n * `Calendar` takes, and `allowsNonContiguousRanges` lets a range skip the\n * dates ruled out inside it rather than stopping at the first.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction RangeCalendar<T extends DateValue>({\n showMonthYearMenus = false,\n ...props\n}: RangeCalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACRangeCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <CalendarMonths months={props.visibleDuration?.months ?? 1}>\n {gridCell}\n </CalendarMonths>\n </CalendarFrame>\n </RACRangeCalendar>;\n}\nexport type { RangeCalendarProps };\nexport default RangeCalendar;"],"mappings":";;;;;;;;;;;AA0EA,SAASY,cAAcC,OAAgCC,WAAoB;CACzE,MAAMC,QAAQF,MAAMG,eAAeH,MAAMI,oBAAoBJ,MAAMK;CACnE,MAAMC,SAASN,MAAMG,cAAcF,aAAa,CAACD,MAAMO;CACvD,MAAMC,YAAY,CAACR,MAAMS;CACzB,OAAOrB,MAAaK,eAAekB,MAAMhB,MAAMiB,MAAMZ,MAAMa,WAAWpB,eAAeqB,WAAWR,UAAUb,eAAesB,aAAaf,MAAMG,cAAcH,MAAMI,oBAAoBX,eAAeuB,gBAAgBhB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MAAAV,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAkB,IAAA;EALbC,KAAA,oBAAC,IAAD;GAAiB,GAAQ1C;GAAK,GAAM+B;GACvCU,UAAAA;EADoB,CAAA;EAMHlB,EAAA,MAAAU;EAAAV,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAkB;EAAAlB,EAAA,MAAAmB;CAAA,OAAAA,KAAAnB,EAAA;CAAA,OANdmB;AAMc"}
@@ -79,8 +79,9 @@ type SegmentedButtonSegmentProps = Omit<ToggleButtonProps, 'children' | 'classNa
79
79
  * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is
80
80
  * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys
81
81
  * move to a segment and choose it, wrapping at either end, and Home and End
82
- * choose the first and last. Choosing several keeps React Aria's keys: the
83
- * arrows move between segments, and Space or Enter toggles the focused one.
82
+ * choose the first and last. Tab lands on the chosen segment, the set's one
83
+ * Tab stop. Choosing several keeps React Aria's keys: the arrows move
84
+ * between segments, and Space or Enter toggles the focused one.
84
85
  *
85
86
  * The call site's `className` and `style` land on the track, which is the
86
87
  * element a layout positions.
@@ -6,9 +6,10 @@ import { useToggleGroupDisabled } from "../../hooks/useToggleGroupDisabled.js";
6
6
  import { ariaAttributesOf, toggleButtonRenderer } from "../../render/aria.js";
7
7
  import { focus } from "../../styles/focus.js";
8
8
  import { mergeStatefulStyles } from "../../styles/merge.js";
9
+ import { toggleGroupRenderer, useRadioItem } from "../../toggle-group/index.js";
9
10
  import { spacing } from "../../tokens/design.tokens.stylex.js";
10
11
  import { c } from "react/compiler-runtime";
11
- import { createContext, createElement, useContext, useEffect, useLayoutEffect, useState } from "react";
12
+ import { createContext, useContext, useEffect, useLayoutEffect, useState } from "react";
12
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
14
  import { SelectionIndicator, ToggleButton, ToggleButtonGroup } from "react-aria-components";
14
15
  // src/components/segmented-button/index.tsx
@@ -18,51 +19,6 @@ const CrowdingContext = createContext({
18
19
  crowded: false,
19
20
  report: () => void 0
20
21
  });
21
- function keyOf(segment) {
22
- const written = segment.dataset.key;
23
- if (written === void 0) return null;
24
- const key = JSON.parse(written);
25
- return typeof key === "string" || typeof key === "number" ? key : null;
26
- }
27
- function radioGroupRenderer(render) {
28
- return (domProps, renderProps) => {
29
- const merged = {
30
- ...domProps,
31
- onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)
32
- };
33
- return render === void 0 ? createElement("div", merged) : render(merged, renderProps);
34
- };
35
- }
36
- function radioKeys(state, toolbar) {
37
- return (event) => {
38
- const group = event.currentTarget;
39
- const segments = [...group.querySelectorAll("[data-key]:not([data-disabled])")].filter((segment) => segment.closest("[role=\"radiogroup\"]") === group);
40
- const from = segments.findIndex((segment) => segment === event.target);
41
- const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === "rtl");
42
- if (from === -1 || step === null) {
43
- toolbar?.(event);
44
- return;
45
- }
46
- event.preventDefault();
47
- event.stopPropagation();
48
- const segment = segments[step === "first" ? 0 : step === "last" ? segments.length - 1 : (from + step + segments.length) % segments.length];
49
- const key = keyOf(segment);
50
- if (key === null) return;
51
- segment.focus();
52
- state.setSelected(key, true);
53
- };
54
- }
55
- function stepOf(key, rtl) {
56
- switch (key) {
57
- case "ArrowDown": return 1;
58
- case "ArrowLeft": return rtl ? 1 : -1;
59
- case "ArrowRight": return rtl ? -1 : 1;
60
- case "ArrowUp": return -1;
61
- case "End": return "last";
62
- case "Home": return "first";
63
- default: return null;
64
- }
65
- }
66
22
  `${spacing.sm}`;
67
23
  `${spacing.sm}`;
68
24
  `${spacing.md}${spacing.sm}`;
@@ -261,8 +217,9 @@ function segmentContent(children, icon, ripple, selectionMode, marked, crowded,
261
217
  * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is
262
218
  * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys
263
219
  * move to a segment and choose it, wrapping at either end, and Home and End
264
- * choose the first and last. Choosing several keeps React Aria's keys: the
265
- * arrows move between segments, and Space or Enter toggles the focused one.
220
+ * choose the first and last. Tab lands on the chosen segment, the set's one
221
+ * Tab stop. Choosing several keeps React Aria's keys: the arrows move
222
+ * between segments, and Space or Enter toggles the focused one.
266
223
  *
267
224
  * The call site's `className` and `style` land on the track, which is the
268
225
  * element a layout positions.
@@ -306,7 +263,7 @@ function SegmentedButton(t0) {
306
263
  const t5 = disallowEmptySelection ?? single;
307
264
  let t6;
308
265
  if ($[3] !== render || $[4] !== single) {
309
- t6 = single ? radioGroupRenderer(render) : render;
266
+ t6 = toggleGroupRenderer(render, single);
310
267
  $[3] = render;
311
268
  $[4] = single;
312
269
  $[5] = t6;
@@ -371,7 +328,7 @@ const NONE_CROWDED = /* @__PURE__ */ new Set();
371
328
  * unchosen one draws whatever `icon` holds, if anything.
372
329
  */
373
330
  function SegmentedButtonSegment(t0) {
374
- const $ = c(49);
331
+ const $ = c(46);
375
332
  let children;
376
333
  let icon;
377
334
  let onClick;
@@ -453,6 +410,7 @@ function SegmentedButtonSegment(t0) {
453
410
  onKeyUp
454
411
  };
455
412
  const disabledByGroup = useToggleGroupDisabled(props.id);
413
+ const radio = useRadioItem(props.id);
456
414
  let t4;
457
415
  if ($[19] !== onClick || $[20] !== onContextMenu || $[21] !== onPointerCancel || $[22] !== onPointerDown || $[23] !== onPointerLeave || $[24] !== onPointerUp) {
458
416
  t4 = {
@@ -473,55 +431,48 @@ function SegmentedButtonSegment(t0) {
473
431
  } else t4 = $[25];
474
432
  const ripple = useRipple(!disableRipple && props.isDisabled !== true && !disabledByGroup, t4);
475
433
  const T0 = ToggleButton;
476
- let t5;
477
- if ($[26] !== props.id || $[27] !== selectionMode) {
478
- t5 = selectionMode === "single" ? JSON.stringify(props.id) : void 0;
479
- $[26] = props.id;
480
- $[27] = selectionMode;
481
- $[28] = t5;
482
- } else t5 = $[28];
483
- const t6 = toggleButtonRenderer(element, render);
484
- const t7 = ripple.handlers;
434
+ const t5 = toggleButtonRenderer(element, render);
435
+ const t6 = ripple.handlers;
436
+ let t7;
437
+ if ($[26] !== crowded || $[27] !== marked || $[28] !== props) {
438
+ t7 = mergeStatefulStyles(segmentStyles(marked && !crowded), props);
439
+ $[26] = crowded;
440
+ $[27] = marked;
441
+ $[28] = props;
442
+ $[29] = t7;
443
+ } else t7 = $[29];
485
444
  let t8;
486
- if ($[29] !== crowded || $[30] !== marked || $[31] !== props) {
487
- t8 = mergeStatefulStyles(segmentStyles(marked && !crowded), props);
488
- $[29] = crowded;
489
- $[30] = marked;
490
- $[31] = props;
491
- $[32] = t8;
492
- } else t8 = $[32];
445
+ if ($[30] !== children || $[31] !== crowded || $[32] !== fit.title || $[33] !== icon || $[34] !== marked || $[35] !== ripple || $[36] !== selectionMode) {
446
+ t8 = segmentContent(children, icon, ripple, selectionMode, marked, crowded, setLabel, fit.title);
447
+ $[30] = children;
448
+ $[31] = crowded;
449
+ $[32] = fit.title;
450
+ $[33] = icon;
451
+ $[34] = marked;
452
+ $[35] = ripple;
453
+ $[36] = selectionMode;
454
+ $[37] = t8;
455
+ } else t8 = $[37];
493
456
  let t9;
494
- if ($[33] !== children || $[34] !== crowded || $[35] !== fit.title || $[36] !== icon || $[37] !== marked || $[38] !== ripple || $[39] !== selectionMode) {
495
- t9 = segmentContent(children, icon, ripple, selectionMode, marked, crowded, setLabel, fit.title);
496
- $[33] = children;
497
- $[34] = crowded;
498
- $[35] = fit.title;
499
- $[36] = icon;
500
- $[37] = marked;
501
- $[38] = ripple;
502
- $[39] = selectionMode;
503
- $[40] = t9;
504
- } else t9 = $[40];
505
- let t10;
506
- if ($[41] !== T0 || $[42] !== props || $[43] !== ripple.handlers || $[44] !== t5 || $[45] !== t6 || $[46] !== t8 || $[47] !== t9) {
507
- t10 = /* @__PURE__ */ jsx(T0, {
508
- "data-key": t5,
509
- render: t6,
510
- ...t7,
457
+ if ($[38] !== T0 || $[39] !== props || $[40] !== radio || $[41] !== ripple.handlers || $[42] !== t5 || $[43] !== t7 || $[44] !== t8) {
458
+ t9 = /* @__PURE__ */ jsx(T0, {
459
+ ...radio,
460
+ render: t5,
461
+ ...t6,
511
462
  ...props,
512
- ...t8,
513
- children: t9
463
+ ...t7,
464
+ children: t8
514
465
  });
515
- $[41] = T0;
516
- $[42] = props;
517
- $[43] = ripple.handlers;
518
- $[44] = t5;
519
- $[45] = t6;
520
- $[46] = t8;
521
- $[47] = t9;
522
- $[48] = t10;
523
- } else t10 = $[48];
524
- return t10;
466
+ $[38] = T0;
467
+ $[39] = props;
468
+ $[40] = radio;
469
+ $[41] = ripple.handlers;
470
+ $[42] = t5;
471
+ $[43] = t7;
472
+ $[44] = t8;
473
+ $[45] = t9;
474
+ } else t9 = $[45];
475
+ return t9;
525
476
  }
526
477
  function segmentStyles(marked) {
527
478
  return (state) => props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !marked && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);
@@ -1 +1 @@
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,UA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Z,MAAMS,OAAiB;CACrB1C,QAAQ;CACRqB,OAAOxJ,KAAAA;AACT;AAIA,SAASuL,eAAepL,SAAsB;CAC5C,MAAMsF,QAAQzD,iBAAiB7B,OAAO;CACtC,OAAOA,QAAQkM,sBAAsB,CAAC,CAACC,QAAQ;EAAC7G,MAAM8G;EAAwB9G,MAAM+G;EAAsB/G,MAAMgH;EAAoBhH,MAAMiH;CAAgB,CAAC,CAACC,QAAQC,KAAKxK,WAAWwK,MAAMxB,OAAOC,WAAWjJ,MAAM,GAAG,CAAC;AACxN;AAKA,SAAS+I,YAAYjB,OAAoB;CACvC,MAAM2C,QAAQb,SAASc,YAAY;CACnCD,MAAME,mBAAmB7C,KAAK;CAC9B,OAAO2C,MAAMR,sBAAsB,CAAC,CAACC;AACvC;AACA/E,gBAAgByF,UAAUvD"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","useEffect","useLayoutEffect","useState","RACToggleButton","RACToggleButtonGroup","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","toggleGroupRenderer","useRadioItem","spacing","ShowSelectedIconContext","SelectionModeContext","CrowdingContext","crowded","report","undefined","key","sm","md","styles","segment","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","state","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","$","render","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","radio","handlers","segmentStyles","ring","setFit","FITS","parentElement","measure","scrollWidth","clientWidth","textContent","textWidthOf","Number","parseFloat","getComputedStyle","scrollMarginInlineStart","contentWidthOf","resize","ResizeObserver","observe","relabel","MutationObserver","characterData","childList","subtree","document","fonts","addEventListener","disconnect","removeEventListener","getBoundingClientRect","width","borderInlineStartWidth","borderInlineEndWidth","paddingInlineStart","paddingInlineEnd","reduce","sum","length","range","createRange","selectNodeContents","Segment","RACSelectionIndicator"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, 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 { toggleGroupRenderer, useRadioItem } from '../../toggle-group';\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` that a single-selecting\n// ButtonGroup shares, through src/toggle-group, in three 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. The\n// arrow keys choose as they move, wrapping at either end, with Home and End\n// choosing the first and last segment. And the chosen segment is the set's\n// one Tab stop, so Tab lands on the choice. Under React Aria the arrows\n// moved focus alone and stopped at the ends, so a screen reader reached each\n// radio without it being checked, choosing one took a separate Space, and\n// Tab entered on the first segment whichever was chosen. Choosing several\n// 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 Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\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. Tab lands on the chosen segment, the set's one\n * Tab stop. Choosing several keeps React Aria's keys: the arrows move\n * 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={toggleGroupRenderer(render, single)} 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 const radio = useRadioItem(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 radio group's key and Tab stop while one segment is chosen; see\n // src/toggle-group.\n {...radio} 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":";;;;;;;;;;;;;;;AA4KA,MAAMkB,0BAA0BhB,cAAc,IAAI;AAKlD,MAAMiB,uBAAuBjB,cAA6B,QAAQ;AAMlE,MAAMkB,kBAAkBlB,cAAwB;CAC9CmB,SAAS;CACTC,cAAcC,KAAAA;AAChB,CAAC;AAaqB,GAAwBN,QAAQQ;AAC3B,GAAyBR,QAAQQ;AAIvC,GAAQR,QAAQS,KAAQT,QAAQQ;AAOrD,MAAME,SAAS;CACbC,SAAS;EACP,kCAAkC;EAClC,oCAAoC;EACpCC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,iBAAiB;EACfzB,QAAQ;EACR0B,QAAQ;EACRjB,QAAQ;EACRe,OAAO;CACT;CACAG,iBAAiB;EACfD,QAAQ;EACRF,OAAO;CACT;CACAI,yBAAyB;EACvBF,QAAQ;EACRF,OAAO;CACT;CACAK,mBAAmB;EACjBH,QAAQ;EACRF,OAAO;CACT;CACAM,QAAQ;EACNlC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AA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAA;EAAAH,KAAAC,EAAA;EAAAE,KAAAF,EAAA;CAAA;CA9BVxG,gBAAgBuG,IA8BbG,EAAO;CAAC,OACJ0C;AAAG;AAEZ,MAAMS,OAAiB;CACrB1C,QAAQ;CACRqB,OAAOtH,KAAAA;AACT;AAIA,SAASsJ,eAAejJ,SAAsB;CAC5C,MAAMgD,QAAQ+F,iBAAiB/I,OAAO;CACtC,OAAOA,QAAQ+J,sBAAsB,CAAC,CAACC,QAAQ;EAAChH,MAAMiH;EAAwBjH,MAAMkH;EAAsBlH,MAAMmH;EAAoBnH,MAAMoH;CAAgB,CAAC,CAACC,QAAQC,KAAKC,WAAWD,MAAMzB,OAAOC,WAAWyB,MAAM,GAAG,CAAC;AACxN;AAKA,SAAS3B,YAAYjB,OAAoB;CACvC,MAAM6C,QAAQd,SAASe,YAAY;CACnCD,MAAME,mBAAmB/C,KAAK;CAC9B,OAAO6C,MAAMT,sBAAsB,CAAC,CAACC;AACvC;AACAjF,gBAAgB4F,UAAUzD"}
@@ -3,6 +3,7 @@ import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
3
3
  import { FieldBox, FieldMessage, FieldTrigger, FieldValue } from "../../field/index.js";
4
4
  import { fieldStyles, invalidFrom, useFieldValidationBehavior } from "../../field/root.js";
5
5
  import { ChevronEndGlyph } from "../../glyphs/index.js";
6
+ import { RowOnValueLineContext } from "../../row/context.js";
6
7
  import { mergeStatefulStyles } from "../../styles/merge.js";
7
8
  import { overlay, popupOrigin } from "../../styles/overlay.js";
8
9
  import ListBox$1 from "../list-box/index.js";
@@ -29,7 +30,6 @@ const styles = { list: {
29
30
  ks0D6T: "x1x1rfll",
30
31
  k7Eaqz: "xeuugli",
31
32
  kORKVm: "x1odjw0f",
32
- k8WAf4: "x1cmllll",
33
33
  $$css: true
34
34
  } };
35
35
  /**
@@ -147,7 +147,10 @@ function SelectedValue(t0) {
147
147
  const isPlaceholder = (useContext(SelectStateContext)?.selectionManager.selectedKeys.size ?? 0) === 0;
148
148
  let t1;
149
149
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
150
- t1 = /* @__PURE__ */ jsx(SelectValue, {});
150
+ t1 = /* @__PURE__ */ jsx(RowOnValueLineContext, {
151
+ value: true,
152
+ children: /* @__PURE__ */ jsx(SelectValue, { className: "xb3r6kr xlyipyv xuxw1ft" })
153
+ });
151
154
  $[0] = t1;
152
155
  } else t1 = $[0];
153
156
  let t2;