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AAM,CAAC,OAAO,IACjB,IAAI,CAAC,KAAK,CAAC,YAAY,EAC3B,CACG;oBAEP,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,gBAAM,CAAC,sBAAsB,CAAC;wBAC1C,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,gBAAM,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CACpB;wBACN,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAClC,8BAAC,+BAAgB,IAAC,OAAO,EAAE,IAAI,CAAC,QAAQ;4BACtC,8BAAC,mBAAI,IACH,MAAM,EAAC,YAAY,EACnB,KAAK,EAAE;oCACL,gBAAM,CAAC,WAAW;oCAClB,EAAE,KAAK,EAAE,eAAM,CAAC,YAAY,EAAE;oCAC9B,IAAI,CAAC,KAAK,CAAC,eAAe;iCAC3B,IAEA,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,QAAQ,CAC7B,CACU,CACpB,CAAC,CAAC,CAAC,IAAI,CACH,CACF,CACD,CACH,CACR,CAAC;IACJ,CAAC;CACF;AAlED,gDAkEC;AAED,kBAAe,kBAAkB,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport {\n  View,\n  Text,\n  TouchableOpacity,\n  StyleProp,\n  ViewStyle,\n} from 'react-native';\nimport { Colors } from '../../styles';\nimport Modal from 'react-native-modal';\nimport {\n  CrossSpinnerType,\n  CrossSpinner,\n  ICrossSpinnerProps,\n} from '../animations/CrossSpinner';\nimport styles from '../../styles';\n\n/**\n * Describes the props for {@link CrossBusyIndicator}\n *\n * @export\n * @interface IBusyIndicatorProps\n */\nexport interface IBusyIndicatorProps {\n  /**\n   * Determines if the indicator is visible\n   *\n   * @type {boolean}\n   * @memberof IBusyIndicatorProps\n   */\n  isBusy: boolean;\n  /**\n   * Optional message to show while busy. Defaults to empty string.\n   *\n   * @type {string}\n   * @memberof IBusyIndicatorProps\n   */\n  message?: string | undefined;\n  /**\n   * Type of spinner to use\n   *\n   * @type {CrossSpinnerType}\n   * @memberof IBusyIndicatorProps\n   */\n  type?: CrossSpinnerType | undefined;\n  /**\n   * Optional test id to assign this component. Default is \"1\"\n   *\n   * @type {string}\n   * @memberof IBusyIndicatorProps\n   */\n  testID?: string | undefined;\n  /**\n   * Determines if the modal is cancellable. Otherwise visibility is controlled by {@link isBusy}\n   */\n  isCancelButtonVisible: boolean;\n  /**\n   * Optional callback for user cancel event.\n   */\n  onCancel?: () => void;\n  /**\n   * Text for cancel button. Default is \"Cancel\"\n   */\n  cancelText?: string | undefined;\n  /**\n   * Optional custom style for the {@link cancelText}\n   */\n  cancelTextStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional custom style for the modal view\n   */\n  modalStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional custom style for the inner view, contained in the modal\n   */\n  innerViewStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional custom style for the {@link message}\n   */\n  messageStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional properties to configure the spinner\n   *\n   * See {@link ICrossSpinnerProps}\n   */\n  spinnerProps?: ICrossSpinnerProps | undefined;\n}\n\n/**\n * @description\n * Displays a modal with busy indicator (spinner) and message when {@link IBusyIndicatorProps.isBusy} is `true`\n * \n * Properties are {@link IBusyIndicatorProps}\n * \n * Also supports cancelling the modal using properties\n * {@link IBusyIndicatorProps.isCancelButtonVisible}, \n * {@link IBusyIndicatorProps.cancelText} and\n * {@link IBusyIndicatorProps.onCancel}.\n * This does however not hide the modal.\n * \n * Modal with cancel\n * @example\n * \n ```\n    <CrossBusyIndicator\n      isBusy={isBusy}\n      type={CrossSpinnerType.PacmanIndicator}\n      isCancelButtonVisible={true}\n      message=\"Loading..\"\n      onCancel={() => (isBusy = false)}\n    />\n```\n */\nexport class CrossBusyIndicator extends React.Component<IBusyIndicatorProps> {\n  /**\n   *\n   */\n  constructor(props: IBusyIndicatorProps) {\n    super(props);\n    this.onCancel = this.onCancel.bind(this);\n  }\n\n  onCancel() {\n    if (!this.props.isCancelButtonVisible) {\n      return;\n    }\n\n    if (this.props.onCancel) {\n      this.props.onCancel();\n    }\n  }\n\n  render() {\n    return (\n      <View testID={this.props.testID || '1'}>\n        <Modal\n          style={[styles.absoluteCentered, this.props.modalStyle]}\n          isVisible={this.props.isBusy}\n          onDismiss={this.onCancel}\n        >\n          <View\n            style={[\n              styles.container,\n              styles.paddingDefault,\n              this.props.innerViewStyle,\n            ]}\n          >\n            <View style={[styles.columnContentTopCenter]}>\n              <CrossSpinner\n                type={this.props.type || CrossSpinnerType.MaterialIndicator}\n                style={styles.spinner}\n                {...this.props.spinnerProps}\n              />\n            </View>\n\n            <View style={[styles.columnContentTopCenter]}>\n              <Text style={[styles.textSpinner, this.props.messageStyle]}>\n                {this.props.message || ''}\n              </Text>\n              {this.props.isCancelButtonVisible ? (\n                <TouchableOpacity onPress={this.onCancel}>\n                  <Text\n                    testID=\"cancelText\"\n                    style={[\n                      styles.textSpinner,\n                      { color: Colors.CancelButton },\n                      this.props.cancelTextStyle,\n                    ]}\n                  >\n                    {this.props.cancelText || 'Cancel'}\n                  </Text>\n                </TouchableOpacity>\n              ) : null}\n            </View>\n          </View>\n        </Modal>\n      </View>\n    );\n  }\n}\n\nexport default CrossBusyIndicator;\n"],"version":3}