@kanso-labs/react-native-kanso-ui 0.11.24 → 0.11.26
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/README.md +27 -0
- package/dist/calendar/index.js +105 -41
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +7 -0
- package/dist/calendar/styles.js.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -2
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +24 -3
- package/dist/components/carousel/index.js +58 -35
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/color-picker/index.js +98 -93
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/dialog/index.js +7 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +2 -2
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.js +108 -88
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/sheet/index.js +8 -4
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +112 -161
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +4 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/number/parser.js +3 -3
- package/dist/number/parser.js.map +1 -1
- package/dist/overlay/keyboard.js +100 -27
- package/dist/overlay/keyboard.js.map +1 -1
- package/dist/segments/index.js +1 -1
- package/dist/segments/index.js.map +1 -1
- package/package.json +15 -11
|
@@ -139,6 +139,21 @@ function cornersOf(radius, first, last) {
|
|
|
139
139
|
borderTopStartRadius: first ? radius : 0
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Whether a glyph would cut a label: some segment that could draw one has a
|
|
144
|
+
* label wider than what is left of the segment once its rules, the 8dp of
|
|
145
|
+
* padding it always keeps and the glyph's room are taken out. Only a segment
|
|
146
|
+
* that could draw a glyph counts, since a long label beside a slot it never
|
|
147
|
+
* fills is no reason for its neighbours to drop theirs. False until the
|
|
148
|
+
* segments are laid out.
|
|
149
|
+
*/
|
|
150
|
+
function crowdedOf(segments, labels, places, showSelectedIcon, { spacing }) {
|
|
151
|
+
return segments.some(({ props }, index) => {
|
|
152
|
+
const label = labels.get(props.id);
|
|
153
|
+
const place = places.get(props.id);
|
|
154
|
+
return hasLabel(props.children) && reservesGlyph(props, showSelectedIcon) && label !== void 0 && place !== void 0 && label + GLYPH_SIZE + spacing.sm > place.width - ruleOf(index) - RULE_WIDTH - spacing.sm * 2;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
142
157
|
function hasLabel(children) {
|
|
143
158
|
return children !== void 0 && children !== null && children !== false && children !== "";
|
|
144
159
|
}
|
|
@@ -331,7 +346,7 @@ function samePlace(known, place) {
|
|
|
331
346
|
* `style`, `ref` and `testID` land on the track.
|
|
332
347
|
*/
|
|
333
348
|
function SegmentedButton(t0) {
|
|
334
|
-
const $ = c(
|
|
349
|
+
const $ = c(82);
|
|
335
350
|
let children;
|
|
336
351
|
let defaultSelectedKeys;
|
|
337
352
|
let disallowEmptySelection;
|
|
@@ -418,6 +433,7 @@ function SegmentedButton(t0) {
|
|
|
418
433
|
const [opening, setOpening] = useState(chosen);
|
|
419
434
|
if (opening !== void 0 && opening !== chosen) setOpening(void 0);
|
|
420
435
|
const basis = basisOf(segments, labels, showSelectedIcon, theme);
|
|
436
|
+
const crowded = crowdedOf(segments, labels, places, showSelectedIcon, theme);
|
|
421
437
|
let t9;
|
|
422
438
|
if ($[22] !== setPlaces) {
|
|
423
439
|
t9 = (key, place) => {
|
|
@@ -427,10 +443,11 @@ function SegmentedButton(t0) {
|
|
|
427
443
|
$[23] = t9;
|
|
428
444
|
} else t9 = $[23];
|
|
429
445
|
let t10;
|
|
430
|
-
if ($[24] !== basis || $[25] !==
|
|
446
|
+
if ($[24] !== basis || $[25] !== crowded || $[26] !== opening || $[27] !== places || $[28] !== segments.length || $[29] !== selectionMode || $[30] !== showSelectedIcon || $[31] !== state || $[32] !== t9) {
|
|
431
447
|
t10 = {
|
|
432
448
|
basis,
|
|
433
449
|
count: segments.length,
|
|
450
|
+
crowded,
|
|
434
451
|
onPlace: t9,
|
|
435
452
|
opening,
|
|
436
453
|
places,
|
|
@@ -439,15 +456,16 @@ function SegmentedButton(t0) {
|
|
|
439
456
|
state
|
|
440
457
|
};
|
|
441
458
|
$[24] = basis;
|
|
442
|
-
$[25] =
|
|
443
|
-
$[26] =
|
|
444
|
-
$[27] =
|
|
445
|
-
$[28] =
|
|
446
|
-
$[29] =
|
|
447
|
-
$[30] =
|
|
448
|
-
$[31] =
|
|
449
|
-
$[32] =
|
|
450
|
-
|
|
459
|
+
$[25] = crowded;
|
|
460
|
+
$[26] = opening;
|
|
461
|
+
$[27] = places;
|
|
462
|
+
$[28] = segments.length;
|
|
463
|
+
$[29] = selectionMode;
|
|
464
|
+
$[30] = showSelectedIcon;
|
|
465
|
+
$[31] = state;
|
|
466
|
+
$[32] = t9;
|
|
467
|
+
$[33] = t10;
|
|
468
|
+
} else t10 = $[33];
|
|
451
469
|
const context = t10;
|
|
452
470
|
let T0;
|
|
453
471
|
let t11;
|
|
@@ -455,81 +473,82 @@ function SegmentedButton(t0) {
|
|
|
455
473
|
let t13;
|
|
456
474
|
let t14;
|
|
457
475
|
let t15;
|
|
458
|
-
if ($[
|
|
476
|
+
if ($[34] !== chosen || $[35] !== crowded || $[36] !== held || $[37] !== isDisabled || $[38] !== places || $[39] !== props || $[40] !== segments || $[41] !== showSelectedIcon || $[42] !== single || $[43] !== style || $[44] !== theme) {
|
|
459
477
|
let t16;
|
|
460
|
-
if ($[
|
|
478
|
+
if ($[51] !== chosen || $[52] !== held) {
|
|
461
479
|
t16 = (t17) => {
|
|
462
480
|
const { props: own } = t17;
|
|
463
481
|
return own.id === (chosen ?? held);
|
|
464
482
|
};
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
$[
|
|
468
|
-
} else t16 = $[
|
|
483
|
+
$[51] = chosen;
|
|
484
|
+
$[52] = held;
|
|
485
|
+
$[53] = t16;
|
|
486
|
+
} else t16 = $[53];
|
|
469
487
|
const segment = segments.find(t16);
|
|
470
488
|
T0 = View;
|
|
471
|
-
if ($[
|
|
489
|
+
if ($[54] !== theme) {
|
|
472
490
|
t11 = reachOf(theme);
|
|
473
|
-
$[
|
|
474
|
-
$[
|
|
475
|
-
} else t11 = $[
|
|
491
|
+
$[54] = theme;
|
|
492
|
+
$[55] = t11;
|
|
493
|
+
} else t11 = $[55];
|
|
476
494
|
t12 = single ? "radiogroup" : "toolbar";
|
|
477
495
|
t13 = props;
|
|
478
|
-
if ($[
|
|
496
|
+
if ($[56] !== style || $[57] !== theme) {
|
|
479
497
|
t14 = composeStyles(stylesOf(theme).track, style);
|
|
480
|
-
$[
|
|
481
|
-
$[
|
|
482
|
-
$[
|
|
483
|
-
} else t14 = $[
|
|
498
|
+
$[56] = style;
|
|
499
|
+
$[57] = theme;
|
|
500
|
+
$[58] = t14;
|
|
501
|
+
} else t14 = $[58];
|
|
484
502
|
t15 = single ? /* @__PURE__ */ jsx(Indicator, {
|
|
485
|
-
color: containerOf(theme, isDisabled || segment?.props.isDisabled === true, showSelectedIcon && hasLabel(segment?.props.children)),
|
|
503
|
+
color: containerOf(theme, isDisabled || segment?.props.isDisabled === true, showSelectedIcon && !crowded && hasLabel(segment?.props.children)),
|
|
486
504
|
place: segment === void 0 ? void 0 : places.get(segment.props.id),
|
|
487
505
|
selected: segment === void 0 ? void 0 : chosen
|
|
488
506
|
}) : null;
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
$[
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
495
|
-
$[
|
|
496
|
-
$[
|
|
497
|
-
$[
|
|
498
|
-
$[
|
|
499
|
-
$[
|
|
500
|
-
$[
|
|
501
|
-
$[
|
|
502
|
-
$[
|
|
503
|
-
$[
|
|
504
|
-
$[
|
|
507
|
+
$[34] = chosen;
|
|
508
|
+
$[35] = crowded;
|
|
509
|
+
$[36] = held;
|
|
510
|
+
$[37] = isDisabled;
|
|
511
|
+
$[38] = places;
|
|
512
|
+
$[39] = props;
|
|
513
|
+
$[40] = segments;
|
|
514
|
+
$[41] = showSelectedIcon;
|
|
515
|
+
$[42] = single;
|
|
516
|
+
$[43] = style;
|
|
517
|
+
$[44] = theme;
|
|
518
|
+
$[45] = T0;
|
|
519
|
+
$[46] = t11;
|
|
520
|
+
$[47] = t12;
|
|
521
|
+
$[48] = t13;
|
|
522
|
+
$[49] = t14;
|
|
523
|
+
$[50] = t15;
|
|
505
524
|
} else {
|
|
506
|
-
T0 = $[
|
|
507
|
-
t11 = $[
|
|
508
|
-
t12 = $[
|
|
509
|
-
t13 = $[
|
|
510
|
-
t14 = $[
|
|
511
|
-
t15 = $[
|
|
525
|
+
T0 = $[45];
|
|
526
|
+
t11 = $[46];
|
|
527
|
+
t12 = $[47];
|
|
528
|
+
t13 = $[48];
|
|
529
|
+
t14 = $[49];
|
|
530
|
+
t15 = $[50];
|
|
512
531
|
}
|
|
513
532
|
let t16;
|
|
514
|
-
if ($[
|
|
533
|
+
if ($[59] !== segments) {
|
|
515
534
|
t16 = segments.map(_temp);
|
|
516
|
-
$[
|
|
517
|
-
$[
|
|
518
|
-
} else t16 = $[
|
|
535
|
+
$[59] = segments;
|
|
536
|
+
$[60] = t16;
|
|
537
|
+
} else t16 = $[60];
|
|
519
538
|
let t17;
|
|
520
|
-
if ($[
|
|
539
|
+
if ($[61] !== context || $[62] !== t16) {
|
|
521
540
|
t17 = /* @__PURE__ */ jsx(GroupContext, {
|
|
522
541
|
value: context,
|
|
523
542
|
children: t16
|
|
524
543
|
});
|
|
525
|
-
$[
|
|
526
|
-
$[
|
|
527
|
-
$[
|
|
528
|
-
} else t17 = $[
|
|
544
|
+
$[61] = context;
|
|
545
|
+
$[62] = t16;
|
|
546
|
+
$[63] = t17;
|
|
547
|
+
} else t17 = $[63];
|
|
529
548
|
let t18;
|
|
530
|
-
if ($[
|
|
549
|
+
if ($[64] !== role || $[65] !== segments || $[66] !== setLabels) {
|
|
531
550
|
let t19;
|
|
532
|
-
if ($[
|
|
551
|
+
if ($[68] !== role || $[69] !== setLabels) {
|
|
533
552
|
t19 = (t20) => {
|
|
534
553
|
const { props: own_0 } = t20;
|
|
535
554
|
return hasLabel(own_0.children) ? /* @__PURE__ */ jsx(Text, {
|
|
@@ -539,28 +558,28 @@ function SegmentedButton(t0) {
|
|
|
539
558
|
children: own_0.children
|
|
540
559
|
}, own_0.id) : null;
|
|
541
560
|
};
|
|
542
|
-
$[
|
|
543
|
-
$[
|
|
544
|
-
$[
|
|
545
|
-
} else t19 = $[
|
|
561
|
+
$[68] = role;
|
|
562
|
+
$[69] = setLabels;
|
|
563
|
+
$[70] = t19;
|
|
564
|
+
} else t19 = $[70];
|
|
546
565
|
t18 = segments.map(t19);
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
} else t18 = $[
|
|
566
|
+
$[64] = role;
|
|
567
|
+
$[65] = segments;
|
|
568
|
+
$[66] = setLabels;
|
|
569
|
+
$[67] = t18;
|
|
570
|
+
} else t18 = $[67];
|
|
552
571
|
let t19;
|
|
553
|
-
if ($[
|
|
572
|
+
if ($[71] !== t18) {
|
|
554
573
|
t19 = /* @__PURE__ */ jsx(View, {
|
|
555
574
|
"aria-hidden": true,
|
|
556
575
|
style: styles.measurer,
|
|
557
576
|
children: t18
|
|
558
577
|
});
|
|
559
|
-
$[
|
|
560
|
-
$[
|
|
561
|
-
} else t19 = $[
|
|
578
|
+
$[71] = t18;
|
|
579
|
+
$[72] = t19;
|
|
580
|
+
} else t19 = $[72];
|
|
562
581
|
let t20;
|
|
563
|
-
if ($[
|
|
582
|
+
if ($[73] !== T0 || $[74] !== t11 || $[75] !== t12 || $[76] !== t13 || $[77] !== t14 || $[78] !== t15 || $[79] !== t17 || $[80] !== t19) {
|
|
564
583
|
t20 = /* @__PURE__ */ jsxs(T0, {
|
|
565
584
|
hitSlop: t11,
|
|
566
585
|
role: t12,
|
|
@@ -572,16 +591,16 @@ function SegmentedButton(t0) {
|
|
|
572
591
|
t19
|
|
573
592
|
]
|
|
574
593
|
});
|
|
575
|
-
$[
|
|
576
|
-
$[
|
|
577
|
-
$[
|
|
578
|
-
$[
|
|
579
|
-
$[
|
|
580
|
-
$[
|
|
581
|
-
$[
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
584
|
-
} else t20 = $[
|
|
594
|
+
$[73] = T0;
|
|
595
|
+
$[74] = t11;
|
|
596
|
+
$[75] = t12;
|
|
597
|
+
$[76] = t13;
|
|
598
|
+
$[77] = t14;
|
|
599
|
+
$[78] = t15;
|
|
600
|
+
$[79] = t17;
|
|
601
|
+
$[80] = t19;
|
|
602
|
+
$[81] = t20;
|
|
603
|
+
} else t20 = $[81];
|
|
585
604
|
return t20;
|
|
586
605
|
}
|
|
587
606
|
/**
|
|
@@ -665,7 +684,6 @@ function SegmentedButtonSegment(t0) {
|
|
|
665
684
|
const selected = state?.selectedKeys.has(id) ?? false;
|
|
666
685
|
const disabled = ownDisabled || state?.isDisabled === true;
|
|
667
686
|
const labelled = hasLabel(children);
|
|
668
|
-
const marked = showSelectedIcon && labelled;
|
|
669
687
|
let t3;
|
|
670
688
|
if ($[17] !== children || $[18] !== icon || $[19] !== id || $[20] !== showSelectedIcon) {
|
|
671
689
|
t3 = reservesGlyph({
|
|
@@ -680,14 +698,16 @@ function SegmentedButtonSegment(t0) {
|
|
|
680
698
|
$[21] = t3;
|
|
681
699
|
} else t3 = $[21];
|
|
682
700
|
const reserves = t3;
|
|
683
|
-
const
|
|
701
|
+
const crowded = group?.crowded ?? false;
|
|
702
|
+
const checks = showSelectedIcon && labelled && !crowded;
|
|
703
|
+
const glyph = selected && checks ? CHECK : (crowded && labelled ? void 0 : icon) ?? null;
|
|
684
704
|
const drawn = glyph !== null;
|
|
685
705
|
const first = index === 0;
|
|
686
706
|
const last = index === (group?.count ?? 0) - 1;
|
|
687
707
|
const { radii, spacing } = theme;
|
|
688
708
|
const content = contentOf(theme, {
|
|
689
709
|
disabled,
|
|
690
|
-
marked,
|
|
710
|
+
marked: checks,
|
|
691
711
|
selected
|
|
692
712
|
});
|
|
693
713
|
const corners = cornersOf(radii.pill, first, last);
|
|
@@ -831,7 +851,7 @@ function SegmentedButtonSegment(t0) {
|
|
|
831
851
|
onPress: t8,
|
|
832
852
|
style: t9,
|
|
833
853
|
children: [
|
|
834
|
-
/* @__PURE__ */ jsx(Animated.View, { style: composeStyles(styles.ownIndicator, corners, { backgroundColor: containerOf(theme, disabled,
|
|
854
|
+
/* @__PURE__ */ jsx(Animated.View, { style: composeStyles(styles.ownIndicator, corners, { backgroundColor: containerOf(theme, disabled, checks) }, motion.fill) }),
|
|
835
855
|
t10,
|
|
836
856
|
t15,
|
|
837
857
|
t16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","ReactElement","ReactNode","Ref","GestureResponderEvent","LayoutChangeEvent","PressableProps","StyleProp","TextStyle","ViewProps","ViewStyle","AnimatedStyle","Key","ToggleGroupState","Children","createContext","Fragment","isValidElement","use","useLayoutEffect","useMemo","useRef","useState","Text","NativeText","Pressable","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","useToggleGroupState","IconStyle","ResolvedTheme","toggleState","CheckGlyph","IconStyleContext","hitSlop","usePressFeedback","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","GroupContextValue","basis","count","onPlace","key","place","Place","opening","places","ReadonlyMap","selectionMode","SelectionMode","showSelectedIcon","state","LabelledBy","width","x","SegmentedButtonProps","Omit","children","defaultSelectedKeys","Iterable","disallowEmptySelection","isDisabled","onSelectionChange","keys","Set","ref","selectedKeys","style","SegmentedButtonSegmentProps","disableRipple","icon","id","GLYPH_SIZE","RULE_WIDTH","CHECK","GroupContext","IndexContext","styles","create","glyph","alignItems","flexShrink","height","justifyContent","glyphSlot","overflow","indicator","bottom","position","start","top","label","minWidth","measurer","opacity","pointerEvents","ownIndicator","end","spacer","flexDirection","stylesOf","colors","radii","sizing","spacing","clip","borderRadius","pill","first","borderStartWidth","segment","borderColor","outline","borderWidth","minHeight","controlSm","paddingHorizontal","sm","track","alignSelf","maxWidth","reachOf","basisOf","segments","labels","index","props","entries","labelled","hasLabel","get","undefined","content","reservesGlyph","Math","max","md","ruleOf","containerOf","stateLayerOpacity","disabled","marked","onSurface","disabledContainer","secondaryContainer","secondary","contentOf","selected","disabledContent","onSecondaryContainer","onSecondary","cornersOf","radius","last","Pick","borderBottomEndRadius","borderBottomStartRadius","borderTopEndRadius","borderTopStartRadius","iconStyleOf","color","size","Indicator","t0","$","_c","theme","motion","reduceMotion","rest","setRest","shift","shown","drawnAt","drawn","offset","abs","t1","durationMedium1","easingEmphasized","slide","duration","easing","bezier","current","set","from","moves","t2","motionStyle","transform","translateX","t3","t4","t5","Symbol","for","restThen","t6","t7","backgroundColor","t8","t9","measureThen","setLabels","update","event","nativeEvent","layout","Map","placeThen","onLayout","samePlace","known","SegmentedButton","role","single","segmentsOf","setPlaces","at","chosen","held","setHeld","setOpening","t10","length","context","T0","t11","t12","t13","t14","t15","t16","t17","own","find","map","_temp","t18","t19","t20","own_0","each","SegmentedButtonSegment","onBlur","onFocus","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","ownHitSlop","ownDisabled","group","several","has","reserves","corners","give","reserve","leading","leadingFloor","trailing","room","useSegmentMotion","fades","filled","feedback","handlers","toggleThen","flexGrow","ring","layer","slot","gap","fill","toArray","flatMap","child","type","toggleKey","timing","durationShort2","easingStandard","Segment","_c","NativeText"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactElement, ReactNode, Ref } from 'react'\nimport type {\n GestureResponderEvent,\n LayoutChangeEvent,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key } from 'react-stately'\nimport type { ToggleGroupState } from 'react-stately/useToggleGroupState'\n\nimport {\n Children,\n createContext,\n Fragment,\n isValidElement,\n use,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Text as NativeText, Pressable, StyleSheet, View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { useToggleGroupState } from 'react-stately/useToggleGroupState'\n\nimport type { IconStyle } from '../../glyphs/icon-style'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { toggleState } from '../../button'\nimport { CheckGlyph } from '../../glyphs'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The segmented buttons page's outlined segmented button, as kanso-ui's\n// SegmentedButton draws it: two to five segments joined into one outlined\n// track, of which one or several are chosen. A segment is Button's default\n// size and type role, a 40dp container with a label-large label, which is\n// what that page gives too.\n//\n// What a screen reader hears follows the selection mode, as on web. Choosing\n// one is a radio group, so the track is a `radiogroup` and each segment a\n// `radio` reporting whether it is checked. Choosing several is a `toolbar` of\n// buttons, each reporting whether it is selected through `toggleState`, as a\n// toggle Button does. The selection is React Stately's toggle group state, as\n// web's is React Aria's, and in a set that chooses one, the chosen segment\n// stays chosen when pressed again unless `disallowEmptySelection` is `false`.\n//\n// **The segments are one track.** Each carries the page's 1dp outline, and\n// each after the first drops its leading edge, so neighbours share one rule.\n// The outer ends take the page's fully rounded shape and the joins are\n// square. Every segment is the same width, as wide as the widest one asks\n// for: the labels are measured off screen, and each segment is handed the\n// widest one's width, so a track squeezed into less room shares it out\n// equally. The track is as wide as that, and never wider than what\n// holds it.\n//\n// **A chosen segment draws a check** in the page's 18dp icon slot, in place\n// of its `icon`. `showSelectedIcon={false}` turns it off, and the chosen\n// segment then takes the secondary role with its label on it, since the\n// page's own chosen container is too faint to say which is chosen by itself.\n// A segment with an icon and no label keeps its icon when chosen, and takes\n// the secondary role too. Every segment that could draw the slot keeps room\n// for it whether or not it does, split either side of the label while\n// nothing is drawn, so the track never changes width with the choice. That\n// room gives way before the label does: a squeezed segment gives back the\n// room first, then 4dp of its 12dp padding, and only then cuts its label\n// short with an ellipsis. The slot and the room around it ease over\n// `durationShort2` on the standard curve, and the check opens from its\n// centre.\n//\n// **The chosen container moves.** In a set that chooses one it is a view of\n// the track's own, behind the segments, so the labels and the rules are\n// drawn over it, and it slides between segments over `durationMedium1` on the\n// emphasized curve. It is drawn inside the track's outline, so it takes the\n// rounded shape at either end and square corners between. It can only be\n// placed once the segments are laid out, so until the choice first moves, the\n// segment the set opened on draws a container of its own in the same place.\n// Without it, the chosen label would stand on the bare surface in the frames\n// before that layout, which is unreadable where no check marks it, since its\n// colour is then the one meant for the secondary role. In a set that chooses\n// several there is no one segment for it to be at, so each segment fades its\n// own in and out where it is, over `durationShort2`. Both happen at once\n// under reduced motion.\n//\n// The state layer, the ripple and the focus ring are src/press's, in the\n// label's colour, over the chosen container. A segment's target reaches 4dp\n// above and below the 40dp track, to the page's 48dp, and not across, since\n// the segments sit flush.\n//\n// **Disabled is the page's colour at an opacity, translucent**, as a\n// button's is: the label on-surface at `disabledContent`, and the rule and a\n// chosen segment's container on-surface at `disabledContainer`.\n//\n// Two departures from web. The arrow keys do not move between the segments\n// or choose one: each segment is a stop of its own for a hardware keyboard,\n// and activating it there chooses it. And a label cut short has no `title` to\n// show it whole, which a screen reader does not need, since it reads all of\n// it.\n\n/** What the set reads from the segments, and a segment from the set. */\ntype GroupContextValue = {\n /** The basis each segment takes, once every label is measured. */\n readonly basis: number | undefined\n readonly count: number\n /** Records where a segment was laid out, for the chosen container. */\n readonly onPlace: (key: Key, place: Place) => void\n /**\n * The segment a set that chooses one opened on, until the choice first\n * moves, which draws the chosen container itself meanwhile.\n */\n readonly opening: Key | undefined\n readonly places: ReadonlyMap<Key, Place>\n readonly selectionMode: SelectionMode\n readonly showSelectedIcon: boolean\n readonly state: ToggleGroupState\n}\n\n/** A name for the set: its own label, or the id of what labels it. */\ntype LabelledBy =\n | { readonly 'aria-label': string; readonly 'aria-labelledby'?: string }\n | { readonly 'aria-label'?: string; readonly 'aria-labelledby': string }\n\n/** Where a segment was laid out in the track. */\ntype Place = {\n readonly width: number\n readonly x: number\n}\n\ntype SegmentedButtonProps = LabelledBy &\n Omit<ViewProps, 'aria-label' | 'aria-labelledby' | 'children' | 'style'> & {\n /** The segments, each a `SegmentedButton.Segment` with an `id`. */\n readonly children?: ReactNode\n /** The keys chosen at first, when the set keeps its own selection. */\n readonly defaultSelectedKeys?: Iterable<Key>\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. Off by default while several\n * may be, where any of them can be turned off.\n * @default true while one is chosen, false while several may be\n */\n readonly disallowEmptySelection?: boolean\n /**\n * Disables every segment.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Called with the chosen keys when the choice changes. */\n readonly onSelectionChange?: (keys: Set<Key>) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** The chosen keys, when the call site holds the selection. */\n readonly selectedKeys?: Iterable<Key>\n /**\n * Whether one segment is chosen at a time, or several.\n * @default 'single'\n */\n readonly selectionMode?: SelectionMode\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 chosen,\n * and draws the chosen segment on the stronger secondary container.\n * @default true\n */\n readonly showSelectedIcon?: boolean\n readonly style?: StyleProp<ViewStyle>\n }\n\ntype SegmentedButtonSegmentProps = Omit<\n PressableProps,\n 'children' | 'disabled' | 'id' | 'style'\n> & {\n /** The segment's label. */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The hover and pressed state layers are unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * An icon before the label, in the page's 18dp slot, which hands it the\n * label's colour and its size through `useIconStyle()`. Replaced by the\n * check while the segment is chosen, unless the set turns that off.\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 readonly icon?: ReactNode\n /** The key the selection reports the segment by. */\n readonly id: Key\n /**\n * Disables the segment alone.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\ntype SelectionMode = 'multiple' | 'single'\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// and the 8dp gap between it and the label. A literal, as on web: the theme\n// has no scale for icon sizes.\nconst GLYPH_SIZE = 18\n\n// The rule every segment draws.\nconst RULE_WIDTH = 1\n\nconst CHECK = <CheckGlyph />\n\nconst GroupContext = createContext<GroupContextValue | null>(null)\n\n// Where in the track a segment sits, which decides its corners and its rule.\nconst IndexContext = createContext(0)\n\nconst styles = StyleSheet.create({\n // A glyph sized rather than filling its slot, so a slot part way through\n // opening clips it instead of squashing it.\n glyph: {\n alignItems: 'center',\n flexShrink: 0,\n height: GLYPH_SIZE,\n justifyContent: 'center',\n width: GLYPH_SIZE,\n },\n // Opens from its centre, so the check wipes out from the middle rather\n // than arriving at full size.\n glyphSlot: {\n alignItems: 'center',\n flexShrink: 0,\n height: GLYPH_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n // The chosen container of a set that chooses one: the track's own view,\n // behind the segments, at the start of the track and moved from there to\n // the chosen segment.\n indicator: {\n bottom: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // A label holds its width while the spacers beside it give theirs back,\n // and is cut short only at the width it is handed.\n label: {\n flexShrink: 0,\n minWidth: 0,\n },\n // The labels measured off screen, at their own widths, for the basis.\n measurer: {\n alignItems: 'flex-start',\n opacity: 0,\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // A segment's own chosen container, inside its rule: in a set that chooses\n // several, and in the segment a set that chooses one opened on.\n ownIndicator: {\n bottom: 0,\n end: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // Either side of the label, holding the room a glyph needs, given back\n // before the label is cut.\n spacer: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 1,\n justifyContent: 'flex-end',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, radii, sizing, spacing }) =>\n StyleSheet.create({\n // What the chosen container of a set that chooses one is drawn in: the\n // track's own outline, so the container takes an end's rounded shape at\n // either end and square corners between, wherever it is.\n clip: {\n borderRadius: radii.pill,\n bottom: 0,\n end: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // The first segment draws the leading rule the others leave to it.\n first: {\n borderStartWidth: RULE_WIDTH,\n },\n segment: {\n alignItems: 'center',\n borderColor: colors.outline,\n borderStartWidth: 0,\n borderWidth: RULE_WIDTH,\n flexDirection: 'row',\n flexShrink: 1,\n justifyContent: 'center',\n minHeight: sizing.controlSm,\n minWidth: 0,\n paddingHorizontal: spacing.sm,\n },\n // As wide as what is in it and never wider than what holds it, from the\n // start edge.\n track: {\n alignSelf: 'flex-start',\n flexDirection: 'row',\n maxWidth: '100%',\n },\n }),\n)\n\n// The track reaches as far as its segments' targets, since iOS and Android\n// hand a touch to a view only once its parent has taken it.\nconst reachOf = themedStyles(({ sizing }) => hitSlop(sizing.controlSm))\n\n/**\n * The width every segment takes: the widest one's, which is its label, its\n * padding, the room it keeps for a glyph and its rule. Undefined until every\n * label has been measured.\n */\nfunction basisOf(\n segments: readonly ReactElement<SegmentedButtonSegmentProps>[],\n labels: ReadonlyMap<Key, number>,\n showSelectedIcon: boolean,\n { spacing }: ResolvedTheme,\n): number | undefined {\n let basis = 0\n\n for (const [index, { props }] of segments.entries()) {\n const labelled = hasLabel(props.children)\n const label = labels.get(props.id)\n\n if (labelled && label === undefined) {\n return undefined\n }\n\n const content = labelled\n ? (label ?? 0) +\n (reservesGlyph(props, showSelectedIcon) ? GLYPH_SIZE + spacing.sm : 0)\n : props.icon === undefined\n ? 0\n : GLYPH_SIZE\n\n basis = Math.max(\n basis,\n content + spacing.md * 2 + ruleOf(index) + RULE_WIDTH,\n )\n }\n\n return basis\n}\n\n/**\n * The chosen container's colour: the page's secondary container, the\n * stronger secondary where no check marks the choice, and on-surface at the\n * disabled opacity while the segment is disabled.\n */\nfunction containerOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n disabled: boolean,\n marked: boolean,\n): string {\n if (disabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContainer)\n }\n return marked ? colors.secondaryContainer : colors.secondary\n}\n\n/**\n * The label's colour, which the glyph, the state layer and the ripple take\n * too.\n */\nfunction contentOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n {\n disabled,\n marked,\n selected,\n }: {\n readonly disabled: boolean\n readonly marked: boolean\n readonly selected: boolean\n },\n): string {\n if (disabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n }\n if (!selected) {\n return colors.onSurface\n }\n return marked ? colors.onSecondaryContainer : colors.onSecondary\n}\n\n/** A segment's corners: rounded at the ends of the track, square between. */\nfunction cornersOf(\n radius: number,\n first: boolean,\n last: boolean,\n): Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n> {\n return {\n borderBottomEndRadius: last ? radius : 0,\n borderBottomStartRadius: first ? radius : 0,\n borderTopEndRadius: last ? radius : 0,\n borderTopStartRadius: first ? radius : 0,\n }\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 (\n children !== undefined &&\n children !== null &&\n children !== false &&\n children !== ''\n )\n}\n\nfunction iconStyleOf(color: string): IconStyle {\n return { color, size: GLYPH_SIZE }\n}\n\n/**\n * The chosen container of a set that chooses one, which slides to the\n * segment chosen from the one chosen before it, fades in where nothing was\n * chosen, and fades out where nothing now is.\n */\nfunction Indicator({\n color,\n place,\n selected,\n}: {\n readonly color: string\n readonly place: Place | undefined\n readonly selected: Key | undefined\n}) {\n const theme = useTheme()\n const { motion } = theme\n const reduceMotion = useReducedMotion()\n // Where the container rests before it is moved: the start of the track,\n // which is its right end under a right-to-left layout, so that where it\n // rests there depends on how wide it is. It is only read at the width it\n // was measured at, which keeps a resize from drawing it a frame out of\n // place.\n const [rest, setRest] = useState<Place | undefined>(undefined)\n const shift = useSharedValue(0)\n const shown = useSharedValue(0)\n // The key the container was last drawn at, and whether it has been drawn\n // at all, which tells a choice made on a set already drawn from the first\n // one the set opens with.\n const drawnAt = useRef<Key | undefined>(undefined)\n const drawn = useRef(false)\n\n const offset =\n place === undefined ||\n rest === undefined ||\n Math.abs(rest.width - place.width) >= 1\n ? undefined\n : place.x - rest.x\n\n useLayoutEffect(() => {\n const slide = {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasized),\n }\n\n if (selected === undefined) {\n if (drawnAt.current !== undefined) {\n shown.set(reduceMotion ? 0 : withTiming(0, slide))\n }\n drawnAt.current = undefined\n return\n }\n\n if (offset === undefined) {\n return\n }\n\n const from = drawnAt.current\n // A move from another segment slides; a layout that moved under the\n // same choice, or a choice from nothing, is drawn where it lands.\n const moves = from !== undefined && from !== selected && !reduceMotion\n\n shift.set(moves ? withTiming(offset, slide) : offset)\n\n if (from === undefined) {\n shown.set(drawn.current && !reduceMotion ? withTiming(1, slide) : 1)\n }\n\n drawnAt.current = selected\n drawn.current = true\n }, [motion, offset, reduceMotion, selected, shift, shown])\n\n const motionStyle = useAnimatedStyle(() => {\n 'worklet'\n return {\n opacity: shown.get(),\n transform: [{ translateX: shift.get() }],\n }\n })\n\n return (\n <View style={stylesOf(theme).clip}>\n <Animated.View\n onLayout={restThen(setRest)}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.indicator,\n { backgroundColor: color, width: place?.width ?? 0 },\n motionStyle,\n )}\n />\n </View>\n )\n}\n\n/**\n * Records a label's width off screen, for the basis. Built by a call rather\n * than written inline at the prop, which is what react-perf's\n * jsx-no-new-function-as-prop is after; the React Compiler memoises the\n * result on its inputs.\n */\nfunction measureThen(\n setLabels: (\n update: (labels: ReadonlyMap<Key, number>) => ReadonlyMap<Key, number>,\n ) => void,\n key: Key,\n) {\n return (event: LayoutChangeEvent) => {\n const { width } = event.nativeEvent.layout\n\n setLabels((labels) =>\n labels.get(key) === width ? labels : new Map(labels).set(key, width),\n )\n }\n}\n\n/**\n * Records where a segment was laid out, then calls the call site's own\n * `onLayout`.\n */\nfunction placeThen(\n onPlace: (key: Key, place: Place) => void,\n key: Key,\n onLayout: PressableProps['onLayout'],\n) {\n return (event: LayoutChangeEvent) => {\n const { width, x } = event.nativeEvent.layout\n\n onPlace(key, { width, x })\n onLayout?.(event)\n }\n}\n\n// Whether a segment can ever draw a glyph, and so keeps room for one: a set\n// that draws the check, or an icon of its own. A segment that never needs\n// the slot keeps no room for it, which would be dead space in every segment.\nfunction reservesGlyph(\n { children, icon }: SegmentedButtonSegmentProps,\n showSelectedIcon: boolean,\n) {\n return (showSelectedIcon && hasLabel(children)) || icon !== undefined\n}\n\n/** Records where the chosen container rests before it is moved. */\nfunction restThen(setRest: (rest: Place) => void) {\n return (event: LayoutChangeEvent) => {\n const { width, x } = event.nativeEvent.layout\n\n setRest({ width, x })\n }\n}\n\n// The leading rule only the first segment draws.\nfunction ruleOf(index: number) {\n return index === 0 ? RULE_WIDTH : 0\n}\n\nfunction samePlace(known: Place | undefined, place: Place) {\n return (\n known !== undefined && known.width === place.width && known.x === place.x\n )\n}\n\n/**\n * A row of two to five joined segments, of which one, or with\n * `selectionMode=\"multiple\"` several, is chosen. Pass `selectedKeys` with\n * `onSelectionChange` to hold the choice, or `defaultSelectedKeys` to let the\n * set keep its own. Give every segment an `id`, which is the key the choice\n * 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. Choosing one is announced as a radio group, and choosing\n * several as a toolbar of buttons that each say whether they are selected.\n *\n * `style`, `ref` and `testID` land on the track.\n */\nfunction SegmentedButton({\n children,\n defaultSelectedKeys,\n disallowEmptySelection,\n isDisabled = false,\n onSelectionChange,\n selectedKeys,\n selectionMode = 'single',\n showSelectedIcon = true,\n style,\n ...props\n}: SegmentedButtonProps) {\n const theme = useTheme()\n const role = useTypeRole('labelLarge')\n const single = selectionMode === 'single'\n const state = useToggleGroupState({\n defaultSelectedKeys,\n disallowEmptySelection: disallowEmptySelection ?? single,\n isDisabled,\n onSelectionChange,\n selectedKeys,\n selectionMode,\n })\n const segments = segmentsOf(children)\n const [labels, setLabels] = useState<ReadonlyMap<Key, number>>(new Map())\n const [places, setPlaces] = useState<ReadonlyMap<Key, Place>>(new Map())\n\n // The segment the chosen container is at in a set that chooses one, or\n // was last at, which it fades out at once the choice is cleared.\n const chosen = [...state.selectedKeys].at(0)\n const [held, setHeld] = useState(chosen)\n if (chosen !== undefined && chosen !== held) {\n setHeld(chosen)\n }\n // The segment the set opened on, until the choice first moves, which draws\n // the chosen container itself while the track's waits on the layout.\n const [opening, setOpening] = useState(chosen)\n if (opening !== undefined && opening !== chosen) {\n setOpening(undefined)\n }\n\n const basis = basisOf(segments, labels, showSelectedIcon, theme)\n const context = useMemo(\n () => ({\n basis,\n count: segments.length,\n onPlace: (key: Key, place: Place) => {\n setPlaces((current) =>\n samePlace(current.get(key), place)\n ? current\n : new Map(current).set(key, place),\n )\n },\n opening,\n places,\n selectionMode,\n showSelectedIcon,\n state,\n }),\n [\n basis,\n opening,\n places,\n segments.length,\n selectionMode,\n setPlaces,\n showSelectedIcon,\n state,\n ],\n )\n\n const segment = segments.find(({ props: own }) => own.id === (chosen ?? held))\n\n return (\n <View\n hitSlop={reachOf(theme)}\n role={single ? 'radiogroup' : 'toolbar'}\n {...props}\n style={composeStyles<ViewStyle>(stylesOf(theme).track, style)}\n >\n {single ? (\n <Indicator\n color={containerOf(\n theme,\n isDisabled || segment?.props.isDisabled === true,\n showSelectedIcon && hasLabel(segment?.props.children),\n )}\n place={\n segment === undefined ? undefined : places.get(segment.props.id)\n }\n selected={segment === undefined ? undefined : chosen}\n />\n ) : null}\n <GroupContext value={context}>\n {segments.map((each, at) => (\n <IndexContext key={each.props.id} value={at}>\n {each}\n </IndexContext>\n ))}\n </GroupContext>\n <View aria-hidden style={styles.measurer}>\n {segments.map(({ props: own }) =>\n hasLabel(own.children) ? (\n <NativeText\n key={own.id}\n numberOfLines={1}\n onLayout={measureThen(setLabels, own.id)}\n style={role}\n >\n {own.children}\n </NativeText>\n ) : null,\n )}\n </View>\n </View>\n )\n}\n\n/**\n * One segment. Its `id` is the key the choice reports it by, and its label is\n * what names it. A chosen segment draws a check before its label; one not\n * chosen draws its `icon`, if it has one. Renders nothing outside a\n * `SegmentedButton`.\n *\n * `style`, `ref` and `testID` land on the segment's `Pressable`.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n hitSlop: ownHitSlop,\n icon,\n id,\n isDisabled: ownDisabled = false,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onPress,\n onPressIn,\n onPressOut,\n style,\n ...props\n}: SegmentedButtonSegmentProps) {\n const theme = useTheme()\n const group = use(GroupContext)\n const index = use(IndexContext)\n const role = useTypeRole('labelLarge')\n\n const state = group?.state\n const several = group?.selectionMode === 'multiple'\n const showSelectedIcon = group?.showSelectedIcon ?? true\n const selected = state?.selectedKeys.has(id) ?? false\n const disabled = ownDisabled || state?.isDisabled === true\n const labelled = hasLabel(children)\n const marked = showSelectedIcon && labelled\n const reserves = reservesGlyph({ children, icon, id }, showSelectedIcon)\n const glyph = selected && marked ? CHECK : (icon ?? null)\n const drawn = glyph !== null\n const first = index === 0\n const last = index === (group?.count ?? 0) - 1\n\n const { radii, spacing } = theme\n const content = contentOf(theme, { disabled, marked, selected })\n const corners = cornersOf(radii.pill, first, last)\n const own = stylesOf(theme)\n\n // The room for a glyph, as the header sets it out: either side of the\n // label while nothing is drawn, all of it before the label once something\n // is, and the glyph alone before an icon with no label.\n const give = spacing.md - spacing.sm\n const reserve = GLYPH_SIZE + spacing.sm\n const leading = reserves\n ? drawn\n ? give + (labelled ? reserve : GLYPH_SIZE)\n : give + reserve / 2\n : give\n const leadingFloor = drawn ? (labelled ? reserve : GLYPH_SIZE) : 0\n const trailing = reserves && !drawn ? give + reserve / 2 : give\n // The most the label takes: what is left of the segment once its rule, its\n // padding and a drawn glyph are taken out.\n const width = group?.places.get(id)?.width\n const room =\n width === undefined\n ? undefined\n : width -\n ruleOf(index) -\n RULE_WIDTH -\n spacing.sm * 2 -\n (drawn && labelled ? reserve : 0)\n\n const motion = useSegmentMotion({\n content,\n drawn,\n fades: several,\n filled: several ? selected : id === group?.opening,\n labelled,\n leading,\n leadingFloor,\n room,\n trailing,\n })\n\n const feedback = usePressFeedback({\n color: content,\n corners,\n disabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n })\n\n if (group === null) {\n return null\n }\n\n return (\n <Pressable\n role={several ? 'button' : 'radio'}\n {...(several ? toggleState(selected) : { 'aria-checked': selected })}\n {...props}\n {...feedback.handlers}\n disabled={disabled}\n hitSlop={ownHitSlop ?? reachOf(theme)}\n onLayout={placeThen(group.onPlace, id, onLayout)}\n onPress={toggleThen(group.state, id, onPress)}\n style={composeStyles<ViewStyle>(\n own.segment,\n first ? own.first : undefined,\n corners,\n disabled\n ? {\n borderColor: withOpacity(\n theme.colors.onSurface,\n theme.stateLayerOpacity.disabledContainer,\n ),\n }\n : undefined,\n group.basis === undefined\n ? undefined\n : { flexGrow: 0, width: group.basis },\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.ownIndicator,\n corners,\n { backgroundColor: containerOf(theme, disabled, marked) },\n motion.fill,\n )}\n />\n {feedback.layer}\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.spacer,\n motion.leading,\n )}\n >\n {reserves ? (\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.glyphSlot,\n motion.slot,\n )}\n >\n <IconStyleContext value={iconStyleOf(content)}>\n <View style={styles.glyph}>{glyph}</View>\n </IconStyleContext>\n </Animated.View>\n ) : null}\n {reserves ? <Animated.View style={motion.gap} /> : null}\n </Animated.View>\n {labelled ? (\n <Animated.Text\n numberOfLines={1}\n style={composeStyles<AnimatedStyle<TextStyle>>(\n role,\n styles.label,\n motion.label,\n )}\n >\n {children}\n </Animated.Text>\n ) : null}\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.spacer,\n motion.trailing,\n )}\n />\n </Pressable>\n )\n}\n\n/**\n * The segments among a set's children, with any fragment between them opened,\n * so a set can take its segments as one fragment.\n */\nfunction segmentsOf(\n children: ReactNode,\n): ReactElement<SegmentedButtonSegmentProps>[] {\n return Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ readonly children?: ReactNode }>(child)) {\n return []\n }\n if (child.type === Fragment) {\n return segmentsOf(child.props.children)\n }\n return isValidElement<SegmentedButtonSegmentProps>(child) ? [child] : []\n })\n}\n\n/**\n * A press on a segment: the call site's own `onPress`, then the choice, which\n * chooses the segment, or clears it if it was chosen and the set allows that.\n */\nfunction toggleThen(\n state: ToggleGroupState,\n key: Key,\n onPress: PressableProps['onPress'],\n) {\n return (event: GestureResponderEvent) => {\n onPress?.(event)\n state.toggleKey(key)\n }\n}\n\n/**\n * What a segment eases: the room either side of its label and the glyph slot\n * between them over `durationShort2`, the label's colour and the most it\n * takes with them, and its own chosen container where it `fades`, in a set\n * that chooses several. All of it is there at once under reduced motion, and\n * the container is in a set that chooses one, where it only stands in for the\n * track's until the choice first moves.\n */\nfunction useSegmentMotion({\n content,\n drawn,\n fades,\n filled,\n labelled,\n leading,\n leadingFloor,\n room,\n trailing,\n}: {\n readonly content: string\n readonly drawn: boolean\n readonly fades: boolean\n readonly filled: boolean\n readonly labelled: boolean\n readonly leading: number\n readonly leadingFloor: number\n readonly room: number | undefined\n readonly trailing: number\n}) {\n const { motion, spacing } = useTheme()\n const reduceMotion = useReducedMotion()\n const timing = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n const gap = drawn && labelled ? spacing.sm : 0\n const slot = drawn ? GLYPH_SIZE : 0\n const opacity = filled ? 1 : 0\n\n return {\n fill: useAnimatedStyle(() => {\n 'worklet'\n return {\n opacity: reduceMotion || !fades ? opacity : withTiming(opacity, timing),\n }\n }),\n // A view of its own rather than an end margin on the slot: under React\n // Native Web, Reanimated writes an animated style to the element without\n // the step that turns `marginEnd` into a side, so it would never arrive.\n gap: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? gap : withTiming(gap, timing) }\n }),\n label: useAnimatedStyle(() => {\n 'worklet'\n return {\n color: reduceMotion ? content : withTiming(content, timing),\n ...(room === undefined\n ? undefined\n : { maxWidth: reduceMotion ? room : withTiming(room, timing) }),\n }\n }),\n leading: useAnimatedStyle(() => {\n 'worklet'\n return {\n minWidth: reduceMotion\n ? leadingFloor\n : withTiming(leadingFloor, timing),\n width: reduceMotion ? leading : withTiming(leading, timing),\n }\n }),\n slot: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? slot : withTiming(slot, timing) }\n }),\n trailing: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? trailing : withTiming(trailing, timing) }\n }),\n }\n}\n\nSegmentedButton.Segment = SegmentedButtonSegment\n\nexport { SegmentedButton, SegmentedButtonSegment }\nexport type {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F;GAGHjG,OACKqG;GAQLqE,SACOpE;GAQPiF,MACIhF;GAGJqE,UACQjE;EAIZ;EAAClC,EAAA,KAAAa;EAAAb,EAAA,KAAAwB;EAAAxB,EAAA,KAAA4B;EAAA5B,EAAA,KAAA6B;EAAA7B,EAAA,KAAA8B;EAAA9B,EAAA,KAAAkC;EAAAlC,EAAA,KAAAmC;CAAA,OAAAA,KAAAnC,EAAA;CAAA,OAxCMmC;AAwCN;AAGHe,gBAAgBuE,UAAUzC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactElement","ReactNode","Ref","GestureResponderEvent","LayoutChangeEvent","PressableProps","StyleProp","TextStyle","ViewProps","ViewStyle","AnimatedStyle","Key","ToggleGroupState","Children","createContext","Fragment","isValidElement","use","useLayoutEffect","useMemo","useRef","useState","Text","NativeText","Pressable","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","useToggleGroupState","IconStyle","ResolvedTheme","toggleState","CheckGlyph","IconStyleContext","hitSlop","usePressFeedback","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","GroupContextValue","basis","count","crowded","onPlace","key","place","Place","opening","places","ReadonlyMap","selectionMode","SelectionMode","showSelectedIcon","state","LabelledBy","width","x","SegmentedButtonProps","Omit","children","defaultSelectedKeys","Iterable","disallowEmptySelection","isDisabled","onSelectionChange","keys","Set","ref","selectedKeys","style","SegmentedButtonSegmentProps","disableRipple","icon","id","GLYPH_SIZE","RULE_WIDTH","CHECK","GroupContext","IndexContext","styles","create","glyph","alignItems","flexShrink","height","justifyContent","glyphSlot","overflow","indicator","bottom","position","start","top","label","minWidth","measurer","opacity","pointerEvents","ownIndicator","end","spacer","flexDirection","stylesOf","colors","radii","sizing","spacing","clip","borderRadius","pill","first","borderStartWidth","segment","borderColor","outline","borderWidth","minHeight","controlSm","paddingHorizontal","sm","track","alignSelf","maxWidth","reachOf","basisOf","segments","labels","index","props","entries","labelled","hasLabel","get","undefined","content","reservesGlyph","Math","max","md","ruleOf","containerOf","stateLayerOpacity","disabled","marked","onSurface","disabledContainer","secondaryContainer","secondary","contentOf","selected","disabledContent","onSecondaryContainer","onSecondary","cornersOf","radius","last","Pick","borderBottomEndRadius","borderBottomStartRadius","borderTopEndRadius","borderTopStartRadius","crowdedOf","some","iconStyleOf","color","size","Indicator","t0","$","_c","theme","motion","reduceMotion","rest","setRest","shift","shown","drawnAt","drawn","offset","abs","t1","durationMedium1","easingEmphasized","slide","duration","easing","bezier","current","set","from","moves","t2","motionStyle","transform","translateX","t3","t4","t5","Symbol","for","restThen","t6","t7","backgroundColor","t8","t9","measureThen","setLabels","update","event","nativeEvent","layout","Map","placeThen","onLayout","samePlace","known","SegmentedButton","role","single","segmentsOf","setPlaces","at","chosen","held","setHeld","setOpening","t10","length","context","T0","t11","t12","t13","t14","t15","t16","t17","own","find","map","_temp","t18","t19","t20","own_0","each","SegmentedButtonSegment","onBlur","onFocus","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","ownHitSlop","ownDisabled","group","several","has","reserves","checks","corners","give","reserve","leading","leadingFloor","trailing","room","useSegmentMotion","fades","filled","feedback","handlers","toggleThen","flexGrow","ring","layer","slot","gap","fill","toArray","flatMap","child","type","toggleKey","timing","durationShort2","easingStandard","Segment","_c","NativeText"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactElement, ReactNode, Ref } from 'react'\nimport type {\n GestureResponderEvent,\n LayoutChangeEvent,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key } from 'react-stately'\nimport type { ToggleGroupState } from 'react-stately/useToggleGroupState'\n\nimport {\n Children,\n createContext,\n Fragment,\n isValidElement,\n use,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Text as NativeText, Pressable, StyleSheet, View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { useToggleGroupState } from 'react-stately/useToggleGroupState'\n\nimport type { IconStyle } from '../../glyphs/icon-style'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { toggleState } from '../../button'\nimport { CheckGlyph } from '../../glyphs'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The segmented buttons page's outlined segmented button, as kanso-ui's\n// SegmentedButton draws it: two to five segments joined into one outlined\n// track, of which one or several are chosen. A segment is Button's default\n// size and type role, a 40dp container with a label-large label, which is\n// what that page gives too.\n//\n// What a screen reader hears follows the selection mode, as on web. Choosing\n// one is a radio group, so the track is a `radiogroup` and each segment a\n// `radio` reporting whether it is checked. Choosing several is a `toolbar` of\n// buttons, each reporting whether it is selected through `toggleState`, as a\n// toggle Button does. The selection is React Stately's toggle group state, as\n// web's is React Aria's, and in a set that chooses one, the chosen segment\n// stays chosen when pressed again unless `disallowEmptySelection` is `false`.\n//\n// **The segments are one track.** Each carries the page's 1dp outline, and\n// each after the first drops its leading edge, so neighbours share one rule.\n// The outer ends take the page's fully rounded shape and the joins are\n// square. Every segment is the same width, as wide as the widest one asks\n// for: the labels are measured off screen, and each segment is handed the\n// widest one's width, so a track squeezed into less room shares it out\n// equally. The track is as wide as that, and never wider than what\n// holds it.\n//\n// **A chosen segment draws a check** in the page's 18dp icon slot, in place\n// of its `icon`. `showSelectedIcon={false}` turns it off, and the chosen\n// segment then takes the secondary role with its label on it, since the\n// page's own chosen container is too faint to say which is chosen by itself.\n// A segment with an icon and no label keeps its icon when chosen, and takes\n// the secondary role too. Every segment that could draw the slot keeps room\n// for it whether or not it does, split either side of the label while\n// nothing is drawn, so the track never changes width with the choice. That\n// room gives way before the label does: a squeezed segment gives back the\n// room first, then 4dp of its 12dp padding, and then the glyphs themselves.\n// A label shows whole in a segment 16dp wider than it, or 42dp while a glyph\n// is drawn beside it, plus its rules, so on a phone a check or an icon is\n// what cuts a label that would otherwise fit. Once any segment's label would\n// be cut beside its glyph, the whole set stops drawing them: no check and no\n// icons beside a label, and the chosen segment on the stronger container a\n// set without a check draws, so the choice still reads. The whole set rather\n// than the one segment, since a set choosing several would otherwise draw one\n// chosen segment one way and the next another. And any segment rather than\n// the chosen one, since a check that would cut a label only once its segment\n// is chosen is the same cut a moment later, and choosing should not turn the\n// glyphs off or on. The answer reads each label's own width against its\n// segment's, and neither changes with what is drawn, so dropping the glyphs\n// cannot turn them back on. Only past that is a label cut short, with an\n// ellipsis. The slot and the room around it ease over `durationShort2` on the\n// standard curve, and the check opens from its centre.\n//\n// **The chosen container moves.** In a set that chooses one it is a view of\n// the track's own, behind the segments, so the labels and the rules are\n// drawn over it, and it slides between segments over `durationMedium1` on the\n// emphasized curve. It is drawn inside the track's outline, so it takes the\n// rounded shape at either end and square corners between. It can only be\n// placed once the segments are laid out, so until the choice first moves, the\n// segment the set opened on draws a container of its own in the same place.\n// Without it, the chosen label would stand on the bare surface in the frames\n// before that layout, which is unreadable where no check marks it, since its\n// colour is then the one meant for the secondary role. In a set that chooses\n// several there is no one segment for it to be at, so each segment fades its\n// own in and out where it is, over `durationShort2`. Both happen at once\n// under reduced motion.\n//\n// The state layer, the ripple and the focus ring are src/press's, in the\n// label's colour, over the chosen container. A segment's target reaches 4dp\n// above and below the 40dp track, to the page's 48dp, and not across, since\n// the segments sit flush.\n//\n// **Disabled is the page's colour at an opacity, translucent**, as a\n// button's is: the label on-surface at `disabledContent`, and the rule and a\n// chosen segment's container on-surface at `disabledContainer`.\n//\n// Two departures from web. The arrow keys do not move between the segments\n// or choose one: each segment is a stop of its own for a hardware keyboard,\n// and activating it there chooses it. And a label cut short has no `title` to\n// show it whole, which a screen reader does not need, since it reads all of\n// it.\n\n/** What the set reads from the segments, and a segment from the set. */\ntype GroupContextValue = {\n /** The basis each segment takes, once every label is measured. */\n readonly basis: number | undefined\n readonly count: number\n /**\n * Whether a glyph would cut some segment's label, which turns every glyph\n * beside a label off. See the header.\n */\n readonly crowded: boolean\n /** Records where a segment was laid out, for the chosen container. */\n readonly onPlace: (key: Key, place: Place) => void\n /**\n * The segment a set that chooses one opened on, until the choice first\n * moves, which draws the chosen container itself meanwhile.\n */\n readonly opening: Key | undefined\n readonly places: ReadonlyMap<Key, Place>\n readonly selectionMode: SelectionMode\n readonly showSelectedIcon: boolean\n readonly state: ToggleGroupState\n}\n\n/** A name for the set: its own label, or the id of what labels it. */\ntype LabelledBy =\n | { readonly 'aria-label': string; readonly 'aria-labelledby'?: string }\n | { readonly 'aria-label'?: string; readonly 'aria-labelledby': string }\n\n/** Where a segment was laid out in the track. */\ntype Place = {\n readonly width: number\n readonly x: number\n}\n\ntype SegmentedButtonProps = LabelledBy &\n Omit<ViewProps, 'aria-label' | 'aria-labelledby' | 'children' | 'style'> & {\n /** The segments, each a `SegmentedButton.Segment` with an `id`. */\n readonly children?: ReactNode\n /** The keys chosen at first, when the set keeps its own selection. */\n readonly defaultSelectedKeys?: Iterable<Key>\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. Off by default while several\n * may be, where any of them can be turned off.\n * @default true while one is chosen, false while several may be\n */\n readonly disallowEmptySelection?: boolean\n /**\n * Disables every segment.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Called with the chosen keys when the choice changes. */\n readonly onSelectionChange?: (keys: Set<Key>) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** The chosen keys, when the call site holds the selection. */\n readonly selectedKeys?: Iterable<Key>\n /**\n * Whether one segment is chosen at a time, or several.\n * @default 'single'\n */\n readonly selectionMode?: SelectionMode\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 chosen,\n * and draws the chosen segment on the stronger secondary container.\n * @default true\n */\n readonly showSelectedIcon?: boolean\n readonly style?: StyleProp<ViewStyle>\n }\n\ntype SegmentedButtonSegmentProps = Omit<\n PressableProps,\n 'children' | 'disabled' | 'id' | 'style'\n> & {\n /** The segment's label. */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The hover and pressed state layers are unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * An icon before the label, in the page's 18dp slot, which hands it the\n * label's colour and its size through `useIconStyle()`. Replaced by the\n * check while the segment is chosen, unless the set turns that off.\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 readonly icon?: ReactNode\n /** The key the selection reports the segment by. */\n readonly id: Key\n /**\n * Disables the segment alone.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\ntype SelectionMode = 'multiple' | 'single'\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// and the 8dp gap between it and the label. A literal, as on web: the theme\n// has no scale for icon sizes.\nconst GLYPH_SIZE = 18\n\n// The rule every segment draws.\nconst RULE_WIDTH = 1\n\nconst CHECK = <CheckGlyph />\n\nconst GroupContext = createContext<GroupContextValue | null>(null)\n\n// Where in the track a segment sits, which decides its corners and its rule.\nconst IndexContext = createContext(0)\n\nconst styles = StyleSheet.create({\n // A glyph sized rather than filling its slot, so a slot part way through\n // opening clips it instead of squashing it.\n glyph: {\n alignItems: 'center',\n flexShrink: 0,\n height: GLYPH_SIZE,\n justifyContent: 'center',\n width: GLYPH_SIZE,\n },\n // Opens from its centre, so the check wipes out from the middle rather\n // than arriving at full size.\n glyphSlot: {\n alignItems: 'center',\n flexShrink: 0,\n height: GLYPH_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n // The chosen container of a set that chooses one: the track's own view,\n // behind the segments, at the start of the track and moved from there to\n // the chosen segment.\n indicator: {\n bottom: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // A label holds its width while the spacers beside it give theirs back,\n // and is cut short only at the width it is handed.\n label: {\n flexShrink: 0,\n minWidth: 0,\n },\n // The labels measured off screen, at their own widths, for the basis.\n measurer: {\n alignItems: 'flex-start',\n opacity: 0,\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // A segment's own chosen container, inside its rule: in a set that chooses\n // several, and in the segment a set that chooses one opened on.\n ownIndicator: {\n bottom: 0,\n end: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // Either side of the label, holding the room a glyph needs, given back\n // before the label is cut.\n spacer: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 1,\n justifyContent: 'flex-end',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, radii, sizing, spacing }) =>\n StyleSheet.create({\n // What the chosen container of a set that chooses one is drawn in: the\n // track's own outline, so the container takes an end's rounded shape at\n // either end and square corners between, wherever it is.\n clip: {\n borderRadius: radii.pill,\n bottom: 0,\n end: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n },\n // The first segment draws the leading rule the others leave to it.\n first: {\n borderStartWidth: RULE_WIDTH,\n },\n segment: {\n alignItems: 'center',\n borderColor: colors.outline,\n borderStartWidth: 0,\n borderWidth: RULE_WIDTH,\n flexDirection: 'row',\n flexShrink: 1,\n justifyContent: 'center',\n minHeight: sizing.controlSm,\n minWidth: 0,\n paddingHorizontal: spacing.sm,\n },\n // As wide as what is in it and never wider than what holds it, from the\n // start edge.\n track: {\n alignSelf: 'flex-start',\n flexDirection: 'row',\n maxWidth: '100%',\n },\n }),\n)\n\n// The track reaches as far as its segments' targets, since iOS and Android\n// hand a touch to a view only once its parent has taken it.\nconst reachOf = themedStyles(({ sizing }) => hitSlop(sizing.controlSm))\n\n/**\n * The width every segment takes: the widest one's, which is its label, its\n * padding, the room it keeps for a glyph and its rule. Undefined until every\n * label has been measured.\n */\nfunction basisOf(\n segments: readonly ReactElement<SegmentedButtonSegmentProps>[],\n labels: ReadonlyMap<Key, number>,\n showSelectedIcon: boolean,\n { spacing }: ResolvedTheme,\n): number | undefined {\n let basis = 0\n\n for (const [index, { props }] of segments.entries()) {\n const labelled = hasLabel(props.children)\n const label = labels.get(props.id)\n\n if (labelled && label === undefined) {\n return undefined\n }\n\n const content = labelled\n ? (label ?? 0) +\n (reservesGlyph(props, showSelectedIcon) ? GLYPH_SIZE + spacing.sm : 0)\n : props.icon === undefined\n ? 0\n : GLYPH_SIZE\n\n basis = Math.max(\n basis,\n content + spacing.md * 2 + ruleOf(index) + RULE_WIDTH,\n )\n }\n\n return basis\n}\n\n/**\n * The chosen container's colour: the page's secondary container, the\n * stronger secondary where no check marks the choice, and on-surface at the\n * disabled opacity while the segment is disabled.\n */\nfunction containerOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n disabled: boolean,\n marked: boolean,\n): string {\n if (disabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContainer)\n }\n return marked ? colors.secondaryContainer : colors.secondary\n}\n\n/**\n * The label's colour, which the glyph, the state layer and the ripple take\n * too.\n */\nfunction contentOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n {\n disabled,\n marked,\n selected,\n }: {\n readonly disabled: boolean\n readonly marked: boolean\n readonly selected: boolean\n },\n): string {\n if (disabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n }\n if (!selected) {\n return colors.onSurface\n }\n return marked ? colors.onSecondaryContainer : colors.onSecondary\n}\n\n/** A segment's corners: rounded at the ends of the track, square between. */\nfunction cornersOf(\n radius: number,\n first: boolean,\n last: boolean,\n): Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n> {\n return {\n borderBottomEndRadius: last ? radius : 0,\n borderBottomStartRadius: first ? radius : 0,\n borderTopEndRadius: last ? radius : 0,\n borderTopStartRadius: first ? radius : 0,\n }\n}\n\n/**\n * Whether a glyph would cut a label: some segment that could draw one has a\n * label wider than what is left of the segment once its rules, the 8dp of\n * padding it always keeps and the glyph's room are taken out. Only a segment\n * that could draw a glyph counts, since a long label beside a slot it never\n * fills is no reason for its neighbours to drop theirs. False until the\n * segments are laid out.\n */\nfunction crowdedOf(\n segments: readonly ReactElement<SegmentedButtonSegmentProps>[],\n labels: ReadonlyMap<Key, number>,\n places: ReadonlyMap<Key, Place>,\n showSelectedIcon: boolean,\n { spacing }: ResolvedTheme,\n): boolean {\n return segments.some(({ props }, index) => {\n const label = labels.get(props.id)\n const place = places.get(props.id)\n\n return (\n hasLabel(props.children) &&\n reservesGlyph(props, showSelectedIcon) &&\n label !== undefined &&\n place !== undefined &&\n label + GLYPH_SIZE + spacing.sm >\n place.width - ruleOf(index) - RULE_WIDTH - spacing.sm * 2\n )\n })\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 (\n children !== undefined &&\n children !== null &&\n children !== false &&\n children !== ''\n )\n}\n\nfunction iconStyleOf(color: string): IconStyle {\n return { color, size: GLYPH_SIZE }\n}\n\n/**\n * The chosen container of a set that chooses one, which slides to the\n * segment chosen from the one chosen before it, fades in where nothing was\n * chosen, and fades out where nothing now is.\n */\nfunction Indicator({\n color,\n place,\n selected,\n}: {\n readonly color: string\n readonly place: Place | undefined\n readonly selected: Key | undefined\n}) {\n const theme = useTheme()\n const { motion } = theme\n const reduceMotion = useReducedMotion()\n // Where the container rests before it is moved: the start of the track,\n // which is its right end under a right-to-left layout, so that where it\n // rests there depends on how wide it is. It is only read at the width it\n // was measured at, which keeps a resize from drawing it a frame out of\n // place.\n const [rest, setRest] = useState<Place | undefined>(undefined)\n const shift = useSharedValue(0)\n const shown = useSharedValue(0)\n // The key the container was last drawn at, and whether it has been drawn\n // at all, which tells a choice made on a set already drawn from the first\n // one the set opens with.\n const drawnAt = useRef<Key | undefined>(undefined)\n const drawn = useRef(false)\n\n const offset =\n place === undefined ||\n rest === undefined ||\n Math.abs(rest.width - place.width) >= 1\n ? undefined\n : place.x - rest.x\n\n useLayoutEffect(() => {\n const slide = {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasized),\n }\n\n if (selected === undefined) {\n if (drawnAt.current !== undefined) {\n shown.set(reduceMotion ? 0 : withTiming(0, slide))\n }\n drawnAt.current = undefined\n return\n }\n\n if (offset === undefined) {\n return\n }\n\n const from = drawnAt.current\n // A move from another segment slides; a layout that moved under the\n // same choice, or a choice from nothing, is drawn where it lands.\n const moves = from !== undefined && from !== selected && !reduceMotion\n\n shift.set(moves ? withTiming(offset, slide) : offset)\n\n if (from === undefined) {\n shown.set(drawn.current && !reduceMotion ? withTiming(1, slide) : 1)\n }\n\n drawnAt.current = selected\n drawn.current = true\n }, [motion, offset, reduceMotion, selected, shift, shown])\n\n const motionStyle = useAnimatedStyle(() => {\n 'worklet'\n return {\n opacity: shown.get(),\n transform: [{ translateX: shift.get() }],\n }\n })\n\n return (\n <View style={stylesOf(theme).clip}>\n <Animated.View\n onLayout={restThen(setRest)}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.indicator,\n { backgroundColor: color, width: place?.width ?? 0 },\n motionStyle,\n )}\n />\n </View>\n )\n}\n\n/**\n * Records a label's width off screen, for the basis. Built by a call rather\n * than written inline at the prop, which is what react-perf's\n * jsx-no-new-function-as-prop is after; the React Compiler memoises the\n * result on its inputs.\n */\nfunction measureThen(\n setLabels: (\n update: (labels: ReadonlyMap<Key, number>) => ReadonlyMap<Key, number>,\n ) => void,\n key: Key,\n) {\n return (event: LayoutChangeEvent) => {\n const { width } = event.nativeEvent.layout\n\n setLabels((labels) =>\n labels.get(key) === width ? labels : new Map(labels).set(key, width),\n )\n }\n}\n\n/**\n * Records where a segment was laid out, then calls the call site's own\n * `onLayout`.\n */\nfunction placeThen(\n onPlace: (key: Key, place: Place) => void,\n key: Key,\n onLayout: PressableProps['onLayout'],\n) {\n return (event: LayoutChangeEvent) => {\n const { width, x } = event.nativeEvent.layout\n\n onPlace(key, { width, x })\n onLayout?.(event)\n }\n}\n\n// Whether a segment can ever draw a glyph, and so keeps room for one: a set\n// that draws the check, or an icon of its own. A segment that never needs\n// the slot keeps no room for it, which would be dead space in every segment.\nfunction reservesGlyph(\n { children, icon }: SegmentedButtonSegmentProps,\n showSelectedIcon: boolean,\n) {\n return (showSelectedIcon && hasLabel(children)) || icon !== undefined\n}\n\n/** Records where the chosen container rests before it is moved. */\nfunction restThen(setRest: (rest: Place) => void) {\n return (event: LayoutChangeEvent) => {\n const { width, x } = event.nativeEvent.layout\n\n setRest({ width, x })\n }\n}\n\n// The leading rule only the first segment draws.\nfunction ruleOf(index: number) {\n return index === 0 ? RULE_WIDTH : 0\n}\n\nfunction samePlace(known: Place | undefined, place: Place) {\n return (\n known !== undefined && known.width === place.width && known.x === place.x\n )\n}\n\n/**\n * A row of two to five joined segments, of which one, or with\n * `selectionMode=\"multiple\"` several, is chosen. Pass `selectedKeys` with\n * `onSelectionChange` to hold the choice, or `defaultSelectedKeys` to let the\n * set keep its own. Give every segment an `id`, which is the key the choice\n * 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. Choosing one is announced as a radio group, and choosing\n * several as a toolbar of buttons that each say whether they are selected.\n *\n * `style`, `ref` and `testID` land on the track.\n */\nfunction SegmentedButton({\n children,\n defaultSelectedKeys,\n disallowEmptySelection,\n isDisabled = false,\n onSelectionChange,\n selectedKeys,\n selectionMode = 'single',\n showSelectedIcon = true,\n style,\n ...props\n}: SegmentedButtonProps) {\n const theme = useTheme()\n const role = useTypeRole('labelLarge')\n const single = selectionMode === 'single'\n const state = useToggleGroupState({\n defaultSelectedKeys,\n disallowEmptySelection: disallowEmptySelection ?? single,\n isDisabled,\n onSelectionChange,\n selectedKeys,\n selectionMode,\n })\n const segments = segmentsOf(children)\n const [labels, setLabels] = useState<ReadonlyMap<Key, number>>(new Map())\n const [places, setPlaces] = useState<ReadonlyMap<Key, Place>>(new Map())\n\n // The segment the chosen container is at in a set that chooses one, or\n // was last at, which it fades out at once the choice is cleared.\n const chosen = [...state.selectedKeys].at(0)\n const [held, setHeld] = useState(chosen)\n if (chosen !== undefined && chosen !== held) {\n setHeld(chosen)\n }\n // The segment the set opened on, until the choice first moves, which draws\n // the chosen container itself while the track's waits on the layout.\n const [opening, setOpening] = useState(chosen)\n if (opening !== undefined && opening !== chosen) {\n setOpening(undefined)\n }\n\n const basis = basisOf(segments, labels, showSelectedIcon, theme)\n const crowded = crowdedOf(segments, labels, places, showSelectedIcon, theme)\n const context = useMemo(\n () => ({\n basis,\n count: segments.length,\n crowded,\n onPlace: (key: Key, place: Place) => {\n setPlaces((current) =>\n samePlace(current.get(key), place)\n ? current\n : new Map(current).set(key, place),\n )\n },\n opening,\n places,\n selectionMode,\n showSelectedIcon,\n state,\n }),\n [\n basis,\n crowded,\n opening,\n places,\n segments.length,\n selectionMode,\n setPlaces,\n showSelectedIcon,\n state,\n ],\n )\n\n const segment = segments.find(({ props: own }) => own.id === (chosen ?? held))\n\n return (\n <View\n hitSlop={reachOf(theme)}\n role={single ? 'radiogroup' : 'toolbar'}\n {...props}\n style={composeStyles<ViewStyle>(stylesOf(theme).track, style)}\n >\n {single ? (\n <Indicator\n color={containerOf(\n theme,\n isDisabled || segment?.props.isDisabled === true,\n showSelectedIcon && !crowded && hasLabel(segment?.props.children),\n )}\n place={\n segment === undefined ? undefined : places.get(segment.props.id)\n }\n selected={segment === undefined ? undefined : chosen}\n />\n ) : null}\n <GroupContext value={context}>\n {segments.map((each, at) => (\n <IndexContext key={each.props.id} value={at}>\n {each}\n </IndexContext>\n ))}\n </GroupContext>\n <View aria-hidden style={styles.measurer}>\n {segments.map(({ props: own }) =>\n hasLabel(own.children) ? (\n <NativeText\n key={own.id}\n numberOfLines={1}\n onLayout={measureThen(setLabels, own.id)}\n style={role}\n >\n {own.children}\n </NativeText>\n ) : null,\n )}\n </View>\n </View>\n )\n}\n\n/**\n * One segment. Its `id` is the key the choice reports it by, and its label is\n * what names it. A chosen segment draws a check before its label; one not\n * chosen draws its `icon`, if it has one. Renders nothing outside a\n * `SegmentedButton`.\n *\n * `style`, `ref` and `testID` land on the segment's `Pressable`.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n hitSlop: ownHitSlop,\n icon,\n id,\n isDisabled: ownDisabled = false,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onPress,\n onPressIn,\n onPressOut,\n style,\n ...props\n}: SegmentedButtonSegmentProps) {\n const theme = useTheme()\n const group = use(GroupContext)\n const index = use(IndexContext)\n const role = useTypeRole('labelLarge')\n\n const state = group?.state\n const several = group?.selectionMode === 'multiple'\n const showSelectedIcon = group?.showSelectedIcon ?? true\n const selected = state?.selectedKeys.has(id) ?? false\n const disabled = ownDisabled || state?.isDisabled === true\n const labelled = hasLabel(children)\n // The room for a glyph is read from the set's props rather than from what\n // is drawn, so a crowded set keeps the same room to give back.\n const reserves = reservesGlyph({ children, icon, id }, showSelectedIcon)\n // A crowded set draws no glyph beside a label, and its chosen segment\n // takes the colours a set without a check draws. An icon alone is\n // untouched.\n const crowded = group?.crowded ?? false\n const checks = showSelectedIcon && labelled && !crowded\n const shown = crowded && labelled ? undefined : icon\n const glyph = selected && checks ? CHECK : (shown ?? null)\n const drawn = glyph !== null\n const first = index === 0\n const last = index === (group?.count ?? 0) - 1\n\n const { radii, spacing } = theme\n const content = contentOf(theme, { disabled, marked: checks, selected })\n const corners = cornersOf(radii.pill, first, last)\n const own = stylesOf(theme)\n\n // The room for a glyph, as the header sets it out: either side of the\n // label while nothing is drawn, all of it before the label once something\n // is, and the glyph alone before an icon with no label.\n const give = spacing.md - spacing.sm\n const reserve = GLYPH_SIZE + spacing.sm\n const leading = reserves\n ? drawn\n ? give + (labelled ? reserve : GLYPH_SIZE)\n : give + reserve / 2\n : give\n const leadingFloor = drawn ? (labelled ? reserve : GLYPH_SIZE) : 0\n const trailing = reserves && !drawn ? give + reserve / 2 : give\n // The most the label takes: what is left of the segment once its rule, its\n // padding and a drawn glyph are taken out.\n const width = group?.places.get(id)?.width\n const room =\n width === undefined\n ? undefined\n : width -\n ruleOf(index) -\n RULE_WIDTH -\n spacing.sm * 2 -\n (drawn && labelled ? reserve : 0)\n\n const motion = useSegmentMotion({\n content,\n drawn,\n fades: several,\n filled: several ? selected : id === group?.opening,\n labelled,\n leading,\n leadingFloor,\n room,\n trailing,\n })\n\n const feedback = usePressFeedback({\n color: content,\n corners,\n disabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n })\n\n if (group === null) {\n return null\n }\n\n return (\n <Pressable\n role={several ? 'button' : 'radio'}\n {...(several ? toggleState(selected) : { 'aria-checked': selected })}\n {...props}\n {...feedback.handlers}\n disabled={disabled}\n hitSlop={ownHitSlop ?? reachOf(theme)}\n onLayout={placeThen(group.onPlace, id, onLayout)}\n onPress={toggleThen(group.state, id, onPress)}\n style={composeStyles<ViewStyle>(\n own.segment,\n first ? own.first : undefined,\n corners,\n disabled\n ? {\n borderColor: withOpacity(\n theme.colors.onSurface,\n theme.stateLayerOpacity.disabledContainer,\n ),\n }\n : undefined,\n group.basis === undefined\n ? undefined\n : { flexGrow: 0, width: group.basis },\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.ownIndicator,\n corners,\n { backgroundColor: containerOf(theme, disabled, checks) },\n motion.fill,\n )}\n />\n {feedback.layer}\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.spacer,\n motion.leading,\n )}\n >\n {reserves ? (\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.glyphSlot,\n motion.slot,\n )}\n >\n <IconStyleContext value={iconStyleOf(content)}>\n <View style={styles.glyph}>{glyph}</View>\n </IconStyleContext>\n </Animated.View>\n ) : null}\n {reserves ? <Animated.View style={motion.gap} /> : null}\n </Animated.View>\n {labelled ? (\n <Animated.Text\n numberOfLines={1}\n style={composeStyles<AnimatedStyle<TextStyle>>(\n role,\n styles.label,\n motion.label,\n )}\n >\n {children}\n </Animated.Text>\n ) : null}\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.spacer,\n motion.trailing,\n )}\n />\n </Pressable>\n )\n}\n\n/**\n * The segments among a set's children, with any fragment between them opened,\n * so a set can take its segments as one fragment.\n */\nfunction segmentsOf(\n children: ReactNode,\n): ReactElement<SegmentedButtonSegmentProps>[] {\n return Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ readonly children?: ReactNode }>(child)) {\n return []\n }\n if (child.type === Fragment) {\n return segmentsOf(child.props.children)\n }\n return isValidElement<SegmentedButtonSegmentProps>(child) ? [child] : []\n })\n}\n\n/**\n * A press on a segment: the call site's own `onPress`, then the choice, which\n * chooses the segment, or clears it if it was chosen and the set allows that.\n */\nfunction toggleThen(\n state: ToggleGroupState,\n key: Key,\n onPress: PressableProps['onPress'],\n) {\n return (event: GestureResponderEvent) => {\n onPress?.(event)\n state.toggleKey(key)\n }\n}\n\n/**\n * What a segment eases: the room either side of its label and the glyph slot\n * between them over `durationShort2`, the label's colour and the most it\n * takes with them, and its own chosen container where it `fades`, in a set\n * that chooses several. All of it is there at once under reduced motion, and\n * the container is in a set that chooses one, where it only stands in for the\n * track's until the choice first moves.\n */\nfunction useSegmentMotion({\n content,\n drawn,\n fades,\n filled,\n labelled,\n leading,\n leadingFloor,\n room,\n trailing,\n}: {\n readonly content: string\n readonly drawn: boolean\n readonly fades: boolean\n readonly filled: boolean\n readonly labelled: boolean\n readonly leading: number\n readonly leadingFloor: number\n readonly room: number | undefined\n readonly trailing: number\n}) {\n const { motion, spacing } = useTheme()\n const reduceMotion = useReducedMotion()\n const timing = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n const gap = drawn && labelled ? spacing.sm : 0\n const slot = drawn ? GLYPH_SIZE : 0\n const opacity = filled ? 1 : 0\n\n return {\n fill: useAnimatedStyle(() => {\n 'worklet'\n return {\n opacity: reduceMotion || !fades ? opacity : withTiming(opacity, timing),\n }\n }),\n // A view of its own rather than an end margin on the slot: under React\n // Native Web, Reanimated writes an animated style to the element without\n // the step that turns `marginEnd` into a side, so it would never arrive.\n gap: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? gap : withTiming(gap, timing) }\n }),\n label: useAnimatedStyle(() => {\n 'worklet'\n return {\n color: reduceMotion ? content : withTiming(content, timing),\n ...(room === undefined\n ? undefined\n : { maxWidth: reduceMotion ? room : withTiming(room, timing) }),\n }\n }),\n leading: useAnimatedStyle(() => {\n 'worklet'\n return {\n minWidth: reduceMotion\n ? leadingFloor\n : withTiming(leadingFloor, timing),\n width: reduceMotion ? leading : withTiming(leading, timing),\n }\n }),\n slot: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? slot : withTiming(slot, timing) }\n }),\n trailing: useAnimatedStyle(() => {\n 'worklet'\n return { width: reduceMotion ? trailing : withTiming(trailing, timing) }\n }),\n }\n}\n\nSegmentedButton.Segment = SegmentedButtonSegment\n\nexport { SegmentedButton, SegmentedButtonSegment }\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps }\n"],"mappings":";;;;;;;;;;;;;;;AA0OA,MAAMkF,aAAa;AAGnB,MAAMC,aAAa;AAEnB,MAAMC,QAAQ,oBAAC,YAAD,CAAW,CAAA;AAEzB,MAAMC,eAAetE,cAAwC,IAAI;AAGjE,MAAMuE,eAAevE,cAAc,CAAC;AAEpC,MAAMwE,SAAS7D,WAAW8D,OAAO;CAG/BC,OAAO;EACLC,YAAY;EACZC,YAAY;EACZC,QAAQV;EACRW,gBAAgB;EACh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