@kanso-labs/react-native-kanso-ui 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/index.d.ts +32 -2
- package/dist/button/index.js +38 -26
- package/dist/button/index.js.map +1 -1
- package/dist/button/pending.js +144 -0
- package/dist/button/pending.js.map +1 -0
- package/dist/button/slots.js +7 -0
- package/dist/button/slots.js.map +1 -0
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.js +159 -111
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +3 -3
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +2 -2
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +131 -0
- package/dist/components/dialog/index.js +861 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +3 -3
- package/dist/components/icon-button/index.js +165 -109
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +73 -0
- package/dist/components/meter/index.js +179 -0
- package/dist/components/meter/index.js.map +1 -0
- package/dist/components/number-field/index.d.ts +3 -3
- package/dist/components/number-field/index.js +1 -9
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +2 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +113 -0
- package/dist/components/progress-indicator/index.js +1024 -0
- package/dist/components/progress-indicator/index.js.map +1 -0
- package/dist/components/radio-group/index.d.ts +3 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -3
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +120 -0
- package/dist/components/snackbar/index.js +540 -0
- package/dist/components/snackbar/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +3 -3
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/hidden.js +13 -0
- package/dist/glyphs/hidden.js.map +1 -0
- package/dist/glyphs/index.js +2 -8
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +23 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/messages.js +41 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -3
- package/dist/indicator/index.d.ts +15 -0
- package/dist/indicator/index.js +256 -0
- package/dist/indicator/index.js.map +1 -0
- package/dist/indicator/motion.js +86 -0
- package/dist/indicator/motion.js.map +1 -0
- package/dist/indicator/paths.js +72 -0
- package/dist/indicator/paths.js.map +1 -0
- package/dist/indicator/styles.js +62 -0
- package/dist/indicator/styles.js.map +1 -0
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js.map +1 -1
- package/dist/number/locale.js +14 -0
- package/dist/number/locale.js.map +1 -0
- package/dist/overlay/host.js +65 -2
- package/dist/overlay/host.js.map +1 -1
- package/dist/press/index.js +63 -63
- package/dist/press/index.js.map +1 -1
- package/dist/theme/resolve.js +1 -1
- package/dist/theme/resolve.js.map +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["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 { 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<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<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 { SegmentedButtonProps, SegmentedButtonSegmentProps }\n"],"mappings":";;;;;;;;;;;;;;;AAyNA,MAAMgF,aAAa;AAGnB,MAAMC,aAAa;AAEnB,MAAMC,QAAQ,oBAAC,YAAD,CAAW,CAAA;AAEzB,MAAMC,eAAerE,cAAwC,IAAI;AAGjE,MAAMsE,eAAetE,cAAc,CAAC;AAEpC,MAAMuE,SAAS5D,WAAW6D,OAAO;CAG/BC,OAAO;EACLC,YAAY;EACZC,YAAY;EACZC,QAAQV;EACRW,gBAAgB;EAChB9B,OAAOmB;CACT;CAGAY,WAAW;EACTJ,YAAY;EACZC,YAAY;EACZC,QAAQV;EACRW,gBAAgB;EAChBE,UAAU;CACZ;CAIAC,WAAW;EACTC,QAAQ;EACRC,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAC,OAAO;EACLV,YAAY;EACZW,UAAU;CACZ;CAEAC,UAAU;EACRb,YAAY;EACZc,SAAS;EACTC,eAAe;EACfP,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAM,cAAc;EACZT,QAAQ;EACRU,KAAK;EACLT,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAQ,QAAQ;EACNlB,Y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AyB7O,WAAW6O,SAASqB,MAAM;EAC5D;CAAC,CACF;CACK,MAAAxF,KAAA7K,uBAAiB;EAAA;EAAA,OAEd,EAAAgC,OAASmH,eAAA0G,OAAsB1P,WAAW0P,MAAMQ,MAAM,EAAE;CAAC,CACjE;CACS,MAAApF,KAAAjL,uBAAiB;EAAA;EAAA,OAElB,EAAAgC,OAASmH,eAAA+F,WAA0B/O,WAAW+O,UAAUmB,MAAM,EAAE;CAAC,CACzE;CAAC,IAAAnF;CAAA,IAAAnC,EAAA,OAAAa,MAAAb,EAAA,OAAAwB,MAAAxB,EAAA,OAAA4B,MAAA5B,EAAA,OAAA6B,MAAA7B,EAAA,OAAA8B,MAAA9B,EAAA,OAAAkC,IAAA;EAvCGC,KAAA;GAAA6E,MACCnG;GAKJkG,KAIGvF;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","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 { SegmentedButtonProps, SegmentedButtonSegmentProps }\n"],"mappings":";;;;;;;;;;;;;;;AAyNA,MAAMiF,aAAa;AAGnB,MAAMC,aAAa;AAEnB,MAAMC,QAAQ,oBAAC,YAAD,CAAW,CAAA;AAEzB,MAAMC,eAAerE,cAAwC,IAAI;AAGjE,MAAMsE,eAAetE,cAAc,CAAC;AAEpC,MAAMuE,SAAS5D,WAAW6D,OAAO;CAG/BC,OAAO;EACLC,YAAY;EACZC,YAAY;EACZC,QAAQV;EACRW,gBAAgB;EAChB9B,OAAOmB;CACT;CAGAY,WAAW;EACTJ,YAAY;EACZC,YAAY;EACZC,QAAQV;EACRW,gBAAgB;EAChBE,UAAU;CACZ;CAIAC,WAAW;EACTC,QAAQ;EACRC,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAC,OAAO;EACLV,YAAY;EACZW,UAAU;CACZ;CAEAC,UAAU;EACRb,YAAY;EACZc,SAAS;EACTC,eAAe;EACfP,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAM,cAAc;EACZT,QAAQ;EACRU,KAAK;EACLT,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAGAQ,QAAQ;EACNlB,YAAY;EACZmB,eAAe;EACflB,YAAY;EACZE,gBAAgB;CAClB;AACF,CAAC;AAED,MAAMiB,WAAWhE,cAAc,EAAEiE,QAAQC,OAAOC,QAAQC,cACtDvF,WAAW6D,OAAO;CAIhB2B,MAAM;EACJC,cAAcJ,MAAMK;EACpBpB,QAAQ;EACRU,KAAK;EACLZ,UAAU;EACVU,eAAe;EACfP,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;CAEAkB,OAAO,EACLC,kBAAkBpC,WACpB;CACAqC,SAAS;EACP9B,YAAY;EACZ+B,aAAaV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wB,MAAAxB,EAAA,OAAA4B,MAAA5B,EAAA,OAAA6B,MAAA7B,EAAA,OAAA8B,MAAA9B,EAAA,OAAAkC,IAAA;EAvCGC,KAAA;GAAA6E,MACCnG;GAKJkG,KAIGvF;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"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
2
|
+
import { ComponentRef, Ref } from "react";
|
|
3
|
+
//#region src/components/snackbar/index.d.ts
|
|
4
|
+
type ShownMessage = {
|
|
5
|
+
readonly action: SnackbarAction | undefined;
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly onClose: (() => void) | undefined;
|
|
9
|
+
readonly showCloseButton: boolean;
|
|
10
|
+
readonly timeout: number;
|
|
11
|
+
};
|
|
12
|
+
type SnackbarAction = {
|
|
13
|
+
/** What the action says. The page gives it a single word where it can. */
|
|
14
|
+
readonly label: string;
|
|
15
|
+
/** Run when the action is pressed, just before the snackbar closes. */
|
|
16
|
+
readonly onPress: () => void;
|
|
17
|
+
};
|
|
18
|
+
type SnackbarOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* A single action shown after the message. Pressing it runs `onPress` and
|
|
21
|
+
* closes the snackbar, which is what the page draws.
|
|
22
|
+
*/
|
|
23
|
+
readonly action?: SnackbarAction;
|
|
24
|
+
/**
|
|
25
|
+
* Run when the snackbar closes, however it was closed: by its timer, its
|
|
26
|
+
* action or close button, `close`, `clear`, or a newer message added in its
|
|
27
|
+
* place.
|
|
28
|
+
*/
|
|
29
|
+
readonly onClose?: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a close button is shown at the end. The page draws one for a
|
|
32
|
+
* message a reader may want out of the way before it expires.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly showCloseButton?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* How long the snackbar is shown, in milliseconds. Defaults to five seconds
|
|
38
|
+
* for a message alone, which Android lengthens from the reader's own
|
|
39
|
+
* accessibility setting. A message with an action defaults to `0` and stays
|
|
40
|
+
* until the action is taken or something closes it, as Material Design asks
|
|
41
|
+
* of an actionable snackbar. The timer is paused while a pointer is over the
|
|
42
|
+
* snackbar or one of its controls has focus, so a message never expires
|
|
43
|
+
* while it is being read.
|
|
44
|
+
*
|
|
45
|
+
* `0` is the page's indefinite length: the snackbar stays until something
|
|
46
|
+
* closes it. Give one of those an action or `showCloseButton`, or there is
|
|
47
|
+
* no way to be rid of it.
|
|
48
|
+
*/
|
|
49
|
+
readonly timeout?: number;
|
|
50
|
+
};
|
|
51
|
+
type SnackbarProps = Omit<ViewProps, 'children' | 'style'> & {
|
|
52
|
+
/**
|
|
53
|
+
* What a screen reader calls the button that dismisses a snackbar. It sits
|
|
54
|
+
* here rather than on a message's own options because it does not vary by
|
|
55
|
+
* message.
|
|
56
|
+
* @default 'Close'
|
|
57
|
+
*/
|
|
58
|
+
readonly closeLabel?: string;
|
|
59
|
+
/** The queue the snackbar shows messages from. */
|
|
60
|
+
readonly queue: SnackbarQueue;
|
|
61
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
62
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The queue a snackbar is shown from. Make one where the app can reach it, a
|
|
66
|
+
* module of its own being the usual place, mount `Snackbar` once with it, and
|
|
67
|
+
* call `add` from anywhere.
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* const messages = new Snackbar.Queue()
|
|
71
|
+
* messages.add('Label', { action: { label: 'Undo', onPress: undo } })
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare class SnackbarQueue {
|
|
75
|
+
#private;
|
|
76
|
+
/**
|
|
77
|
+
* Shows a message in place of the one on screen, and returns the key that
|
|
78
|
+
* closes it. The message it replaces is closed, so its `onClose` runs, and
|
|
79
|
+
* it does not come back.
|
|
80
|
+
*/
|
|
81
|
+
add(message: string, options?: SnackbarOptions): string;
|
|
82
|
+
/** Closes the snackbar on screen, running its `onClose`. */
|
|
83
|
+
clear(): void;
|
|
84
|
+
/** Closes one snackbar, by the key `add` returned. */
|
|
85
|
+
close(key: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Calls `listener` whenever the message on screen changes, and returns what
|
|
88
|
+
* stops it. `Snackbar` reads the queue through this and `visible`, and
|
|
89
|
+
* neither is meant for a call site.
|
|
90
|
+
*/
|
|
91
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
92
|
+
/** The message on screen, or `null`. */
|
|
93
|
+
readonly visible: () => ShownMessage | null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A brief message at the bottom of the screen, with an optional action, with
|
|
97
|
+
* web's props and values. Mount one of these with a `Snackbar.Queue`, and
|
|
98
|
+
* call the queue's `add` to show a message from anywhere.
|
|
99
|
+
*
|
|
100
|
+
* ```tsx
|
|
101
|
+
* const messages = new Snackbar.Queue()
|
|
102
|
+
*
|
|
103
|
+
* <Snackbar queue={messages} />
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* It draws in the overlay host of the app's outermost `ThemeScope`, above the
|
|
107
|
+
* screen, and needs one around it. It is one region rather than one per
|
|
108
|
+
* message, so mount it once, near the root, inside the `SafeAreaProvider`
|
|
109
|
+
* whose insets it keeps clear of.
|
|
110
|
+
*
|
|
111
|
+
* `style`, `ref` and `testID` land on that region, a view along the bottom of
|
|
112
|
+
* the screen that holds the message.
|
|
113
|
+
*/
|
|
114
|
+
declare function Snackbar({ closeLabel, queue, style, ...props }: SnackbarProps): import("react").JSX.Element;
|
|
115
|
+
declare namespace Snackbar {
|
|
116
|
+
var Queue: typeof SnackbarQueue;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { Snackbar, type SnackbarAction, type SnackbarOptions, type SnackbarProps, type SnackbarQueue };
|
|
120
|
+
//# sourceMappingURL=index.d.ts.map
|