var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import React, { useState } from "react";
import styled, { withTheme } from "styled-components";
import { func, arrayOf, string, shape, oneOfType, number } from "prop-types";
import { Picker } from "@react-native-picker/picker";
import Button from "../../Button";
const PickerStyled = styled(Picker)`
  width: 100%;
  height: 190px;
`;
const PickerActions = styled.View`
  ${({
  theme: {
    yoga: {
      components: { dropdown }
    }
  }
}) => `
    flex-direction: row;
    justify-content: space-between;

    padding:
      ${dropdown.backdrop.content.actions.padding.top}px
      ${dropdown.backdrop.content.actions.padding.right}px
      ${dropdown.backdrop.content.actions.padding.bottom}px
      ${dropdown.backdrop.content.actions.padding.left}px;
  `}
`;
const Options = ({
  options,
  selectedOption = null,
  cancelActionLabel,
  confirmActionLabel,
  onSelect = () => {
  },
  onClose = () => {
  },
  theme: {
    yoga: { baseFont }
  }
}) => {
  const [selected, setSelected] = useState(selectedOption);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      PickerStyled,
      {
        selectedValue: selected && selected.value,
        onValueChange: (itemValue) => setSelected(options.find((option) => option.value === itemValue)),
        itemStyle: {
          fontFamily: baseFont.family
        },
        children: options.map((item) => /* @__PURE__ */ jsx(Picker.Item, __spreadValues({}, item), item))
      }
    ),
    /* @__PURE__ */ jsxs(PickerActions, { children: [
      /* @__PURE__ */ jsx(Button.Link, { onPress: onClose, children: cancelActionLabel }),
      /* @__PURE__ */ jsx(Button.Link, { onPress: () => onSelect(selected), children: confirmActionLabel })
    ] })
  ] });
};
const optionShape = {
  label: string,
  value: oneOfType([string, number])
};
Options.propTypes = {
  options: arrayOf(shape(optionShape)).isRequired,
  selectedOption: shape(optionShape),
  cancelActionLabel: string.isRequired,
  confirmActionLabel: string.isRequired,
  onSelect: func,
  onClose: func
};
var Options_ios_default = withTheme(Options);
export {
  Options_ios_default as default
};
