function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { withTheme } from '../../core/theming';
import TouchableRipple from '../TouchableRipple/TouchableRipple.native';
import TableCell from './TableCell';
import Checkbox from '../Checkbox/Checkbox';
const TableRow = _ref => {
  let {
    children,
    style,
    mode = 'filled',
    theme,
    onPress,
    onSelect,
    ...rest
  } = _ref;
  const rowStyle = mode === 'filled' ? styles.rowFilled : styles.rowOutline;
  const [selected, setSelected] = React.useState(false);
  return /*#__PURE__*/React.createElement(TouchableRipple, _extends({}, rest, {
    onPress: typeof onSelect === 'function' ? () => {
      if (onSelect) {
        onSelect(!selected);
        setSelected(!selected);
      }
      typeof onPress === 'function' && onPress();
    } : null,
    style: [styles.row, rowStyle, style]
  }), /*#__PURE__*/React.createElement(React.Fragment, null, onSelect && /*#__PURE__*/React.createElement(TableCell, null, /*#__PURE__*/React.createElement(Checkbox, {
    status: selected ? 'checked' : 'unchecked'
  })), children));
};
TableRow.displayName = 'Table.Row';
const styles = StyleSheet.create({
  row: {
    flexDirection: 'row',
    height: 64,
    padding: 8,
    borderRadius: 16,
    marginBottom: 8,
    paddingRight: 0 // doing this so we can have marginRight on the last cell and it'll appear like theres spacing only between the cells
  },

  rowFilled: {
    backgroundColor: 'white'
  },
  rowOutline: {
    backgroundColor: 'transparent',
    borderWidth: StyleSheet.hairlineWidth * 2
  }
});
export default withTheme(TableRow);

// @component-docs ignore-next-line
export { TableRow };
//# sourceMappingURL=TableRow.js.map