@kanso-labs/react-native-kanso-ui 0.2.0 → 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.
Files changed (60) hide show
  1. package/dist/button/index.d.ts +8 -0
  2. package/dist/button/index.js +38 -26
  3. package/dist/button/index.js.map +1 -1
  4. package/dist/button/slots.js +7 -0
  5. package/dist/button/slots.js.map +1 -0
  6. package/dist/components/avatar/index.d.ts +2 -2
  7. package/dist/components/avatar/index.js.map +1 -1
  8. package/dist/components/button/index.d.ts +3 -3
  9. package/dist/components/button/index.js +115 -109
  10. package/dist/components/button/index.js.map +1 -1
  11. package/dist/components/card/index.d.ts +2 -2
  12. package/dist/components/card/index.js.map +1 -1
  13. package/dist/components/checkbox/index.d.ts +2 -2
  14. package/dist/components/checkbox/index.js.map +1 -1
  15. package/dist/components/chip/index.d.ts +2 -2
  16. package/dist/components/chip/index.js.map +1 -1
  17. package/dist/components/chip-group/index.d.ts +3 -3
  18. package/dist/components/chip-group/index.js.map +1 -1
  19. package/dist/components/copy-field/index.d.ts +2 -2
  20. package/dist/components/copy-field/index.js.map +1 -1
  21. package/dist/components/dialog/index.d.ts +131 -0
  22. package/dist/components/dialog/index.js +861 -0
  23. package/dist/components/dialog/index.js.map +1 -0
  24. package/dist/components/icon-button/index.d.ts +3 -3
  25. package/dist/components/icon-button/index.js +128 -122
  26. package/dist/components/icon-button/index.js.map +1 -1
  27. package/dist/components/link/index.js +1 -1
  28. package/dist/components/link/index.js.map +1 -1
  29. package/dist/components/meter/index.d.ts +2 -2
  30. package/dist/components/meter/index.js.map +1 -1
  31. package/dist/components/number-field/index.d.ts +3 -3
  32. package/dist/components/number-field/index.js.map +1 -1
  33. package/dist/components/product-icon/index.d.ts +2 -2
  34. package/dist/components/product-icon/index.js.map +1 -1
  35. package/dist/components/progress-indicator/index.d.ts +2 -2
  36. package/dist/components/progress-indicator/index.js.map +1 -1
  37. package/dist/components/radio-group/index.d.ts +3 -3
  38. package/dist/components/radio-group/index.js.map +1 -1
  39. package/dist/components/search-field/index.d.ts +3 -3
  40. package/dist/components/search-field/index.js.map +1 -1
  41. package/dist/components/segmented-button/index.d.ts +3 -3
  42. package/dist/components/segmented-button/index.js.map +1 -1
  43. package/dist/components/snackbar/index.d.ts +2 -2
  44. package/dist/components/snackbar/index.js.map +1 -1
  45. package/dist/components/switch/index.d.ts +2 -2
  46. package/dist/components/switch/index.js.map +1 -1
  47. package/dist/components/text-field/index.d.ts +3 -3
  48. package/dist/components/text-field/index.js.map +1 -1
  49. package/dist/field/index.d.ts +1 -1
  50. package/dist/field/index.js.map +1 -1
  51. package/dist/form/index.d.ts +1 -1
  52. package/dist/form/index.js.map +1 -1
  53. package/dist/index.d.ts +2 -1
  54. package/dist/index.js +3 -2
  55. package/dist/mark/index.d.ts +1 -1
  56. package/dist/mark/index.js.map +1 -1
  57. package/dist/overlay/host.js.map +1 -1
  58. package/dist/press/index.js +59 -60
  59. package/dist/press/index.js.map +1 -1
  60. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ReactNode","Ref","RefObject","StyleProp","TextInput","TextInputKeyPressEvent","TextInputProps","TextInputSubmitEditingEvent","ViewStyle","useId","useImperativeHandle","useRef","useState","Pressable","StyleSheet","useWindowDimensions","View","ValidationResult","IconStyle","describedBy","FieldInput","FieldMessage","FieldStates","FieldStroke","useFieldFocus","useStrokeMotion","useFieldValidation","CloseGlyph","SearchGlyph","IconStyleContext","usePressFeedback","withOpacity","useTheme","composeStyles","themedStyles","IconButton","SearchBarProps","children","clearLabel","control","isDisabled","isFocused","isInvalid","isRequired","onClear","showsClear","SearchFieldProps","Omit","defaultValue","description","error","inputRef","label","name","onChange","value","onSubmit","placeholder","ref","style","validate","ICON_SIZE","MAX_WIDTH","CLEAR_LABEL","stylesOf","colors","radii","spacing","stateLayerOpacity","create","bar","alignItems","backgroundColor","surfaceContainerHigh","borderRadius","pill","flexDirection","gap","lg","maxWidth","paddingEnd","paddingStart","md","barDisabled","onSurface","disabledContainer","clear","marginEnd","xs","ring","bottom","left","pointerEvents","position","right","top","blurThen","onBlur","then","event","clearFrom","current","focus","clearInto","setOwn","onEdit","editInto","text","focusOf","iconStyleOf","color","size","keyInto","onKeyPress","undefined","nativeEvent","key","minHeightOf","minHeight","SearchBar","t0","$","_c","theme","styles","fontScale","sizing","typography","t1","t2","corners","disabled","disableRipple","feedback","primary","T0","t3","t4","t5","handlers","onHoverIn","t6","onHoverOut","t7","t8","onPressIn","t9","onPressOut","t10","controlLg","bodyLargeLineHeight","t11","layer","t12","width","t13","onSurfaceVariant","disabledContent","t14","t15","Symbol","for","t16","t17","t18","t19","SearchField","onFocus","onSubmitEditing","props","id","own","isEmpty","isReadOnly","submitted","validation","shownError","T1","focused","T2","submitInto","t20","t21","t22","t23","_c"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["import type { ReactNode, Ref, RefObject } from 'react'\nimport type {\n StyleProp,\n TextInput,\n TextInputKeyPressEvent,\n TextInputProps,\n TextInputSubmitEditingEvent,\n ViewStyle,\n} from 'react-native'\n\nimport { useId, useImperativeHandle, useRef, useState } from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\n\nimport type { ValidationResult } from '../../form'\nimport type { IconStyle } from '../../glyphs/icon-style'\n\nimport {\n describedBy,\n FieldInput,\n FieldMessage,\n FieldStates,\n FieldStroke,\n useFieldFocus,\n useStrokeMotion,\n} from '../../field'\nimport { useFieldValidation } from '../../form'\nimport { CloseGlyph, SearchGlyph } from '../../glyphs'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { IconButton } from '../icon-button'\n\n// kanso-ui's SearchField: the search page's search bar on its own, rather\n// than the box the other fields share. A pill on surface container high, the\n// page's 24dp magnifier in on surface variant at the start, the value in body\n// large on surface, and a clear button at the end while the field holds\n// anything. The page's 16dp of padding is to a 48dp tap target and the icon\n// sits 12dp inside that, so the magnifier starts 28dp in and the value 4dp\n// past the target, at 68dp. The clear button is the medium icon button, 40dp\n// around a 24dp icon, 4dp in from the padding, so its icon ends 28dp from the\n// end. The bar follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it.\n//\n// The bar is the large control height, 56dp, as web's is, and grows by as\n// much as the value's line does at the device's text size.\n//\n// Under a pointer and while pressed, the bar draws the state layer every\n// control draws through `usePressFeedback`, on surface at the hover and\n// pressed opacities, and a press anywhere on it focuses the control, as a\n// press anywhere on the other fields' boxes does. The page names a focused\n// state and draws nothing for it, so the bar takes the 2dp primary ring the\n// text fields page gives a focused field, inside the pill, as web's does. An\n// error is the text fields page's too, which the search page does not name:\n// the ring in the error role, 1dp at rest and 2dp once focused. The ring is a\n// border on a view of its own over the bar rather than a shadow, so the\n// colour and the width ease together and showing it moves nothing.\n//\n// **Disabled is the chrome's, translucent**, on surface at the disabled\n// opacities over whatever the bar sits on, as the text field's box is, rather\n// than mixed over the surface role as web's is.\n//\n// The label is the control's name and is never drawn, since the bar has no\n// place for one: the placeholder is what a person reads.\n\ntype SearchBarProps = {\n /** The field's input, between the magnifier and the clear button. */\n readonly children: ReactNode\n readonly clearLabel: string\n /** The control a press on the bar, or on the clear button, focuses. */\n readonly control: RefObject<null | TextInput>\n readonly isDisabled: boolean\n readonly isFocused: boolean\n readonly isInvalid: boolean\n readonly isRequired: boolean\n /** Empties the field, from the clear button. */\n readonly onClear: () => void\n /** Whether the field holds anything, which shows the clear button. */\n readonly showsClear: boolean\n}\n\ntype SearchFieldProps = Omit<\n TextInputProps,\n | 'accessibilityHint'\n | 'accessibilityLabel'\n | 'aria-disabled'\n | 'aria-label'\n | 'children'\n | 'cursorColor'\n | 'defaultValue'\n | 'editable'\n | 'multiline'\n | 'numberOfLines'\n | 'onChange'\n | 'onChangeText'\n | 'placeholderTextColor'\n | 'readOnly'\n | 'returnKeyType'\n | 'role'\n | 'selectionColor'\n | 'style'\n | 'underlineColorAndroid'\n | 'value'\n> & {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, it is \"Clear search\", the English name web's takes from React\n * Aria.\n */\n readonly clearLabel?: string\n /** The value the field opens with, when it keeps its own. */\n readonly defaultValue?: string\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so the\n * two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the ring in the error role,\n * and the invalid state a screen reader reads all follow from it. The line\n * under the bar arrives with the message, so the field grows when this\n * does, unless it is inside a `Form`, which keeps the line drawn. It wins\n * over what `validate` and the form say, and holds a `native` form back.\n */\n readonly error?: string\n /**\n * A ref to the field's own `TextInput`, which is what a call site moves\n * focus to. `ref` is the field as a whole.\n */\n readonly inputRef?: Ref<TextInput>\n /**\n * Draws the field disabled: it takes no focus and no input, and its clear\n * button no press.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Whether the field has to be filled in, which a screen reader reads.\n * Inside a `native` form, an empty one holds the submission back and shows\n * its error once a submission is tried. The bar draws no label, so there\n * is no asterisk to show it.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the field searches, for a screen reader. The bar draws no label, so\n * this is read and never shown; `placeholder` is what is seen.\n */\n readonly label: string\n /**\n * The name the value is submitted under by the `Form` around the field,\n * and the key its `validationErrors` reach the field by.\n */\n readonly name?: string\n /** Called with the new value as it is edited, and with `''` once cleared. */\n readonly onChange?: (value: string) => void\n /** Called once the field is emptied, from its clear button or Escape. */\n readonly onClear?: () => void\n /** Called with the value when the keyboard's search key submits it. */\n readonly onSubmit?: (value: string) => void\n /** The supporting text in the empty bar, which is what a person reads. */\n readonly placeholder?: string\n readonly ref?: Ref<View>\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n /**\n * Checks the value, and returns its problem in words, or several, where\n * there is one, and `true`, `null` or `undefined` where there is none.\n * Under the default `aria` validation the error shows as the value\n * changes; inside a `native` form it shows once a submission is tried, or\n * once the field loses focus after an edit, and holds the form back.\n */\n readonly validate?: (value: string) => ValidationResult\n /** The value, when the call site keeps it. */\n readonly value?: string\n}\n\n// The page's icon, which the magnifier is drawn at.\nconst ICON_SIZE = 24\n\n// The widest the page draws a search bar.\nconst MAX_WIDTH = 720\n\n// The clear button's name when the call site gives none, as React Aria names\n// web's in English.\nconst CLEAR_LABEL = 'Clear search'\n\nconst stylesOf = themedStyles(({ colors, radii, spacing, stateLayerOpacity }) =>\n StyleSheet.create({\n bar: {\n alignItems: 'center',\n backgroundColor: colors.surfaceContainerHigh,\n borderRadius: radii.pill,\n flexDirection: 'row',\n gap: spacing.lg,\n maxWidth: MAX_WIDTH,\n paddingEnd: spacing.lg,\n paddingStart: spacing.lg + spacing.md,\n },\n barDisabled: {\n backgroundColor: withOpacity(\n colors.onSurface,\n stateLayerOpacity.disabledContainer,\n ),\n },\n // 4dp in from the padding, so the icon inside the 40dp button ends\n // 28dp from the end, where the page's 48dp target puts it.\n clear: {\n marginEnd: spacing.xs,\n },\n // The ring, over the whole bar and its corners. It takes no touches,\n // so a press lands on the bar under it.\n ring: {\n borderRadius: radii.pill,\n bottom: 0,\n left: 0,\n pointerEvents: 'none',\n position: 'absolute',\n right: 0,\n top: 0,\n },\n }),\n)\n\n// Empties the field: the value goes, and the call site is told twice over.\n// The field's own blur handling, then the call site's.\nfunction blurThen(\n onBlur: () => void,\n then: TextInputProps['onBlur'],\n): TextInputProps['onBlur'] {\n return (event) => {\n onBlur()\n then?.(event)\n }\n}\n\n// Empties the field from its button, and hands focus back to the control, so\n// the next keyword is typed straight in.\nfunction clearFrom(onClear: () => void, control: RefObject<null | TextInput>) {\n return () => {\n onClear()\n control.current?.focus()\n }\n}\n\nfunction clearInto(\n setOwn: (value: string) => void,\n onChange: ((value: string) => void) | undefined,\n onClear: (() => void) | undefined,\n onEdit: () => void,\n) {\n return () => {\n setOwn('')\n onEdit()\n onChange?.('')\n onClear?.()\n }\n}\n\n// Keeps an edit as the field's own value and reports it, so a field the call\n// site controls is told and one it does not still shows what was typed, and\n// tells the field's validation it was edited.\nfunction editInto(\n setOwn: (value: string) => void,\n onChange: ((value: string) => void) | undefined,\n onEdit: () => void,\n) {\n return (text: string) => {\n setOwn(text)\n onEdit()\n onChange?.(text)\n }\n}\n\nfunction focusOf(control: RefObject<null | TextInput>) {\n return () => {\n control.current?.focus()\n }\n}\n\nfunction iconStyleOf(color: string): IconStyle {\n return { color, size: ICON_SIZE }\n}\n\n// Escape empties a field that holds anything, from a hardware keyboard or\n// under React Native Web, as it does web's. The call site's own handler is\n// called after.\nfunction keyInto(\n clear: (() => void) | undefined,\n onKeyPress: TextInputProps['onKeyPress'],\n) {\n return (event: TextInputKeyPressEvent) => {\n if (clear !== undefined && event.nativeEvent.key === 'Escape') {\n clear()\n }\n onKeyPress?.(event)\n }\n}\n\nfunction minHeightOf(minHeight: number): ViewStyle {\n return { minHeight }\n}\n\n/**\n * The bar around the control: the pill with its state layer and ring, the\n * magnifier at the start and the clear button at the end. A press anywhere on\n * it focuses the control.\n */\nfunction SearchBar({\n children,\n clearLabel,\n control,\n isDisabled,\n isFocused,\n isInvalid,\n isRequired,\n onClear,\n showsClear,\n}: SearchBarProps) {\n const theme = useTheme()\n const styles = stylesOf(theme)\n const { fontScale } = useWindowDimensions()\n const { colors, radii, sizing, stateLayerOpacity, typography } = theme\n const feedback = usePressFeedback({\n color: colors.onSurface,\n corners: { borderRadius: radii.pill },\n disabled: isDisabled,\n disableRipple: true,\n })\n const ring = useStrokeMotion(\n isInvalid ? colors.error : colors.primary,\n isDisabled ? 0 : isFocused ? 2 : isInvalid ? 1 : 0,\n )\n\n return (\n <Pressable\n accessible={false}\n disabled={isDisabled}\n focusable={false}\n onHoverIn={feedback.handlers.onHoverIn}\n onHoverOut={feedback.handlers.onHoverOut}\n onPress={focusOf(control)}\n onPressIn={feedback.handlers.onPressIn}\n onPressOut={feedback.handlers.onPressOut}\n style={composeStyles<ViewStyle>(\n styles.bar,\n isDisabled ? styles.barDisabled : undefined,\n minHeightOf(\n sizing.controlLg + typography.bodyLargeLineHeight * (fontScale - 1),\n ),\n )}\n >\n {feedback.layer}\n <FieldStroke\n color={ring.color}\n sides=\"all\"\n style={styles.ring}\n width={ring.width}\n />\n <IconStyleContext\n value={iconStyleOf(\n isDisabled\n ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n : colors.onSurfaceVariant,\n )}\n >\n <SearchGlyph />\n </IconStyleContext>\n <FieldStates\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isRequired={isRequired}\n >\n {children}\n </FieldStates>\n {showsClear ? (\n <IconButton\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onPress={clearFrom(onClear, control)}\n style={styles.clear}\n >\n <CloseGlyph />\n </IconButton>\n ) : null}\n </Pressable>\n )\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with the keyboard's\n * search key and cleared with its button. Pass `value` with `onChange` to\n * control it, or `defaultValue` to let it keep its own; `onSubmit` is handed\n * the value when the search key is pressed, and `onClear` is called when the\n * field is emptied.\n *\n * The bar is the search page's rather than the box the other fields share;\n * the control and the line under it are the field chrome in `src/field`.\n * React Native's own `TextInput` props reach the control; `style` and `ref`\n * are the field as a whole, and `inputRef` the control.\n *\n * ```tsx\n * <SearchField label=\"Label\" placeholder=\"Supporting text\" />\n * ```\n */\nfunction SearchField({\n clearLabel = CLEAR_LABEL,\n defaultValue = '',\n description,\n error,\n inputRef,\n isDisabled = false,\n isRequired = false,\n label,\n name,\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyPress,\n onSubmit,\n onSubmitEditing,\n ref,\n style,\n validate,\n value,\n ...props\n}: SearchFieldProps) {\n const id = useId()\n const control = useRef<TextInput>(null)\n const [own, setOwn] = useState(defaultValue)\n const current = value ?? own\n const validation = useFieldValidation({\n control,\n error,\n isDisabled,\n isEmpty: current === '',\n isReadOnly: false,\n isRequired,\n name,\n submitted: current,\n validate,\n value: current,\n })\n const focus = useFieldFocus({\n onBlur: blurThen(validation.onBlur, onBlur),\n onFocus,\n })\n const clear = clearInto(setOwn, onChange, onClear, validation.onEdit)\n const shownError = validation.error\n\n useImperativeHandle<null | TextInput, null | TextInput>(\n inputRef,\n () => control.current,\n [],\n )\n\n return (\n <View ref={ref} style={style}>\n <SearchBar\n clearLabel={clearLabel}\n control={control}\n isDisabled={isDisabled}\n isFocused={focus.focused}\n isInvalid={shownError !== undefined}\n isRequired={isRequired}\n onClear={clear}\n showsClear={current !== ''}\n >\n <FieldInput\n {...props}\n {...focus.handlers}\n aria-label={label}\n described={describedBy(id, { description, error: shownError })}\n editable={!isDisabled}\n onChangeText={editInto(setOwn, onChange, validation.onEdit)}\n onKeyPress={keyInto(\n current === '' || isDisabled ? undefined : clear,\n onKeyPress,\n )}\n onSubmitEditing={submitInto(current, onSubmit, onSubmitEditing)}\n ref={control}\n returnKeyType=\"search\"\n role=\"searchbox\"\n value={current}\n />\n </SearchBar>\n <FieldMessage description={description} error={shownError} id={id} />\n </View>\n )\n}\n\n// Hands the value to `onSubmit` when the keyboard's search key is pressed,\n// and the event to the call site's own handler after.\nfunction submitInto(\n value: string,\n onSubmit: ((value: string) => void) | undefined,\n onSubmitEditing: TextInputProps['onSubmitEditing'],\n) {\n return (event: TextInputSubmitEditingEvent) => {\n onSubmit?.(value)\n onSubmitEditing?.(event)\n }\n}\n\nexport { SearchField }\nexport type { SearchFieldProps }\n"],"mappings":";;;;;;;;;;;;;;AAqLA,MAAM6D,YAAY;AAGlB,MAAMC,YAAY;AAIlB,MAAMC,cAAc;AAEpB,MAAMC,WAAW9B,cAAc,EAAE+B,QAAQC,OAAOC,SAASC,wBACvDtD,WAAWuD,OAAO;CAChBC,KAAK;EACHC,YAAY;EACZC,iBAAiBP,OAAOQ;EACxBC,cAAcR,MAAMS;EACpBC,eAAe;EACfC,KAAKV,QAAQW;EACbC,UAAUjB;EACVkB,YAAYb,QAAQW;EACpBG,cAAcd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C7C3C,WAAWD,KAAK;EAChBiH,kBAAkBrE,KAAK;CACzB;AACF"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","RefObject","StyleProp","TextInput","TextInputKeyPressEvent","TextInputProps","TextInputSubmitEditingEvent","ViewStyle","useId","useImperativeHandle","useRef","useState","Pressable","StyleSheet","useWindowDimensions","View","ValidationResult","IconStyle","describedBy","FieldInput","FieldMessage","FieldStates","FieldStroke","useFieldFocus","useStrokeMotion","useFieldValidation","CloseGlyph","SearchGlyph","IconStyleContext","usePressFeedback","withOpacity","useTheme","composeStyles","themedStyles","IconButton","SearchBarProps","children","clearLabel","control","isDisabled","isFocused","isInvalid","isRequired","onClear","showsClear","SearchFieldProps","Omit","defaultValue","description","error","inputRef","label","name","onChange","value","onSubmit","placeholder","ref","style","validate","ICON_SIZE","MAX_WIDTH","CLEAR_LABEL","stylesOf","colors","radii","spacing","stateLayerOpacity","create","bar","alignItems","backgroundColor","surfaceContainerHigh","borderRadius","pill","flexDirection","gap","lg","maxWidth","paddingEnd","paddingStart","md","barDisabled","onSurface","disabledContainer","clear","marginEnd","xs","ring","bottom","left","pointerEvents","position","right","top","blurThen","onBlur","then","event","clearFrom","current","focus","clearInto","setOwn","onEdit","editInto","text","focusOf","iconStyleOf","color","size","keyInto","onKeyPress","undefined","nativeEvent","key","minHeightOf","minHeight","SearchBar","t0","$","_c","theme","styles","fontScale","sizing","typography","t1","t2","corners","disabled","disableRipple","feedback","primary","T0","t3","t4","t5","handlers","onHoverIn","t6","onHoverOut","t7","t8","onPressIn","t9","onPressOut","t10","controlLg","bodyLargeLineHeight","t11","layer","t12","width","t13","onSurfaceVariant","disabledContent","t14","t15","Symbol","for","t16","t17","t18","t19","SearchField","onFocus","onSubmitEditing","props","id","own","isEmpty","isReadOnly","submitted","validation","shownError","T1","focused","T2","submitInto","t20","t21","t22","t23","_c"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref, RefObject } from 'react'\nimport type {\n StyleProp,\n TextInput,\n TextInputKeyPressEvent,\n TextInputProps,\n TextInputSubmitEditingEvent,\n ViewStyle,\n} from 'react-native'\n\nimport { useId, useImperativeHandle, useRef, useState } from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\n\nimport type { ValidationResult } from '../../form'\nimport type { IconStyle } from '../../glyphs/icon-style'\n\nimport {\n describedBy,\n FieldInput,\n FieldMessage,\n FieldStates,\n FieldStroke,\n useFieldFocus,\n useStrokeMotion,\n} from '../../field'\nimport { useFieldValidation } from '../../form'\nimport { CloseGlyph, SearchGlyph } from '../../glyphs'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { IconButton } from '../icon-button'\n\n// kanso-ui's SearchField: the search page's search bar on its own, rather\n// than the box the other fields share. A pill on surface container high, the\n// page's 24dp magnifier in on surface variant at the start, the value in body\n// large on surface, and a clear button at the end while the field holds\n// anything. The page's 16dp of padding is to a 48dp tap target and the icon\n// sits 12dp inside that, so the magnifier starts 28dp in and the value 4dp\n// past the target, at 68dp. The clear button is the medium icon button, 40dp\n// around a 24dp icon, 4dp in from the padding, so its icon ends 28dp from the\n// end. The bar follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it.\n//\n// The bar is the large control height, 56dp, as web's is, and grows by as\n// much as the value's line does at the device's text size.\n//\n// Under a pointer and while pressed, the bar draws the state layer every\n// control draws through `usePressFeedback`, on surface at the hover and\n// pressed opacities, and a press anywhere on it focuses the control, as a\n// press anywhere on the other fields' boxes does. The page names a focused\n// state and draws nothing for it, so the bar takes the 2dp primary ring the\n// text fields page gives a focused field, inside the pill, as web's does. An\n// error is the text fields page's too, which the search page does not name:\n// the ring in the error role, 1dp at rest and 2dp once focused. The ring is a\n// border on a view of its own over the bar rather than a shadow, so the\n// colour and the width ease together and showing it moves nothing.\n//\n// **Disabled is the chrome's, translucent**, on surface at the disabled\n// opacities over whatever the bar sits on, as the text field's box is, rather\n// than mixed over the surface role as web's is.\n//\n// The label is the control's name and is never drawn, since the bar has no\n// place for one: the placeholder is what a person reads.\n\ntype SearchBarProps = {\n /** The field's input, between the magnifier and the clear button. */\n readonly children: ReactNode\n readonly clearLabel: string\n /** The control a press on the bar, or on the clear button, focuses. */\n readonly control: RefObject<ComponentRef<typeof TextInput> | null>\n readonly isDisabled: boolean\n readonly isFocused: boolean\n readonly isInvalid: boolean\n readonly isRequired: boolean\n /** Empties the field, from the clear button. */\n readonly onClear: () => void\n /** Whether the field holds anything, which shows the clear button. */\n readonly showsClear: boolean\n}\n\ntype SearchFieldProps = Omit<\n TextInputProps,\n | 'accessibilityHint'\n | 'accessibilityLabel'\n | 'aria-disabled'\n | 'aria-label'\n | 'children'\n | 'cursorColor'\n | 'defaultValue'\n | 'editable'\n | 'multiline'\n | 'numberOfLines'\n | 'onChange'\n | 'onChangeText'\n | 'placeholderTextColor'\n | 'readOnly'\n | 'returnKeyType'\n | 'role'\n | 'selectionColor'\n | 'style'\n | 'underlineColorAndroid'\n | 'value'\n> & {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, it is \"Clear search\", the English name web's takes from React\n * Aria.\n */\n readonly clearLabel?: string\n /** The value the field opens with, when it keeps its own. */\n readonly defaultValue?: string\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so the\n * two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the ring in the error role,\n * and the invalid state a screen reader reads all follow from it. The line\n * under the bar arrives with the message, so the field grows when this\n * does, unless it is inside a `Form`, which keeps the line drawn. It wins\n * over what `validate` and the form say, and holds a `native` form back.\n */\n readonly error?: string\n /**\n * A ref to the field's own `TextInput`, which is what a call site moves\n * focus to. `ref` is the field as a whole.\n */\n readonly inputRef?: Ref<ComponentRef<typeof TextInput>>\n /**\n * Draws the field disabled: it takes no focus and no input, and its clear\n * button no press.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Whether the field has to be filled in, which a screen reader reads.\n * Inside a `native` form, an empty one holds the submission back and shows\n * its error once a submission is tried. The bar draws no label, so there\n * is no asterisk to show it.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the field searches, for a screen reader. The bar draws no label, so\n * this is read and never shown; `placeholder` is what is seen.\n */\n readonly label: string\n /**\n * The name the value is submitted under by the `Form` around the field,\n * and the key its `validationErrors` reach the field by.\n */\n readonly name?: string\n /** Called with the new value as it is edited, and with `''` once cleared. */\n readonly onChange?: (value: string) => void\n /** Called once the field is emptied, from its clear button or Escape. */\n readonly onClear?: () => void\n /** Called with the value when the keyboard's search key submits it. */\n readonly onSubmit?: (value: string) => void\n /** The supporting text in the empty bar, which is what a person reads. */\n readonly placeholder?: string\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n /**\n * Checks the value, and returns its problem in words, or several, where\n * there is one, and `true`, `null` or `undefined` where there is none.\n * Under the default `aria` validation the error shows as the value\n * changes; inside a `native` form it shows once a submission is tried, or\n * once the field loses focus after an edit, and holds the form back.\n */\n readonly validate?: (value: string) => ValidationResult\n /** The value, when the call site keeps it. */\n readonly value?: string\n}\n\n// The page's icon, which the magnifier is drawn at.\nconst ICON_SIZE = 24\n\n// The widest the page draws a search bar.\nconst MAX_WIDTH = 720\n\n// The clear button's name when the call site gives none, as React Aria names\n// web's in English.\nconst CLEAR_LABEL = 'Clear search'\n\nconst stylesOf = themedStyles(({ colors, radii, spacing, stateLayerOpacity }) =>\n StyleSheet.create({\n bar: {\n alignItems: 'center',\n backgroundColor: colors.surfaceContainerHigh,\n borderRadius: radii.pill,\n flexDirection: 'row',\n gap: spacing.lg,\n maxWidth: MAX_WIDTH,\n paddingEnd: spacing.lg,\n paddingStart: spacing.lg + spacing.md,\n },\n barDisabled: {\n backgroundColor: withOpacity(\n colors.onSurface,\n stateLayerOpacity.disabledContainer,\n ),\n },\n // 4dp in from the padding, so the icon inside the 40dp button ends\n // 28dp from the end, where the page's 48dp target puts it.\n clear: {\n marginEnd: spacing.xs,\n },\n // The ring, over the whole bar and its corners. It takes no touches,\n // so a press lands on the bar under it.\n ring: {\n borderRadius: radii.pill,\n bottom: 0,\n left: 0,\n pointerEvents: 'none',\n position: 'absolute',\n right: 0,\n top: 0,\n },\n }),\n)\n\n// Empties the field: the value goes, and the call site is told twice over.\n// The field's own blur handling, then the call site's.\nfunction blurThen(\n onBlur: () => void,\n then: TextInputProps['onBlur'],\n): TextInputProps['onBlur'] {\n return (event) => {\n onBlur()\n then?.(event)\n }\n}\n\n// Empties the field from its button, and hands focus back to the control, so\n// the next keyword is typed straight in.\nfunction clearFrom(\n onClear: () => void,\n control: RefObject<ComponentRef<typeof TextInput> | null>,\n) {\n return () => {\n onClear()\n control.current?.focus()\n }\n}\n\nfunction clearInto(\n setOwn: (value: string) => void,\n onChange: ((value: string) => void) | undefined,\n onClear: (() => void) | undefined,\n onEdit: () => void,\n) {\n return () => {\n setOwn('')\n onEdit()\n onChange?.('')\n onClear?.()\n }\n}\n\n// Keeps an edit as the field's own value and reports it, so a field the call\n// site controls is told and one it does not still shows what was typed, and\n// tells the field's validation it was edited.\nfunction editInto(\n setOwn: (value: string) => void,\n onChange: ((value: string) => void) | undefined,\n onEdit: () => void,\n) {\n return (text: string) => {\n setOwn(text)\n onEdit()\n onChange?.(text)\n }\n}\n\nfunction focusOf(control: RefObject<ComponentRef<typeof TextInput> | null>) {\n return () => {\n control.current?.focus()\n }\n}\n\nfunction iconStyleOf(color: string): IconStyle {\n return { color, size: ICON_SIZE }\n}\n\n// Escape empties a field that holds anything, from a hardware keyboard or\n// under React Native Web, as it does web's. The call site's own handler is\n// called after.\nfunction keyInto(\n clear: (() => void) | undefined,\n onKeyPress: TextInputProps['onKeyPress'],\n) {\n return (event: TextInputKeyPressEvent) => {\n if (clear !== undefined && event.nativeEvent.key === 'Escape') {\n clear()\n }\n onKeyPress?.(event)\n }\n}\n\nfunction minHeightOf(minHeight: number): ViewStyle {\n return { minHeight }\n}\n\n/**\n * The bar around the control: the pill with its state layer and ring, the\n * magnifier at the start and the clear button at the end. A press anywhere on\n * it focuses the control.\n */\nfunction SearchBar({\n children,\n clearLabel,\n control,\n isDisabled,\n isFocused,\n isInvalid,\n isRequired,\n onClear,\n showsClear,\n}: SearchBarProps) {\n const theme = useTheme()\n const styles = stylesOf(theme)\n const { fontScale } = useWindowDimensions()\n const { colors, radii, sizing, stateLayerOpacity, typography } = theme\n const feedback = usePressFeedback({\n color: colors.onSurface,\n corners: { borderRadius: radii.pill },\n disabled: isDisabled,\n disableRipple: true,\n })\n const ring = useStrokeMotion(\n isInvalid ? colors.error : colors.primary,\n isDisabled ? 0 : isFocused ? 2 : isInvalid ? 1 : 0,\n )\n\n return (\n <Pressable\n accessible={false}\n disabled={isDisabled}\n focusable={false}\n onHoverIn={feedback.handlers.onHoverIn}\n onHoverOut={feedback.handlers.onHoverOut}\n onPress={focusOf(control)}\n onPressIn={feedback.handlers.onPressIn}\n onPressOut={feedback.handlers.onPressOut}\n style={composeStyles<ViewStyle>(\n styles.bar,\n isDisabled ? styles.barDisabled : undefined,\n minHeightOf(\n sizing.controlLg + typography.bodyLargeLineHeight * (fontScale - 1),\n ),\n )}\n >\n {feedback.layer}\n <FieldStroke\n color={ring.color}\n sides=\"all\"\n style={styles.ring}\n width={ring.width}\n />\n <IconStyleContext\n value={iconStyleOf(\n isDisabled\n ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n : colors.onSurfaceVariant,\n )}\n >\n <SearchGlyph />\n </IconStyleContext>\n <FieldStates\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isRequired={isRequired}\n >\n {children}\n </FieldStates>\n {showsClear ? (\n <IconButton\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onPress={clearFrom(onClear, control)}\n style={styles.clear}\n >\n <CloseGlyph />\n </IconButton>\n ) : null}\n </Pressable>\n )\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with the keyboard's\n * search key and cleared with its button. Pass `value` with `onChange` to\n * control it, or `defaultValue` to let it keep its own; `onSubmit` is handed\n * the value when the search key is pressed, and `onClear` is called when the\n * field is emptied.\n *\n * The bar is the search page's rather than the box the other fields share;\n * the control and the line under it are the field chrome in `src/field`.\n * React Native's own `TextInput` props reach the control; `style` and `ref`\n * are the field as a whole, and `inputRef` the control.\n *\n * ```tsx\n * <SearchField label=\"Label\" placeholder=\"Supporting text\" />\n * ```\n */\nfunction SearchField({\n clearLabel = CLEAR_LABEL,\n defaultValue = '',\n description,\n error,\n inputRef,\n isDisabled = false,\n isRequired = false,\n label,\n name,\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyPress,\n onSubmit,\n onSubmitEditing,\n ref,\n style,\n validate,\n value,\n ...props\n}: SearchFieldProps) {\n const id = useId()\n const control = useRef<ComponentRef<typeof TextInput>>(null)\n const [own, setOwn] = useState(defaultValue)\n const current = value ?? own\n const validation = useFieldValidation({\n control,\n error,\n isDisabled,\n isEmpty: current === '',\n isReadOnly: false,\n isRequired,\n name,\n submitted: current,\n validate,\n value: current,\n })\n const focus = useFieldFocus({\n onBlur: blurThen(validation.onBlur, onBlur),\n onFocus,\n })\n const clear = clearInto(setOwn, onChange, onClear, validation.onEdit)\n const shownError = validation.error\n\n useImperativeHandle<\n ComponentRef<typeof TextInput> | null,\n ComponentRef<typeof TextInput> | null\n >(inputRef, () => control.current, [])\n\n return (\n <View ref={ref} style={style}>\n <SearchBar\n clearLabel={clearLabel}\n control={control}\n isDisabled={isDisabled}\n isFocused={focus.focused}\n isInvalid={shownError !== undefined}\n isRequired={isRequired}\n onClear={clear}\n showsClear={current !== ''}\n >\n <FieldInput\n {...props}\n {...focus.handlers}\n aria-label={label}\n described={describedBy(id, { description, error: shownError })}\n editable={!isDisabled}\n onChangeText={editInto(setOwn, onChange, validation.onEdit)}\n onKeyPress={keyInto(\n current === '' || isDisabled ? undefined : clear,\n onKeyPress,\n )}\n onSubmitEditing={submitInto(current, onSubmit, onSubmitEditing)}\n ref={control}\n returnKeyType=\"search\"\n role=\"searchbox\"\n value={current}\n />\n </SearchBar>\n <FieldMessage description={description} error={shownError} id={id} />\n </View>\n )\n}\n\n// Hands the value to `onSubmit` when the keyboard's search key is pressed,\n// and the event to the call site's own handler after.\nfunction submitInto(\n value: string,\n onSubmit: ((value: string) => void) | undefined,\n onSubmitEditing: TextInputProps['onSubmitEditing'],\n) {\n return (event: TextInputSubmitEditingEvent) => {\n onSubmit?.(value)\n onSubmitEditing?.(event)\n }\n}\n\nexport { SearchField }\nexport type { SearchFieldProps }\n"],"mappings":";;;;;;;;;;;;;;AAqLA,MAAM8D,YAAY;AAGlB,MAAMC,YAAY;AAIlB,MAAMC,cAAc;AAEpB,MAAMC,WAAW9B,cAAc,EAAE+B,QAAQC,OAAOC,SAASC,wBACvDtD,WAAWuD,OAAO;CAChBC,KAAK;EACHC,YAAY;EACZC,iBAAiBP,OAAOQ;EACxBC,cAAcR,MAAMS;EACpBC,eAAe;EACfC,KAAKV,QAAQW;EACbC,UAAUjB;EACVkB,YAAYb,QAAQW;EACpBG,cAAcd,QAAQW,KAAKX,QAAQe;CACrC;CACAC,aAAa,EACXX,iBAAiBzC,YACfkC,OAAOmB,WACPhB,kBAAkBiB,iBACpB,EACF;CAGAC,OAAO,EACLC,WAAWpB,QAAQqB,GACrB;CAGAC,MAAM;EACJf,cAAcR,MAAMS;EACpBe,QAAQ;EACRC,MAAM;EACNC,eAAe;EACfC,UAAU;EACVC,OAAO;EACPC,KAAK;CACP;AACF,CAAC,CACH;AAIA,SAASC,SACPC,QACAC,MAC0B;CAC1B,QAAQC,UAAU;EAChBF,OAAO;EACPC,OAAOC,KAAK;CACd;AACF;AAIA,SAASC,UACPxD,SACAL,SACA;CACA,aAAa;EACXK,QAAQ;EACRL,QAAQ8D,SAASC,MAAM;CACzB;AACF;AA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,MAAA7D,EAAA;CAAA,IAAA8D;CAAA,IAAA9D,EAAA,QAAAxE,eAAAwE,EAAA,QAAAiD,MAAAjD,EAAA,QAAAuD,YAAA;EACZO,MAAA,oBAAC,cAAD;GAA2BtI;GAAoB+H,OAAAA;GAAgBN;EAAE,CAAA;EAAIjD,EAAA,MAAAxE;EAAAwE,EAAA,MAAAiD;EAAAjD,EAAA,MAAAuD;EAAAvD,EAAA,MAAA8D;CAAA,OAAAA,MAAA9D,EAAA;CAAA,IAAA+D;CAAA,IAAA/D,EAAA,QAAAc,MAAAd,EAAA,QAAA/D,OAAA+D,EAAA,QAAA9D,SAAA8D,EAAA,QAAA6D,OAAA7D,EAAA,QAAA8D,KAAA;EA7BvEC,MAAA,qBAAC,IAAD;GAAW9H;GAAYC;GAAvB,UAAA,CACE2H,KA4BAC,GA7BG;;EA8BE9D,EAAA,MAAAc;EAAAd,EAAA,MAAA/D;EAAA+D,EAAA,MAAA9D;EAAA8D,EAAA,MAAA6D;EAAA7D,EAAA,MAAA8D;EAAA9D,EAAA,MAAA+D;CAAA,OAAAA,MAAA/D,EAAA;CAAA,OA9BP+D;AA8BO;AAMX,SAASJ,WACP7H,OACAC,UACAgH,iBACA;CACA,QAAQrE,UAAuC;EAC7C3C,WAAWD,KAAK;EAChBiH,kBAAkBrE,KAAK;CACzB;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { PressableProps, StyleProp, View, ViewProps, ViewStyle } from "react-native";
