@payfit/unity-components
Version:
31 lines (30 loc) • 1.16 kB
JavaScript
import { SelectList as e } from "../../../../../core/components/select-list/SelectList.js";
import { AIStructuredInputAnswersProvider as t } from "./AIStructuredInputAnswers.context.js";
import { forwardRef as n, useState as r } from "react";
import { uyMerge as i } from "@payfit/unity-themes";
import { jsx as a } from "react/jsx-runtime";
//#region src/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.tsx
function o({ items: n, children: o, value: s, onChange: c, selectionMode: l = "multiple", showSearch: u = !1, indicatorPosition: d = "end", wrapperClassName: f, ...p }, m) {
let [h, g] = r(!1), _ = !(s === "all" || Array.from(s).length > 0) && !h ? n[0]?.id : void 0, v = (e) => {
g(!0), c(e);
};
return /* @__PURE__ */ a(t, {
value: { hintedAnswerId: _ },
children: /* @__PURE__ */ a(e, {
...p,
ref: m,
items: n,
value: s,
onChange: v,
selectionMode: l,
showSearch: u,
indicatorPosition: d,
wrapperClassName: i("uy:bg-transparent uy:p-0", f),
children: o
})
});
}
var s = n(o);
s.displayName = "AIStructuredInputAnswers";
//#endregion
export { s as AIStructuredInputAnswers };