flipper-plugin
Version:
Flipper Desktop plugin SDK and components
40 lines • 1.59 kB
JavaScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PowerSearchStringSetTerm = void 0;
const antd_1 = require("antd");
const react_1 = __importDefault(require("react"));
const PowerSearchStringSetTerm = ({ onCancel, onChange, defaultValue }) => {
const selectValueRef = react_1.default.useRef();
if (defaultValue && !selectValueRef.current) {
selectValueRef.current = defaultValue;
}
return (react_1.default.createElement(antd_1.Select, { mode: "tags", autoFocus: !defaultValue, style: { minWidth: 100 }, placeholder: "...", defaultValue: defaultValue, onBlur: () => {
if (!selectValueRef.current?.length) {
onCancel();
}
}, open: false, onChange: (value) => {
if (!value.length) {
onCancel();
return;
}
selectValueRef.current = value;
onChange(value);
}, onClear: onCancel, onKeyDown: (event) => {
if (event.key === 'Enter' || event.key === 'Escape') {
event.currentTarget.blur();
}
} }));
};
exports.PowerSearchStringSetTerm = PowerSearchStringSetTerm;
//# sourceMappingURL=PowerSearchStringSetTerm.js.map
;