UNPKG

react-instantsearch

Version:
41 lines (39 loc) • 1.63 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "createComparisonTableTool", { enumerable: true, get: function() { return createComparisonTableTool; } }); var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); var _instantsearchuicomponents = require("instantsearch-ui-components"); var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react")); /** * Grounded comparison-table tool (prototype). * * Renders a v2 `markdownTable` display block whose every cell is hydrated from * the real `algolia_search_index` hits by objectID — the agent supplies only the * objectIDs and the attribute keys, never the values. See * `instantsearch-ui-components` `ComparisonTableTool` for the contract. * * Register under the display-results tool key (or a dedicated key) in * `createDefaultTools` to have comparison answers rendered as a grounded table * instead of the model-authored markdown table. */ function createComparisonTableTool(translations) { var ComparisonTableUIComponent = (0, _instantsearchuicomponents.createComparisonTableToolComponent)({ createElement: _react.createElement, Fragment: _react.Fragment }); var ComparisonTableLayoutComponent = function ComparisonTableLayoutComponent(toolProps) { return /*#__PURE__*/ _react.default.createElement(ComparisonTableUIComponent, { toolProps: toolProps, translations: translations }); }; return { layoutComponent: ComparisonTableLayoutComponent }; }