{"ast":null,"code":"import * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nimport color from 'color';\nimport { getSegmentedButtonBorderRadius, getSegmentedButtonColors, getSegmentedButtonDensityPadding } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport Icon from \"../Icon\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nimport Text from \"../Typography/Text\";\nconst SegmentedButtonItem = ({\n  checked,\n  accessibilityLabel,\n  disabled,\n  style,\n  labelStyle,\n  showSelectedCheck,\n  checkedColor,\n  uncheckedColor,\n  rippleColor: customRippleColor,\n  background,\n  icon,\n  testID,\n  label,\n  onPress,\n  segment,\n  density = 'regular',\n  theme: themeOverrides,\n  labelMaxFontSizeMultiplier,\n  hitSlop\n}) => {\n  const theme = useInternalTheme(themeOverrides);\n  const checkScale = React.useRef(new Animated.Value(0)).current;\n  React.useEffect(() => {\n    if (!showSelectedCheck) {\n      return;\n    }\n    if (checked) {\n      Animated.spring(checkScale, {\n        toValue: 1,\n        useNativeDriver: true\n      }).start();\n    } else {\n      Animated.spring(checkScale, {\n        toValue: 0,\n        useNativeDriver: true\n      }).start();\n    }\n  }, [checked, checkScale, showSelectedCheck]);\n  const {\n    roundness,\n    isV3\n  } = theme;\n  const {\n    borderColor,\n    textColor,\n    borderWidth,\n    backgroundColor\n  } = getSegmentedButtonColors({\n    checked,\n    theme,\n    disabled,\n    checkedColor,\n    uncheckedColor\n  });\n  const borderRadius = (isV3 ? 5 : 1) * roundness;\n  const segmentBorderRadius = getSegmentedButtonBorderRadius({\n    theme,\n    segment\n  });\n  const rippleColor = customRippleColor || color(textColor).alpha(0.12).rgb().string();\n  const showIcon = !icon ? false : label && checked ? !showSelectedCheck : true;\n  const showCheckedIcon = checked && showSelectedCheck;\n  const iconSize = isV3 ? 18 : 16;\n  const iconStyle = Object.assign({\n    marginRight: label ? 5 : showCheckedIcon ? 3 : 0\n  }, label && {\n    transform: [{\n      scale: checkScale.interpolate({\n        inputRange: [0, 1],\n        outputRange: [1, 0]\n      })\n    }]\n  });\n  const buttonStyle = Object.assign({\n    backgroundColor,\n    borderColor,\n    borderWidth,\n    borderRadius\n  }, segmentBorderRadius);\n  const paddingVertical = getSegmentedButtonDensityPadding({\n    density\n  });\n  const rippleStyle = Object.assign({\n    borderRadius\n  }, segmentBorderRadius);\n  const labelTextStyle = Object.assign({}, !isV3 ? {\n    textTransform: 'uppercase',\n    fontWeight: '500'\n  } : theme.fonts.labelLarge, {\n    color: textColor\n  });\n  return React.createElement(View, {\n    style: [buttonStyle, styles.button, style]\n  }, React.createElement(TouchableRipple, {\n    borderless: true,\n    onPress: onPress,\n    accessibilityLabel: accessibilityLabel,\n    accessibilityState: {\n      disabled,\n      checked\n    },\n    accessibilityRole: \"button\",\n    disabled: disabled,\n    rippleColor: rippleColor,\n    testID: testID,\n    style: rippleStyle,\n    background: background,\n    theme: theme,\n    hitSlop: hitSlop\n  }, React.createElement(View, {\n    style: [styles.content, {\n      paddingVertical\n    }]\n  }, showCheckedIcon ? React.createElement(Animated.View, {\n    testID: `${testID}-check-icon`,\n    style: [iconStyle, {\n      transform: [{\n        scale: checkScale\n      }]\n    }]\n  }, React.createElement(Icon, {\n    source: 'check',\n    size: iconSize,\n    color: textColor\n  })) : null, showIcon ? React.createElement(Animated.View, {\n    testID: `${testID}-icon`,\n    style: iconStyle\n  }, React.createElement(Icon, {\n    source: icon,\n    size: iconSize,\n    color: textColor\n  })) : null, React.createElement(Text, {\n    variant: \"labelLarge\",\n    style: [styles.label, labelTextStyle, labelStyle],\n    selectable: false,\n    numberOfLines: 1,\n    maxFontSizeMultiplier: labelMaxFontSizeMultiplier,\n    testID: `${testID}-label`\n  }, label))));\n};\nconst styles = StyleSheet.create({\n  button: {\n    flex: 1,\n    minWidth: 76,\n    borderStyle: 'solid'\n  },\n  label: {\n    textAlign: 'center'\n  },\n  content: {\n    flexDirection: 'row',\n    alignItems: 'center',\n    justifyContent: 'center',\n    paddingVertical: 9,\n    paddingHorizontal: 16\n  }\n});\nexport default SegmentedButtonItem;\nexport { SegmentedButtonItem as SegmentedButton };","map":{"version":3,"names":["React","Animated","StyleSheet","View","color","getSegmentedButtonBorderRadius","getSegmentedButtonColors","getSegmentedButtonDensityPadding","useInternalTheme","Icon","TouchableRipple","Text","SegmentedButtonItem","checked","accessibilityLabel","disabled","style","labelStyle","showSelectedCheck","checkedColor","uncheckedColor","rippleColor","customRippleColor","background","icon","testID","label","onPress","segment","density","theme","themeOverrides","labelMaxFontSizeMultiplier","hitSlop","checkScale","useRef","Value","current","useEffect","spring","toValue","useNativeDriver","start","roundness","isV3","borderColor","textColor","borderWidth","backgroundColor","borderRadius","segmentBorderRadius","alpha","rgb","string","showIcon","showCheckedIcon","iconSize","iconStyle","Object","assign","marginRight","transform","scale","interpolate","inputRange","outputRange","buttonStyle","paddingVertical","rippleStyle","labelTextStyle","textTransform","fontWeight","fonts","labelLarge","createElement","styles","button","borderless","accessibilityState","accessibilityRole","content","source","size","variant","selectable","numberOfLines","maxFontSizeMultiplier","create","flex","minWidth","borderStyle","textAlign","flexDirection","alignItems","justifyContent","paddingHorizontal","SegmentedButton"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/SegmentedButtons/SegmentedButtonItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n  Animated,\n  ColorValue,\n  GestureResponderEvent,\n  PressableAndroidRippleConfig,\n  StyleProp,\n  StyleSheet,\n  TextStyle,\n  View,\n  ViewStyle,\n} from 'react-native';\n\nimport color from 'color';\nimport type { ThemeProp } from 'src/types';\n\nimport {\n  getSegmentedButtonBorderRadius,\n  getSegmentedButtonColors,\n  getSegmentedButtonDensityPadding,\n} from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { IconSource } from '../Icon';\nimport Icon from '../Icon';\nimport TouchableRipple, {\n  Props as TouchableRippleProps,\n} from '../TouchableRipple/TouchableRipple';\nimport Text from '../Typography/Text';\n\nexport type Props = {\n  /**\n   * Whether the segmented button is checked\n   */\n  checked: boolean;\n  /**\n   * Icon to display for the `SegmentedButtonItem`.\n   */\n  icon?: IconSource;\n  /**\n   * @supported Available in v5.x with theme version 3\n   * Custom color for unchecked Text and Icon.\n   */\n  uncheckedColor?: string;\n  /**\n   * @supported Available in v5.x with theme version 3\n   * Custom color for checked Text and Icon.\n   */\n  checkedColor?: string;\n  /**\n   * Color of the ripple effect.\n   */\n  rippleColor?: ColorValue;\n  /**\n   * Whether the button is disabled.\n   */\n  disabled?: boolean;\n  /**\n   * Type of background drawabale to display the feedback (Android).\n   * https://reactnative.dev/docs/pressable#rippleconfig\n   */\n  background?: PressableAndroidRippleConfig;\n  /**\n   * Accessibility label for the `SegmentedButtonItem`. This is read by the screen reader when the user taps the button.\n   */\n  accessibilityLabel?: string;\n  /**\n   * Function to execute on press.\n   */\n  onPress?: (event: GestureResponderEvent) => void;\n  /**\n   * Value of button.\n   */\n  value: string;\n  /**\n   * Label text of the button.\n   */\n  label?: string;\n  /**\n   * Button segment.\n   */\n  segment?: 'first' | 'last';\n  /**\n   * Show optional check icon to indicate selected state\n   */\n  showSelectedCheck?: boolean;\n  /**\n   * Density is applied to the height, to allow usage in denser UIs.\n   */\n  density?: 'regular' | 'small' | 'medium' | 'high';\n  /**\n   * Specifies the largest possible scale a label font can reach.\n   */\n  labelMaxFontSizeMultiplier?: number;\n  style?: StyleProp<ViewStyle>;\n  /**\n   * Style for the button label.\n   */\n  labelStyle?: StyleProp<TextStyle>;\n  /**\n   * testID to be used on tests.\n   */\n  testID?: string;\n  /**\n   * Sets additional distance outside of element in which a press can be detected.\n   */\n  hitSlop?: TouchableRippleProps['hitSlop'];\n  /**\n   * @optional\n   */\n  theme?: ThemeProp;\n};\n\nconst SegmentedButtonItem = ({\n  checked,\n  accessibilityLabel,\n  disabled,\n  style,\n  labelStyle,\n  showSelectedCheck,\n  checkedColor,\n  uncheckedColor,\n  rippleColor: customRippleColor,\n  background,\n  icon,\n  testID,\n  label,\n  onPress,\n  segment,\n  density = 'regular',\n  theme: themeOverrides,\n  labelMaxFontSizeMultiplier,\n  hitSlop,\n}: Props) => {\n  const theme = useInternalTheme(themeOverrides);\n\n  const checkScale = React.useRef(new Animated.Value(0)).current;\n\n  React.useEffect(() => {\n    if (!showSelectedCheck) {\n      return;\n    }\n    if (checked) {\n      Animated.spring(checkScale, {\n        toValue: 1,\n        useNativeDriver: true,\n      }).start();\n    } else {\n      Animated.spring(checkScale, {\n        toValue: 0,\n        useNativeDriver: true,\n      }).start();\n    }\n  }, [checked, checkScale, showSelectedCheck]);\n\n  const { roundness, isV3 } = theme;\n  const { borderColor, textColor, borderWidth, backgroundColor } =\n    getSegmentedButtonColors({\n      checked,\n      theme,\n      disabled,\n      checkedColor,\n      uncheckedColor,\n    });\n\n  const borderRadius = (isV3 ? 5 : 1) * roundness;\n  const segmentBorderRadius = getSegmentedButtonBorderRadius({\n    theme,\n    segment,\n  });\n  const rippleColor =\n    customRippleColor || color(textColor).alpha(0.12).rgb().string();\n\n  const showIcon = !icon ? false : label && checked ? !showSelectedCheck : true;\n  const showCheckedIcon = checked && showSelectedCheck;\n\n  const iconSize = isV3 ? 18 : 16;\n  const iconStyle = {\n    marginRight: label ? 5 : showCheckedIcon ? 3 : 0,\n    ...(label && {\n      transform: [\n        {\n          scale: checkScale.interpolate({\n            inputRange: [0, 1],\n            outputRange: [1, 0],\n          }),\n        },\n      ],\n    }),\n  };\n\n  const buttonStyle: ViewStyle = {\n    backgroundColor,\n    borderColor,\n    borderWidth,\n    borderRadius,\n    ...segmentBorderRadius,\n  };\n  const paddingVertical = getSegmentedButtonDensityPadding({ density });\n  const rippleStyle: ViewStyle = {\n    borderRadius,\n    ...segmentBorderRadius,\n  };\n  const labelTextStyle: TextStyle = {\n    ...(!isV3\n      ? {\n          textTransform: 'uppercase',\n          fontWeight: '500',\n        }\n      : theme.fonts.labelLarge),\n    color: textColor,\n  };\n\n  return (\n    <View style={[buttonStyle, styles.button, style]}>\n      <TouchableRipple\n        borderless\n        onPress={onPress}\n        accessibilityLabel={accessibilityLabel}\n        accessibilityState={{ disabled, checked }}\n        accessibilityRole=\"button\"\n        disabled={disabled}\n        rippleColor={rippleColor}\n        testID={testID}\n        style={rippleStyle}\n        background={background}\n        theme={theme}\n        hitSlop={hitSlop}\n      >\n        <View style={[styles.content, { paddingVertical }]}>\n          {showCheckedIcon ? (\n            <Animated.View\n              testID={`${testID}-check-icon`}\n              style={[iconStyle, { transform: [{ scale: checkScale }] }]}\n            >\n              <Icon source={'check'} size={iconSize} color={textColor} />\n            </Animated.View>\n          ) : null}\n          {showIcon ? (\n            <Animated.View testID={`${testID}-icon`} style={iconStyle}>\n              <Icon source={icon} size={iconSize} color={textColor} />\n            </Animated.View>\n          ) : null}\n          <Text\n            variant=\"labelLarge\"\n            style={[styles.label, labelTextStyle, labelStyle]}\n            selectable={false}\n            numberOfLines={1}\n            maxFontSizeMultiplier={labelMaxFontSizeMultiplier}\n            testID={`${testID}-label`}\n          >\n            {label}\n          </Text>\n        </View>\n      </TouchableRipple>\n    </View>\n  );\n};\n\nconst styles = StyleSheet.create({\n  button: {\n    flex: 1,\n    minWidth: 76,\n    borderStyle: 'solid',\n  },\n  label: {\n    textAlign: 'center',\n  },\n  content: {\n    flexDirection: 'row',\n    alignItems: 'center',\n    justifyContent: 'center',\n    paddingVertical: 9,\n    paddingHorizontal: 16,\n  },\n});\n\nexport default SegmentedButtonItem;\n\nexport { SegmentedButtonItem as SegmentedButton };\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,QAAA;AAAA,OAAAC,UAAA;AAAA,OAAAC,IAAA;AAa9B,OAAOC,KAAK,MAAM,OAAO;AAGzB,SACEC,8BAA8B,EAC9BC,wBAAwB,EACxBC,gCAAgC;AAElC,SAASC,gBAAgB;AAEzB,OAAOC,IAAI;AACX,OAAOC,eAAe;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