@kanso-labs/kanso-ui 0.40.8 → 0.40.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/avatar/index.d.ts +7 -0
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.js +7 -3
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +4 -1
- package/dist/components/popover/index.js +239 -137
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +3 -1
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.js +1 -1
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/search-field/index.js +7 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +17 -1
- package/dist/components/segmented-button/index.js +132 -59
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/field/index.js +28 -49
- package/dist/field/index.js.map +1 -1
- package/dist/field/press.js +27 -0
- package/dist/field/press.js.map +1 -0
- package/dist/mark/initials.js +41 -26
- package/dist/mark/initials.js.map +1 -1
- package/dist/styles.css +20 -8
- package/package.json +1 -1
|
@@ -5,6 +5,15 @@ import { ToggleButtonGroupProps, ToggleButtonProps } from "react-aria-components
|
|
|
5
5
|
type SegmentedButtonProps = LabelledByAttribute & Omit<ToggleButtonGroupProps, 'className' | 'orientation' | 'style'> & {
|
|
6
6
|
/** A function may compute the class from the set's render state. */
|
|
7
7
|
className?: ToggleButtonGroupProps['className'];
|
|
8
|
+
/**
|
|
9
|
+
* Whether the chosen segment stays chosen when it is pressed again. On
|
|
10
|
+
* by default while one is chosen, since a radio group always holds a
|
|
11
|
+
* choice; `false` lets a press clear it, as React Aria's own default
|
|
12
|
+
* does. Off by default while several may be, where any of them can be
|
|
13
|
+
* turned off.
|
|
14
|
+
* @default true while one is chosen, false while several may be
|
|
15
|
+
*/
|
|
16
|
+
disallowEmptySelection?: boolean;
|
|
8
17
|
/**
|
|
9
18
|
* Whether a chosen segment draws a check before its label, as the page
|
|
10
19
|
* has it. `false` leaves the segment's own icon in place while selected,
|
|
@@ -57,10 +66,17 @@ type SegmentedButtonSegmentProps = Omit<ToggleButtonProps, 'children' | 'classNa
|
|
|
57
66
|
* how the chosen container moves: it slides between segments while one is
|
|
58
67
|
* chosen, and fades in place while several may be.
|
|
59
68
|
*
|
|
69
|
+
* Choosing one behaves as a radio group too, which React Aria's
|
|
70
|
+
* `ToggleButtonGroup` does not. The chosen segment stays chosen when it is
|
|
71
|
+
* pressed again, unless `disallowEmptySelection` is `false`. The arrow keys
|
|
72
|
+
* move to a segment and choose it, wrapping at either end, and Home and End
|
|
73
|
+
* choose the first and last. Choosing several keeps React Aria's keys: the
|
|
74
|
+
* arrows move between segments, and Space or Enter toggles the focused one.
|
|
75
|
+
*
|
|
60
76
|
* The call site's `className` and `style` land on the track, which is the
|
|
61
77
|
* element a layout positions.
|
|
62
78
|
*/
|
|
63
|
-
declare function SegmentedButton({ selectionMode, showSelectedIcon, ...props }: RefAttributes<HTMLDivElement> & SegmentedButtonProps): import("react").JSX.Element;
|
|
79
|
+
declare function SegmentedButton({ disallowEmptySelection, render, selectionMode, showSelectedIcon, ...props }: RefAttributes<HTMLDivElement> & SegmentedButtonProps): import("react").JSX.Element;
|
|
64
80
|
declare namespace SegmentedButton {
|
|
65
81
|
var Segment: typeof SegmentedButtonSegment;
|
|
66
82
|
}
|
|
@@ -8,12 +8,57 @@ import { focus } from "../../styles/focus.js";
|
|
|
8
8
|
import { useToggleGroupDisabled } from "../../hooks/useToggleGroupDisabled.js";
|
|
9
9
|
import { useRipple } from "../../hooks/useRipple.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
|
-
import { createContext, useContext } from "react";
|
|
11
|
+
import { createContext, createElement, useContext } from "react";
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { SelectionIndicator, ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
14
14
|
//#region src/components/segmented-button/index.tsx
|
|
15
15
|
const ShowSelectedIconContext = createContext(true);
|
|
16
16
|
const SelectionModeContext = createContext("single");
|
|
17
|
+
function keyOf(segment) {
|
|
18
|
+
const written = segment.dataset.key;
|
|
19
|
+
if (written === void 0) return null;
|
|
20
|
+
const key = JSON.parse(written);
|
|
21
|
+
return typeof key === "string" || typeof key === "number" ? key : null;
|
|
22
|
+
}
|
|
23
|
+
function radioGroupRenderer(render) {
|
|
24
|
+
return (domProps, renderProps) => {
|
|
25
|
+
const merged = {
|
|
26
|
+
...domProps,
|
|
27
|
+
onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)
|
|
28
|
+
};
|
|
29
|
+
return render === void 0 ? createElement("div", merged) : render(merged, renderProps);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function radioKeys(state, toolbar) {
|
|
33
|
+
return (event) => {
|
|
34
|
+
const group = event.currentTarget;
|
|
35
|
+
const segments = [...group.querySelectorAll("[data-key]:not([data-disabled])")].filter((segment) => segment.closest("[role=\"radiogroup\"]") === group);
|
|
36
|
+
const from = segments.findIndex((segment) => segment === event.target);
|
|
37
|
+
const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === "rtl");
|
|
38
|
+
if (from === -1 || step === null) {
|
|
39
|
+
toolbar?.(event);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
const segment = segments[step === "first" ? 0 : step === "last" ? segments.length - 1 : (from + step + segments.length) % segments.length];
|
|
45
|
+
const key = keyOf(segment);
|
|
46
|
+
if (key === null) return;
|
|
47
|
+
segment.focus();
|
|
48
|
+
state.setSelected(key, true);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function stepOf(key, rtl) {
|
|
52
|
+
switch (key) {
|
|
53
|
+
case "ArrowDown": return 1;
|
|
54
|
+
case "ArrowLeft": return rtl ? 1 : -1;
|
|
55
|
+
case "ArrowRight": return rtl ? -1 : 1;
|
|
56
|
+
case "ArrowUp": return -1;
|
|
57
|
+
case "End": return "last";
|
|
58
|
+
case "Home": return "first";
|
|
59
|
+
default: return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
17
62
|
`${spacing.sm}`;
|
|
18
63
|
`${spacing.sm}`;
|
|
19
64
|
const styles = {
|
|
@@ -181,11 +226,18 @@ function segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)
|
|
|
181
226
|
* how the chosen container moves: it slides between segments while one is
|
|
182
227
|
* chosen, and fades in place while several may be.
|
|
183
228
|
*
|
|
229
|
+
* Choosing one behaves as a radio group too, which React Aria's
|
|
230
|
+
* `ToggleButtonGroup` does not. The chosen segment stays chosen when it is
|
|
231
|
+
* pressed again, unless `disallowEmptySelection` is `false`. The arrow keys
|
|
232
|
+
* move to a segment and choose it, wrapping at either end, and Home and End
|
|
233
|
+
* choose the first and last. Choosing several keeps React Aria's keys: the
|
|
234
|
+
* arrows move between segments, and Space or Enter toggles the focused one.
|
|
235
|
+
*
|
|
184
236
|
* The call site's `className` and `style` land on the track, which is the
|
|
185
237
|
* element a layout positions.
|
|
186
238
|
*/
|
|
187
239
|
function SegmentedButton(t0) {
|
|
188
|
-
const $ = c(
|
|
240
|
+
const $ = c(29);
|
|
189
241
|
let T0;
|
|
190
242
|
let T1;
|
|
191
243
|
let T2;
|
|
@@ -194,18 +246,28 @@ function SegmentedButton(t0) {
|
|
|
194
246
|
let t3;
|
|
195
247
|
let t4;
|
|
196
248
|
let t5;
|
|
249
|
+
let t6;
|
|
250
|
+
let t7;
|
|
197
251
|
if ($[0] !== t0) {
|
|
198
|
-
const { selectionMode:
|
|
199
|
-
const selectionMode =
|
|
200
|
-
const showSelectedIcon =
|
|
252
|
+
const { disallowEmptySelection, render, selectionMode: t8, showSelectedIcon: t9, ...props } = t0;
|
|
253
|
+
const selectionMode = t8 === void 0 ? "single" : t8;
|
|
254
|
+
const showSelectedIcon = t9 === void 0 ? true : t9;
|
|
255
|
+
const single = selectionMode === "single";
|
|
201
256
|
T2 = ShowSelectedIconContext;
|
|
202
|
-
|
|
257
|
+
t7 = showSelectedIcon;
|
|
203
258
|
T1 = SelectionModeContext;
|
|
204
|
-
|
|
259
|
+
t6 = selectionMode;
|
|
205
260
|
T0 = ToggleButtonGroup;
|
|
206
261
|
t1 = props;
|
|
207
|
-
t2 =
|
|
208
|
-
|
|
262
|
+
t2 = disallowEmptySelection ?? single;
|
|
263
|
+
if ($[11] !== render || $[12] !== single) {
|
|
264
|
+
t3 = single ? radioGroupRenderer(render) : render;
|
|
265
|
+
$[11] = render;
|
|
266
|
+
$[12] = single;
|
|
267
|
+
$[13] = t3;
|
|
268
|
+
} else t3 = $[13];
|
|
269
|
+
t4 = selectionMode;
|
|
270
|
+
t5 = mergeStatefulStyles({ className: "x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0" }, props);
|
|
209
271
|
$[0] = t0;
|
|
210
272
|
$[1] = T0;
|
|
211
273
|
$[2] = T1;
|
|
@@ -215,6 +277,8 @@ function SegmentedButton(t0) {
|
|
|
215
277
|
$[6] = t3;
|
|
216
278
|
$[7] = t4;
|
|
217
279
|
$[8] = t5;
|
|
280
|
+
$[9] = t6;
|
|
281
|
+
$[10] = t7;
|
|
218
282
|
} else {
|
|
219
283
|
T0 = $[1];
|
|
220
284
|
T1 = $[2];
|
|
@@ -224,43 +288,49 @@ function SegmentedButton(t0) {
|
|
|
224
288
|
t3 = $[6];
|
|
225
289
|
t4 = $[7];
|
|
226
290
|
t5 = $[8];
|
|
291
|
+
t6 = $[9];
|
|
292
|
+
t7 = $[10];
|
|
227
293
|
}
|
|
228
|
-
let
|
|
229
|
-
if ($[
|
|
230
|
-
|
|
294
|
+
let t8;
|
|
295
|
+
if ($[14] !== T0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
|
|
296
|
+
t8 = /* @__PURE__ */ jsx(T0, {
|
|
231
297
|
...t1,
|
|
232
|
-
|
|
233
|
-
|
|
298
|
+
disallowEmptySelection: t2,
|
|
299
|
+
render: t3,
|
|
300
|
+
selectionMode: t4,
|
|
301
|
+
...t5
|
|
234
302
|
});
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
303
|
+
$[14] = T0;
|
|
304
|
+
$[15] = t1;
|
|
305
|
+
$[16] = t2;
|
|
306
|
+
$[17] = t3;
|
|
307
|
+
$[18] = t4;
|
|
308
|
+
$[19] = t5;
|
|
309
|
+
$[20] = t8;
|
|
310
|
+
} else t8 = $[20];
|
|
311
|
+
let t9;
|
|
312
|
+
if ($[21] !== T1 || $[22] !== t6 || $[23] !== t8) {
|
|
313
|
+
t9 = /* @__PURE__ */ jsx(T1, {
|
|
314
|
+
value: t6,
|
|
315
|
+
children: t8
|
|
246
316
|
});
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
} else
|
|
252
|
-
let
|
|
253
|
-
if ($[
|
|
254
|
-
|
|
255
|
-
value:
|
|
256
|
-
children:
|
|
317
|
+
$[21] = T1;
|
|
318
|
+
$[22] = t6;
|
|
319
|
+
$[23] = t8;
|
|
320
|
+
$[24] = t9;
|
|
321
|
+
} else t9 = $[24];
|
|
322
|
+
let t10;
|
|
323
|
+
if ($[25] !== T2 || $[26] !== t7 || $[27] !== t9) {
|
|
324
|
+
t10 = /* @__PURE__ */ jsx(T2, {
|
|
325
|
+
value: t7,
|
|
326
|
+
children: t9
|
|
257
327
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
} else
|
|
263
|
-
return
|
|
328
|
+
$[25] = T2;
|
|
329
|
+
$[26] = t7;
|
|
330
|
+
$[27] = t9;
|
|
331
|
+
$[28] = t10;
|
|
332
|
+
} else t10 = $[28];
|
|
333
|
+
return t10;
|
|
264
334
|
}
|
|
265
335
|
/**
|
|
266
336
|
* One segment. Its `id` is what selection is reported by, and its label is
|
|
@@ -268,7 +338,7 @@ function SegmentedButton(t0) {
|
|
|
268
338
|
* unchosen one draws whatever `icon` holds, if anything.
|
|
269
339
|
*/
|
|
270
340
|
function SegmentedButtonSegment(t0) {
|
|
271
|
-
const $ = c(
|
|
341
|
+
const $ = c(21);
|
|
272
342
|
const { children, disableRipple: t1, icon, onClick, onContextMenu, onKeyDown, onKeyUp, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, render, ...props } = t0;
|
|
273
343
|
const disableRipple = t1 === void 0 ? false : t1;
|
|
274
344
|
const selectionMode = useContext(SelectionModeContext);
|
|
@@ -299,37 +369,40 @@ function SegmentedButtonSegment(t0) {
|
|
|
299
369
|
} else t2 = $[6];
|
|
300
370
|
const ripple = useRipple(!disableRipple && props.isDisabled !== true && !disabledByGroup, t2);
|
|
301
371
|
const T0 = ToggleButton;
|
|
302
|
-
const t3 =
|
|
303
|
-
const t4 =
|
|
304
|
-
const t5 =
|
|
305
|
-
|
|
372
|
+
const t3 = selectionMode === "single" && props.id !== void 0 ? JSON.stringify(props.id) : void 0;
|
|
373
|
+
const t4 = toggleButtonRenderer(element, render);
|
|
374
|
+
const t5 = ripple.handlers;
|
|
375
|
+
const t6 = mergeStatefulStyles(segmentStyles(showSelectedIcon), props);
|
|
376
|
+
let t7;
|
|
306
377
|
if ($[7] !== children || $[8] !== icon || $[9] !== ripple || $[10] !== selectionMode || $[11] !== showSelectedIcon) {
|
|
307
|
-
|
|
378
|
+
t7 = segmentContent(children, icon, ripple, selectionMode, showSelectedIcon);
|
|
308
379
|
$[7] = children;
|
|
309
380
|
$[8] = icon;
|
|
310
381
|
$[9] = ripple;
|
|
311
382
|
$[10] = selectionMode;
|
|
312
383
|
$[11] = showSelectedIcon;
|
|
313
|
-
$[12] =
|
|
314
|
-
} else
|
|
315
|
-
let
|
|
316
|
-
if ($[13] !== T0 || $[14] !== props || $[15] !== ripple.handlers || $[16] !== t3 || $[17] !==
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
...props,
|
|
384
|
+
$[12] = t7;
|
|
385
|
+
} else t7 = $[12];
|
|
386
|
+
let t8;
|
|
387
|
+
if ($[13] !== T0 || $[14] !== props || $[15] !== ripple.handlers || $[16] !== t3 || $[17] !== t4 || $[18] !== t6 || $[19] !== t7) {
|
|
388
|
+
t8 = /* @__PURE__ */ jsx(T0, {
|
|
389
|
+
"data-key": t3,
|
|
390
|
+
render: t4,
|
|
321
391
|
...t5,
|
|
322
|
-
|
|
392
|
+
...props,
|
|
393
|
+
...t6,
|
|
394
|
+
children: t7
|
|
323
395
|
});
|
|
324
396
|
$[13] = T0;
|
|
325
397
|
$[14] = props;
|
|
326
398
|
$[15] = ripple.handlers;
|
|
327
399
|
$[16] = t3;
|
|
328
|
-
$[17] =
|
|
400
|
+
$[17] = t4;
|
|
329
401
|
$[18] = t6;
|
|
330
402
|
$[19] = t7;
|
|
331
|
-
|
|
332
|
-
|
|
403
|
+
$[20] = t8;
|
|
404
|
+
} else t8 = $[20];
|
|
405
|
+
return t8;
|
|
333
406
|
}
|
|
334
407
|
function segmentStyles(showSelectedIcon) {
|
|
335
408
|
return (state) => props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !showSelectedIcon && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","FocusableElement","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","stylex","createContext","useContext","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","LabelledByAttribute","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","Ripple","ReturnType","NonNullable","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","FORCED_COLORS","styles","label","k6CgDc","k7Eaqz","kVQacm","kg5iWk","kIyJzY","k1ekBW","kAMwcw","khDVqt","$$css","labelChosen","kAXs8y","labelReserved","k71WvV","keTefX","labelShifted","segment","kgeoSG","kGOzcv","kpsdNU","kEoFBp","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k8WAf4","kg3NbH","kVAEAm","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","SegmentedButtonProps","Omit","className","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","glyphFor","state","isSelected","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","reserves","undefined","glyph","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","render","element","aria","disabledByGroup","id","handlers","segmentStyles","ring","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } 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// 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// 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// That slot is drawn out of flow, and every segment that could ever use it\n// keeps room for it whether or not it is drawing one. Laid out in flow it\n// was part of the segment's content size, so the widest segment was\n// whichever one was chosen and the whole track changed width with the\n// 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 is absolute at the leading padding\n// edge and opens from 0 to 18dp, and the label's own margins open the space\n// it lands in, both over `durationShort2`. Two things here are not theirs.\n// The room is a margin on the label rather than padding on the segment,\n// because padding would be part of the content size the equal columns are\n// measured from — which is the thing being fixed. And it is split across\n// both of the label's sides while nothing is drawn, so a bare label stays\n// centred; Angular Material has no such case, since its toggles are sized\n// by their own content rather than by the widest of them.\n//\n// The cost is that a track able to draw a check is 26dp per segment wider\n// than its labels alone would ask for. It is not wider than it used to\n// get, though, and that falls out rather than being arranged: the reserve\n// puts every column at the widest label plus the room, which is exactly\n// what the widest column already measured while its own segment was the\n// chosen one. What changes is that the track is always that, instead of\n// only while the longest label is the one chosen.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\ntype 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// 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 label: {\n k6CgDc: \"x12w9bfk\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1ve1rmq\",\n kAMwcw: \"xpc4ca7\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n labelChosen: {\n kAXs8y: \"x1g12otp\",\n $$css: true\n },\n labelReserved: {\n k71WvV: \"x184gv5z\",\n keTefX: \"x1mjqfaz\",\n $$css: true\n },\n labelShifted: {\n k71WvV: \"x14z9mp\",\n keTefX: \"x1c5lys2\",\n $$css: true\n },\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: \"x18fpw6u\",\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};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\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' | '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 icon?: ReactNode;\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, showSelectedIcon: boolean): ReactNode {\n if (state.isSelected && showSelectedIcon) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\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, showSelectedIcon: 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 | !!!showSelectedIcon << 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, showSelectedIcon: boolean) {\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track.\n const reserves = showSelectedIcon || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, showSelectedIcon);\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, showSelectedIcon)} />\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 {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xnalus7 xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7 x1xp8n7a\"\n }\n }[!!(glyph !== null) << 0]}>\n {glyph}\n </span>}\n <span {...stylex.props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted), state.isSelected && !state.isDisabled && styles.labelChosen)}>\n {children}\n </span>\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 * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n const showSelectedIcon = useContext(ShowSelectedIconContext);\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 render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(showSelectedIcon), props)}>\n {segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)}\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(showSelectedIcon: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !showSelectedIcon && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default SegmentedButton;"],"mappings":";;;;;;;;;;;;;;AA0IA,MAAMmC,0BAA0BvB,cAAc,IAAI;AAKlD,MAAMwB,uBAAuBxB,cAA6B,QAAQ;AAS5C,GAAwBoB,QAAQW;AAC3B,GAAyBX,QAAQW;AAO5D,MAAMG,SAAS;CACbC,OAAO;EACLC,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;EAAAe,EAAA,MAAA1B;EAAA0B,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,QAAAC,MAAAD,EAAA,QAAAJ,SAAAI,EAAA,QAAAX,OAAAqC,YAAA1B,EAAA,QAAAM,MAAAN,EAAA,QAAAQ,MAAAR,EAAA,QAAAS,IAAA;EADrEC,KAAA,oBAAC,IAAD;GAAyB,QAAAJ;GAAqC,GAAMC;GAAe,GAAMX;GAAK,GAAMY;GACtGC,UAAAA;EADkB,CAAA;EAEHT,EAAA,MAAAC;EAAAD,EAAA,MAAAJ;EAAAI,EAAA,MAAAX,OAAAqC;EAAA1B,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAFbU;AAEa;AAQtB,SAASiB,cAAcrD,kBAA2B;CAChD,QAAQO,UAAmC/F,MAAamC,OAAOiB,SAASrC,MAAM+H,MAAM/C,MAAMC,aAAa7D,OAAO+C,kBAAkB/C,OAAOiD,mBAAmBW,MAAMC,cAAc,CAACR,oBAAoBrD,OAAOgD,yBAAyBY,MAAMG,cAAc/D,OAAO6C,eAAe;AAC/Q;AACAgC,gBAAgB+B,UAAUjB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","KeyboardEventHandler","ReactNode","RefAttributes","FocusableElement","Key","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","ToggleGroupState","stylex","createContext","createElement","useContext","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","LabelledByAttribute","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","GroupRender","Ripple","ReturnType","NonNullable","keyOf","segment","HTMLElement","written","dataset","key","undefined","JSON","parse","radioGroupRenderer","render","domProps","renderProps","merged","onKeyDownCapture","radioKeys","state","toolbar","HTMLDivElement","event","group","currentTarget","segments","querySelectorAll","filter","closest","from","findIndex","target","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","to","length","setSelected","rtl","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","FORCED_COLORS","styles","label","k6CgDc","k7Eaqz","kVQacm","kg5iWk","kIyJzY","k1ekBW","kAMwcw","khDVqt","$$css","labelChosen","kAXs8y","labelReserved","k71WvV","keTefX","labelShifted","kgeoSG","kGOzcv","kpsdNU","kEoFBp","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k8WAf4","kg3NbH","kVAEAm","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","SegmentedButtonProps","Omit","className","disallowEmptySelection","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","glyphFor","isSelected","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","reserves","glyph","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","t9","single","t10","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","element","aria","disabledByGroup","id","stringify","handlers","segmentStyles","ring","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps, ToggleGroupState } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, createElement, useContext } 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// 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// That slot is drawn out of flow, and every segment that could ever use it\n// keeps room for it whether or not it is drawing one. Laid out in flow it\n// was part of the segment's content size, so the widest segment was\n// whichever one was chosen and the whole track changed width with the\n// 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 is absolute at the leading padding\n// edge and opens from 0 to 18dp, and the label's own margins open the space\n// it lands in, both over `durationShort2`. Two things here are not theirs.\n// The room is a margin on the label rather than padding on the segment,\n// because padding would be part of the content size the equal columns are\n// measured from — which is the thing being fixed. And it is split across\n// both of the label's sides while nothing is drawn, so a bare label stays\n// centred; Angular Material has no such case, since its toggles are sized\n// by their own content rather than by the widest of them.\n//\n// The cost is that a track able to draw a check is 26dp per segment wider\n// than its labels alone would ask for. It is not wider than it used to\n// get, though, and that falls out rather than being arranged: the reserve\n// puts every column at the widest label plus the room, which is exactly\n// what the widest column already measured while its own segment was the\n// chosen one. What changes is that the track is always that, instead of\n// only while the longest label is the one chosen.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\ntype GroupRender = RACToggleButtonGroupProps['render'];\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\n\n// A segment's key, back from the attribute `SegmentedButtonSegment` writes\n// it into. JSON rather than the key as written, so a numeric key comes back\n// a number and matches the one React Aria's selection holds.\nfunction keyOf(segment: HTMLElement): Key | null {\n const written = segment.dataset.key;\n if (written === undefined) {\n return null;\n }\n const key: unknown = JSON.parse(written);\n return typeof key === 'string' || typeof key === 'number' ? key : null;\n}\n\n// The group's element, with `radioKeys` in place of React Aria's keyboard\n// handler, then handed to the call site's own `render` if it passed one.\nfunction radioGroupRenderer(render: GroupRender): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to a segment\n// and choose it, wrapping at the ends and passing over a disabled segment,\n// which is what the toolbar's own handler would otherwise do with focus\n// alone. Everything else — Tab, and an arrow held with a modifier the\n// browser may want — is handed to the toolbar as before.\nfunction radioKeys(state: ToggleGroupState, toolbar: KeyboardEventHandler<HTMLDivElement> | undefined): KeyboardEventHandler<HTMLDivElement> {\n return event => {\n const group = event.currentTarget;\n const segments = [...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])')].filter(segment => segment.closest('[role=\"radiogroup\"]') === group);\n const from = segments.findIndex(segment => segment === event.target);\n const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === 'rtl');\n if (from === -1 || step === null) {\n toolbar?.(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const to = step === 'first' ? 0 : step === 'last' ? segments.length - 1 : (from + step + segments.length) % segments.length;\n const segment = segments[to];\n const key = keyOf(segment);\n if (key === null) {\n return;\n }\n segment.focus();\n state.setSelected(key, true);\n };\n}\n\n// Where a key moves the choice in a radio group: one segment on, one back,\n// or to either end. Right and left follow the direction the track is drawn\n// in, read off the track itself rather than the locale, so a `dir` on a\n// wrapper turns them over as it turns the track over; up and down, and Home\n// and End, follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown':\n {\n return 1;\n }\n case 'ArrowLeft':\n {\n return rtl ? 1 : -1;\n }\n case 'ArrowRight':\n {\n return rtl ? -1 : 1;\n }\n case 'ArrowUp':\n {\n return -1;\n }\n case 'End':\n {\n return 'last';\n }\n case 'Home':\n {\n return 'first';\n }\n default:\n {\n return null;\n }\n }\n}\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// plus the gap between it and the label. Half of that room sits on each side\n// of the label while nothing is drawn, which is what keeps a bare label\n// centred; see `labelReserved`.\nconst GLYPH_SIZE = '18px';\nconst GLYPH_RESERVE = `calc(${GLYPH_SIZE} + ${spacing.sm})`;\nconst GLYPH_RESERVE_HALF = `calc((${GLYPH_SIZE} + ${spacing.sm}) / 2)`;\n\n// 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 label: {\n k6CgDc: \"x12w9bfk\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1ve1rmq\",\n kAMwcw: \"xpc4ca7\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n labelChosen: {\n kAXs8y: \"x1g12otp\",\n $$css: true\n },\n labelReserved: {\n k71WvV: \"x184gv5z\",\n keTefX: \"x1mjqfaz\",\n $$css: true\n },\n labelShifted: {\n k71WvV: \"x14z9mp\",\n keTefX: \"x1c5lys2\",\n $$css: true\n },\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: \"x18fpw6u\",\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};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | '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' | '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 icon?: ReactNode;\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, showSelectedIcon: boolean): ReactNode {\n if (state.isSelected && showSelectedIcon) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\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, showSelectedIcon: 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 | !!!showSelectedIcon << 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, showSelectedIcon: boolean) {\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track.\n const reserves = showSelectedIcon || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, showSelectedIcon);\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, showSelectedIcon)} />\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 {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xnalus7 xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7 x1xp8n7a\"\n }\n }[!!(glyph !== null) << 0]}>\n {glyph}\n </span>}\n <span {...stylex.props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted), state.isSelected && !state.isDisabled && styles.labelChosen)}>\n {children}\n </span>\n {ripple.surface}\n </>;\n };\n}\n\n/**\n * A row of two to five joined segments, of which one — or with\n * `selectionMode=\"multiple\"`, several — is chosen. Selection is React Aria's:\n * pass `selectedKeys` with `onSelectionChange` to control it, or\n * `defaultSelectedKeys` to let it keep its own. Give every segment an `id`,\n * which is the key selection is reported by.\n *\n * ```tsx\n * <SegmentedButton aria-label=\"Label\" defaultSelectedKeys={['first']}>\n * <SegmentedButton.Segment id=\"first\">First item</SegmentedButton.Segment>\n * <SegmentedButton.Segment id=\"second\">Second item</SegmentedButton.Segment>\n * </SegmentedButton>\n * ```\n *\n * Name the set with `aria-label` or `aria-labelledby`, one of which the\n * props require — nothing here labels it for you, and a set with no name is\n * a group a screen reader cannot announce. What it is announced as follows the selection mode: choosing one\n * is a radio group, choosing several a toolbar of two-state buttons. So does\n * how the chosen container moves: it slides between segments while one is\n * chosen, and fades in place while several may be.\n *\n * Choosing one behaves as a radio group too, which React Aria's\n * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is\n * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys\n * move to a segment and choose it, wrapping at either end, and Home and End\n * choose the first and last. Choosing several keeps React Aria's keys: the\n * arrows move between segments, and Space or Enter toggles the focused one.\n *\n * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n disallowEmptySelection,\n render,\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n const single = selectionMode === 'single';\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} disallowEmptySelection={disallowEmptySelection ?? single} render={single ? radioGroupRenderer(render) : render} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n const showSelectedIcon = useContext(ShowSelectedIconContext);\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' && props.id !== undefined ? JSON.stringify(props.id) : undefined} render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(showSelectedIcon), props)}>\n {segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)}\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(showSelectedIcon: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !showSelectedIcon && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\n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