UNPKG

@servicetitan/assist-ui

Version:

ServiceTitan Atlas UI Components

33 lines (32 loc) 1.1 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { ButtonCompound, Card, Flex, Text } from '@servicetitan/anvil2'; export const Suggestion = ({ text, onClick })=>{ return /*#__PURE__*/ _jsx(ButtonCompound, { onClick: ()=>onClick(text), children: /*#__PURE__*/ _jsx(Card, { padding: "small", children: /*#__PURE__*/ _jsx(Text, { variant: "body", size: "small", children: text }) }) }); }; export const SuggestionList = ({ suggestions, onSelect })=>{ if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) === 0) { return null; } return /*#__PURE__*/ _jsx(Flex, { gap: 1, className: "p-inline-4 p-block-start-1", style: { flexWrap: 'wrap' }, children: suggestions.map((suggestion)=>/*#__PURE__*/ _jsx(Suggestion, { text: suggestion, onClick: ()=>onSelect(suggestion) }, suggestion)) }); }; //# sourceMappingURL=suggestion.js.map