UNPKG

mongodb-chatbot-ui

Version:

UI React components for the MongoDB Chatbot Framework

193 lines (192 loc) 7.17 kB
import i, { forwardRef as M } from "react"; import { u as ae, c as ie } from "./index5.js"; import { P as oe, h as le, w as ce, D as de, f as se } from "./index14.js"; import { B as ue } from "./index6.js"; import { m as l, Q as m, F as p, v as j, d as Y, U as fe, n as E, i as Z, $ as pe } from "./index2.js"; import { l as me } from "./X.js"; import { H as be } from "./index8.js"; import { t as ge } from "./index4.js"; function N(e, n, r) { return (n = function(t) { var o = function(a, c) { if (typeof a != "object" || !a) return a; var d = a[Symbol.toPrimitive]; if (d !== void 0) { var s = d.call(a, c); if (typeof s != "object") return s; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(a); }(t, "string"); return typeof o == "symbol" ? o : o + ""; }(n)) in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e; } function $() { return $ = Object.assign ? Object.assign.bind() : function(e) { for (var n = 1; n < arguments.length; n++) { var r = arguments[n]; for (var t in r) ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]); } return e; }, $.apply(null, arguments); } function h(e, n) { return n || (n = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(n) } })); } var F, L, W, _, q, ve = l(F || (F = h([` width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px `, `px; border-bottom: 1px solid; `])), m[4]), ye = N(N({}, j.Dark, l(L || (L = h([` background-color: `, `; border-color: `, `; `])), p.black, p.gray.dark2)), j.Light, l(W || (W = h([` background-color: `, `; border-color: `, `; `])), p.white, p.gray.light2)), he = l(_ || (_ = h([` display: flex; align-items: center; justify-content: center; gap: `, `px; `])), m[2]), xe = l(q || (q = h([` margin: auto; `]))), we = ["title", "className", "align", "onClose", "badgeText", "darkMode", "iconSlot"], ee = M(function(e, n) { var r = e.title, t = e.className, o = e.align, a = o === void 0 ? H.Center : o, c = e.onClose, d = e.badgeText, s = e.darkMode, f = e.iconSlot, P = function(v, z) { if (v == null) return {}; var y, x, B = function(w, te) { if (w == null) return {}; var I = {}; for (var O in w) if ({}.hasOwnProperty.call(w, O)) { if (te.indexOf(O) !== -1) continue; I[O] = w[O]; } return I; }(v, z); if (Object.getOwnPropertySymbols) { var D = Object.getOwnPropertySymbols(v); for (x = 0; x < D.length; x++) y = D[x], z.indexOf(y) === -1 && {}.propertyIsEnumerable.call(v, y) && (B[y] = v[y]); } return B; }(e, we), b = Y(s), C = b.darkMode, g = b.theme; return i.createElement(fe, { darkMode: C }, i.createElement("div", $({ className: E(ve, ye[g], t) }, P, { ref: n }), i.createElement("div", { className: E(he, N({}, xe, a === H.Center)) }, i.createElement(oe, { variant: le.Mongo, sizeOverride: 24 }), i.createElement(ge, null, i.createElement("strong", null, r)), d && i.createElement(ue, { variant: "blue" }, d)), !!c && i.createElement(be, { "aria-label": "Close chat", onClick: c }, f || i.createElement(me, null)))); }); ee.displayName = "TitleBar"; var H = { Center: "center", Left: "left" }; function T(e, n, r) { return (n = function(t) { var o = function(a, c) { if (typeof a != "object" || !a) return a; var d = a[Symbol.toPrimitive]; if (d !== void 0) { var s = d.call(a, c); if (typeof s != "object") return s; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(a); }(t, "string"); return typeof o == "symbol" ? o : o + ""; }(n)) in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e; } function k() { return k = Object.assign ? Object.assign.bind() : function(e) { for (var n = 1; n < arguments.length; n++) { var r = arguments[n]; for (var t in r) ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]); } return e; }, k.apply(null, arguments); } function ne(e, n) { if (e == null) return {}; var r, t, o = function(c, d) { if (c == null) return {}; var s = {}; for (var f in c) if ({}.hasOwnProperty.call(c, f)) { if (d.indexOf(f) !== -1) continue; s[f] = c[f]; } return s; }(e, n); if (Object.getOwnPropertySymbols) { var a = Object.getOwnPropertySymbols(e); for (t = 0; t < a.length; t++) r = a[t], n.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]); } return o; } function u(e, n) { return n || (n = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(n) } })); } var Q, R, U, A, G, J, K, V, X, Oe = l(Q || (Q = u([` width: 100%; border: 1px solid; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; position: relative; `]))), je = T(T({}, j.Dark, l(R || (R = u([` border-color: `, `; box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.05); background-color: `, `; `])), p.gray.dark2, p.black)), j.Light, l(U || (U = u([` border-color: `, `; box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.05); background: `, `; `])), p.gray.light2, p.gray.light3)), Ee = l(A || (A = u([` display: flex; flex-direction: column; align-items: center; `]))), ke = l(G || (G = u([` width: 100%; padding: `, `px; padding-top: `, `px; display: flex; justify-content: center; `])), m[5], m[3]), Pe = l(J || (J = u([` padding-top: `, `px; `])), m[2]), Ce = l(K || (K = u([` width: 100%; max-width: `, `px; `])), Z.Tablet), S = ce[de.Default] + m[3]; l(V || (V = u([` padding: 0px `, `px; `])), S), l(X || (X = u([` // InputBar has padding of: avatarPadding + MessageFeed padding to align with MessageContainer padding-left: `, `px; padding-right: `, `px; `])), S + m[5], S + m[5]); var Se = ["children", "className", "darkMode", "title", "badgeText", "onClose", "iconSlot"], re = M(function(e, n) { var r = e.children, t = e.className, o = e.darkMode, a = e.title, c = e.badgeText, d = e.onClose, s = e.iconSlot, f = ne(e, Se), P = Y(o).theme, b = ae().containerWidth, C = se(r).map(function(g) { return pe(g, "InputBar") ? i.createElement("div", { className: E(ke, T({}, Pe, !!b && b < Z.Tablet)), key: "input-bar-container" }, i.createElement("div", { className: Ce }, g)) : g; }); return i.createElement("div", k({ className: E(Oe, je[P], t), ref: n }, f), i.createElement(ee, { title: a, badgeText: c, onClose: d, iconSlot: s }), i.createElement("div", { className: Ee }, C)); }); re.displayName = "ChatWindowContents"; var Ne = ["children"], $e = M(function(e, n) { var r = e.children, t = ne(e, Ne); return i.createElement(ie, null, i.createElement(re, k({}, t, { ref: n }), r)); }); $e.displayName = "ChatWindow"; export { $e as q };