{"version":3,"sources":["middlewares/HTMLSelectMw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,4BAA4B,CAyB1E,CAAC;AAEF,eAAe,YAAY,CAAC","file":"HTMLSelectMw.d.ts","sourcesContent":["import * as React from 'react';\nimport get from 'lodash/get';\nimport { BlueprintFormMiddlewareProps } from '../share';\n\nexport const HTMLSelectMw: React.ComponentType<BlueprintFormMiddlewareProps> = (props) => {\n  const { schema, data, onChange, next, extraProps } = props;\n  if (\n    typeof schema === 'boolean' ||\n    !schema.enum ||\n    !(schema.type === 'string' || schema.type === 'number' || schema.type === 'integer') ||\n    schema.enum.find((option) => !['string', 'number'].includes(typeof option))\n  )\n    return next(props);\n\n  const labels = get(extraProps, 'labels', schema.enum);\n  const placeholder = get(extraProps, 'props.placeholder');\n  const value = typeof data === 'string' || typeof data === 'number' ? data : undefined;\n  return (\n    <div className=\"bp3-select bp3-fill\">\n      <select onChange={(e) => onChange(e.target.value)} value={value}>\n        <option value={undefined}>{placeholder}</option>\n        {schema.enum.map((option, index) => (\n          <option key={option as string | number} value={option as string | number}>\n            {get(labels, index, null)}\n          </option>\n        ))}\n      </select>\n    </div>\n  );\n};\n\nexport default HTMLSelectMw;\n"]}