{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"isDisabled\", \"label\", \"value\"];\nfunction _extends() {\n  _extends = Object.assign || function (target) {\n    for (var i = 1; i < arguments.length; i++) {\n      var source = arguments[i];\n      for (var key in source) {\n        if (Object.prototype.hasOwnProperty.call(source, key)) {\n          target[key] = source[key];\n        }\n      }\n    }\n    return target;\n  };\n  return _extends.apply(this, arguments);\n}\nimport React, { forwardRef, memo } from 'react';\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport { Actionsheet } from \"../../composites/Actionsheet\";\nimport { SelectContext } from \"./Select\";\nexport var Item = function Item(_ref, ref) {\n  var isDisabled = _ref.isDisabled,\n    label = _ref.label,\n    value = _ref.value,\n    props = _objectWithoutProperties(_ref, _excluded);\n  var _React$useContext = React.useContext(SelectContext),\n    onValueChange = _React$useContext.onValueChange,\n    selectedValue = _React$useContext.selectedValue,\n    _selectedItem = _React$useContext._selectedItem,\n    _item = _React$useContext._item;\n  if (Platform.OS !== 'web') {\n    var isSelected = selectedValue === value;\n    return React.createElement(Actionsheet.Item, _extends({\n      ref: ref,\n      onPress: function onPress() {\n        if (!isDisabled) {\n          onValueChange(value);\n        }\n      },\n      accessibilityState: {\n        selected: isSelected\n      }\n    }, _item, isSelected && _selectedItem, props), label);\n  } else {\n    return React.createElement(\"option\", {\n      ref: ref,\n      value: value,\n      disabled: isDisabled\n    }, label);\n  }\n};\nexport default memo(forwardRef(Item));","map":{"version":3,"sources":["SelectItem.tsx"],"names":["React","forwardRef","memo","Actionsheet","SelectContext","Item","isDisabled","label","value","props","ref","onValueChange","selectedValue","_selectedItem","_item","useContext","Platform","OS","isSelected","selected"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,IAA5B,QAAwC,OAAxC;AAAA,OAAA,QAAA;AAGA,SAASC,WAAT;AACA,SAASC,aAAT;AAEA,OAAO,IAAMC,IAAI,GAAG,SAAPA,IAAI,CAAA,IAAA,EAEfK,GAFkB,EAGf;EAAA,IAFDJ,UAAF,GAAA,IAAA,CAAEA,UAAF;IAAcC,KAAd,GAAA,IAAA,CAAcA,KAAd;IAAqBC,KAArB,GAAA,IAAA,CAAqBA,KAArB;IAA+BC,KAAAA,GAAAA,wBAAAA,CAAAA,IAAAA,EAAAA,SAAAA;EAG/B,IAAA,iBAAA,GAKIT,KAAK,CAACe,UAANf,CAAiBI,aAAjBJ,CALJ;IACEW,aADI,GAAA,iBAAA,CACJA,aADI;IAEJC,aAFI,GAAA,iBAAA,CAEJA,aAFI;IAGJC,aAHI,GAAA,iBAAA,CAGJA,aAHI;IAIJC,KAAAA,GAAAA,iBAAAA,CAAAA,KAAAA;EAGF,IAAIE,QAAQ,CAACC,EAATD,KAAgB,KAApB,EAA2B;IACzB,IAAME,UAAU,GAAGN,aAAa,KAAKJ,KAArC;IAEA,OACE,KAAA,CAAA,aAAA,CAAC,WAAD,CAAa,IAAb,EAAA,QAAA,CAAA;MACE,GAAG,EAAEE,GADP;MAEE,OAAO,EAAE,SAAA,QAAA,EAAM;QACb,IAAI,CAACJ,UAAL,EAAiB;UACfK,aAAa,CAACH,KAAD,CAAbG;QACD;MACF,CANH;MAOE,kBAAkB,EAAE;QAAEQ,QAAQ,EAAED;MAAZ;IAPtB,CAAA,EAQMJ,KARN,EASOI,UAAU,IAAIL,aATrB,EAUMJ,KAVN,CAAA,EAYGF,KAZH,CADF;EAgBD,CAnBD,MAmBO;IACL,OACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;MAAQ,GAAG,EAAEG,GAAb;MAAkB,KAAK,EAAEF,KAAzB;MAAgC,QAAQ,EAAEF;IAA1C,CAAA,EACGC,KADH,CADF;EAKD;AACF,CArCM;AAuCP,eAAeL,IAAI,CAACD,UAAU,CAACI,IAAD,CAAX,CAAnB","sourcesContent":["import React, { forwardRef, memo } from 'react';\nimport type { ISelectItemProps } from './types';\nimport { Platform } from 'react-native';\nimport { Actionsheet } from '../../composites/Actionsheet';\nimport { SelectContext } from './Select';\n\nexport const Item = (\n  { isDisabled, label, value, ...props }: ISelectItemProps,\n  ref?: any\n) => {\n  const {\n    onValueChange,\n    selectedValue,\n    _selectedItem,\n    _item,\n  } = React.useContext(SelectContext);\n\n  if (Platform.OS !== 'web') {\n    const isSelected = selectedValue === value;\n\n    return (\n      <Actionsheet.Item\n        ref={ref}\n        onPress={() => {\n          if (!isDisabled) {\n            onValueChange(value);\n          }\n        }}\n        accessibilityState={{ selected: isSelected }}\n        {..._item}\n        {...(isSelected && _selectedItem)}\n        {...props}\n      >\n        {label}\n      </Actionsheet.Item>\n    );\n  } else {\n    return (\n      <option ref={ref} value={value} disabled={isDisabled}>\n        {label}\n      </option>\n    );\n  }\n};\n\nexport default memo(forwardRef(Item));\n"]},"metadata":{},"sourceType":"module"}