2
- import { ReactNode, Ref } from "react";
2
+ import { ComponentRef, ReactNode, Ref } from "react";
3
3
  import { Key } from "react-stately";
4
4
  //#region src/components/segmented-button/index.d.ts
5
5
  /** A name for the set: its own label, or the id of what labels it. */
@@ -30,7 +30,7 @@ type SegmentedButtonProps = LabelledBy & Omit<ViewProps, 'aria-label' | 'aria-la
30
30
  readonly isDisabled?: boolean;
31
31
  /** Called with the chosen keys when the choice changes. */
32
32
  readonly onSelectionChange?: (keys: Set<Key>) => void;
33
- readonly ref?: Ref<View>;
33
+ readonly ref?: Ref<ComponentRef<typeof View>>;
34
34
  /** The chosen keys, when the call site holds the selection. */
35
35
  readonly selectedKeys?: Iterable<Key>;
36
36
  /**
@@ -71,7 +71,7 @@ type SegmentedButtonSegmentProps = Omit<PressableProps, 'children' | 'disabled'
71
71
  * @default false
72
72
  */
73
73
  readonly isDisabled?: boolean;
74
- readonly ref?: Ref<View>;
74
+ readonly ref?: Ref<ComponentRef<typeof View>>;
75
75
  readonly style?: StyleProp<ViewStyle>;
76
76
  };
77
77
  type SelectionMode$1 = 'multiple' | 'single';
@@ -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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actNode","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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ACrO,OAC7BmH,eAAA6F,UAAyB7O,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,5 +1,5 @@
1
1
  import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
2
- import { Ref } from "react";
2
+ import { ComponentRef, Ref } from "react";
3
3
  //#region src/components/snackbar/index.d.ts
4
4
  type ShownMessage = {
5
5
  readonly action: SnackbarAction | undefined;
@@ -58,7 +58,7 @@ type SnackbarProps = Omit<ViewProps, 'children' | 'style'> & {
58
58
  readonly closeLabel?: string;
59
59
  /** The queue the snackbar shows messages from. */
60
60
  readonly queue: SnackbarQueue;
61
- readonly ref?: Ref<View>;
61
+ readonly ref?: Ref<ComponentRef<typeof View>>;
62
62
  readonly style?: StyleProp<ViewStyle>;
63
63
  };
64
64
  /**