"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _vectorIcons = require("@expo/vector-icons");
var _jsxRuntime = require("react/jsx-runtime");
const GroupedItem = ({
  icon,
  iconColor = '#007AFF',
  image,
  imageSize = 20,
  title,
  subtitle,
  theme,
  onPress,
  isFirst = false,
  isLast = false,
  showChevron = true,
  disabled = false,
  selected = false,
  customContent,
  customIcon,
  multiRow = false,
  customContentBelow,
  dense = false
}) => {
  const isDarkTheme = theme === 'dark';
  const textColor = isDarkTheme ? '#FFFFFF' : '#000000';
  const secondaryBackgroundColor = isDarkTheme ? '#222222' : '#FFFFFF';
  const selectedBackgroundColor = selected ? `${iconColor}15` : secondaryBackgroundColor;
  const itemStyles = [styles.groupedItem, isFirst && styles.firstGroupedItem, isLast && styles.lastGroupedItem, {
    backgroundColor: selected ? selectedBackgroundColor : secondaryBackgroundColor
  }];
  const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
    style: [styles.groupedItemContent, multiRow && styles.groupedItemContentMultiRow, dense && styles.groupedItemContentDense],
    children: [customIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
      style: styles.actionIcon,
      children: customIcon
    }) : image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
      source: {
        uri: image
      },
      style: [styles.actionImage, {
        width: imageSize,
        height: imageSize
      }]
    }) : icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
      style: [styles.iconContainer, {
        backgroundColor: `${iconColor}20`
      }],
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Ionicons, {
        name: icon,
        size: 20,
        color: iconColor
      })
    }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
      style: [styles.actionTextContainer, multiRow && styles.actionTextContainerMultiRow],
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
        style: [styles.actionButtonText, {
          color: textColor
        }],
        children: title
      }), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
        style: [styles.actionButtonSubtext, {
          color: isDarkTheme ? '#BBBBBB' : '#666666'
        }],
        children: subtitle
      }), customContentBelow]
    }), customContent, selected ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Ionicons, {
      name: "checkmark-circle",
      size: 20,
      color: iconColor || '#007AFF'
    }) : showChevron ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Ionicons, {
      name: "chevron-forward",
      size: 16,
      color: isDarkTheme ? '#666666' : '#999999'
    }) : null]
  });
  if (onPress && !disabled) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
      style: itemStyles,
      onPress: onPress,
      children: content
    });
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: itemStyles,
    children: content
  });
};
const styles = _reactNative.StyleSheet.create({
  groupedItem: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginBottom: 2,
    overflow: 'hidden',
    width: '100%'
  },
  firstGroupedItem: {
    borderTopLeftRadius: 24,
    borderTopRightRadius: 24
  },
  lastGroupedItem: {
    borderBottomLeftRadius: 24,
    borderBottomRightRadius: 24,
    marginBottom: 8
  },
  groupedItemContent: {
    flexDirection: 'row',
    alignItems: 'center',
    paddingVertical: 12,
    paddingHorizontal: 12,
    width: '100%'
  },
  groupedItemContentDense: {
    paddingVertical: 10,
    paddingHorizontal: 12
  },
  actionIcon: {
    marginRight: 12
  },
  iconContainer: {
    width: 38,
    height: 38,
    borderRadius: 19,
    alignItems: 'center',
    justifyContent: 'center',
    marginRight: 12
  },
  actionImage: {
    marginRight: 12,
    borderRadius: 16
  },
  actionTextContainer: {
    flex: 1
  },
  actionButtonText: {
    fontSize: 16,
    fontWeight: '500',
    marginBottom: 2
  },
  actionButtonSubtext: {
    fontSize: 13,
    lineHeight: 18
  },
  groupedItemContentMultiRow: {
    alignItems: 'flex-start',
    paddingVertical: 12
  },
  actionTextContainerMultiRow: {
    alignItems: 'flex-start'
  }
});
var _default = exports.default = GroupedItem;
//# sourceMappingURL=GroupedItem.js.map