@shko.online/lookupobjects-mock
Version:
Mocking Dataverse Lookup Objects to simplify writing soties for PCF components
45 lines • 1.71 kB
JavaScript
import React, { useCallback } from 'react';
function SearchLookup(_ref) {
let {
searchRecords,
inputRef,
lookForRecords,
onSearchClick
} = _ref;
const onKeyPress = useCallback(e => {
if (e.charCode === 13) {
const search = e.target.value;
searchRecords(search);
}
}, [searchRecords]);
return /*#__PURE__*/React.createElement("div", {
className: "so.flex so.w-full so.p-1 so.pl-2 so.border-b-2 so.border-b-transparent focus-within:so.border-b-blue-700",
role: "presentation"
}, /*#__PURE__*/React.createElement("input", {
"aria-autocomplete": "list",
"aria-label": "Select record, Lookup",
autoComplete: "off",
className: "so.flex-1 so.bg-transparent so.outline-none active:so.border-transparent",
onKeyPress: onKeyPress,
placeholder: lookForRecords,
ref: inputRef,
role: "searchbox",
title: "Select to enter data",
type: "text"
}), /*#__PURE__*/React.createElement("button", {
"aria-label": "Search records for Select record, Lookup field",
className: "so.justify-center so.align-middle so.p-1 so.text-neutral-700 hover:so.text-blue-700",
onClick: onSearchClick,
title: "Search",
type: "button"
}, /*#__PURE__*/React.createElement("svg", {
className: "so.fill-current so.w-4 so.h-4",
height: "14",
viewBox: "0 -0.5 21 21",
width: "14",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/React.createElement("path", {
d: "m5.94 12.929 1.485 1.414L1.485 20 0 18.586zM13.65 12C10.755 12 8.4 9.757 8.4 7s2.355-5 5.25-5 5.25 2.243 5.25 5-2.355 5-5.25 5m0-12C9.59 0 6.3 3.134 6.3 7s3.29 7 7.35 7S21 10.866 21 7s-3.29-7-7.35-7"
}))));
}
export default SearchLookup;