@solibo/solibo-ui 2.2.7 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +16 -14
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +86 -81
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +89 -67
- package/dist/index.d.ts +4 -2
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
package/dist/assets/index15.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._messages_88pw2_1 [data-type=avatar]{margin-bottom:var(--scale-8)}._messages_88pw2_1 [data-component=tooltip]{margin:var(--shape-spacing-sm)}._messages_88pw2_1>ul{background-color:var(--colors-semantic-bg-surface);padding:var(--utils-tokens-unit) 0;overflow-anchor:none;scroll-behavior:auto}._messages_88pw2_1>ul>li{margin-bottom:var(--scale-24)}._fill_88pw2_22{display:grid;flex:1;grid-template-rows:minmax(0,1fr) auto;min-height:0}._fill_88pw2_22>[data-message-list]{margin:0;min-height:0;overflow-y:auto}
|
package/dist/assets/index46.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._figure_8kovu_1{display:inline-block;margin:0;padding:0}._figure_8kovu_1>img{background-color:var(--colors-semantic-interactive-neutral);border-radius:var(--shape-border-radius-radius-md);display:block;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center;width:100%}._figure_8kovu_1 input[type=file]{display:none}._preview_8kovu_20>img{height:auto;max-height:calc(var(--utils-tokens-unit) * 25);max-width:calc(var(--utils-tokens-unit) * 20);min-height:calc(var(--utils-tokens-unit) * 6);min-width:calc(var(--utils-tokens-unit) * 6);-o-object-fit:contain;object-fit:contain;width:auto}._preview_8kovu_20>img+[data-component=controls]{margin-top:var(--shape-spacing-xs)}@media (width <= 480px){._preview_8kovu_20>img{max-height:calc(var(--utils-tokens-unit) * 20);max-width:calc(var(--utils-tokens-unit) * 15)}}._reserved_8kovu_43{max-width:100%;width:var(--shape-image-desktop-max-width)}._reserved_8kovu_43>:first-child:not(figcaption){box-sizing:border-box;height:var(--shape-image-desktop-max-height);max-height:none;max-width:100%;min-height:0;min-width:0;-o-object-fit:contain;object-fit:contain;overflow:hidden;width:100%}._reserved_8kovu_43>:first-child:not(img,figcaption){align-content:center;background-color:var(--colors-semantic-interactive-neutral);border-radius:var(--shape-border-radius-radius-md);display:grid;overflow-wrap:anywhere;padding:var(--shape-spacing-sm);text-align:center}._reserved_8kovu_43>:first-child+[data-component=controls]{margin-top:var(--shape-spacing-xs)}@media (width <= 480px){._reserved_8kovu_43{width:var(--shape-image-mobile-max-width)}._reserved_8kovu_43>:first-child:not(figcaption){height:var(--shape-image-mobile-max-height)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index46.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index46.css');const s=require("react/jsx-runtime"),n=require("classix"),c="_figure_8kovu_1",v="_preview_8kovu_20",d="_reserved_8kovu_43",e={figure:c,preview:v,reserved:d},g=({accessibleLabel:r,children:t,className:o,reserveSpace:u=!1,variant:i="default"})=>s.jsxs("figure",{className:n(e.figure,i==="preview"&&e.preview,i==="preview"&&u&&e.reserved,o),"data-component":"figure",children:[t,r&&s.jsx("figcaption",{"data-content":"screen-reader",children:r})]});exports.Figure=g;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsxs as n, jsx as
|
|
2
|
-
import
|
|
3
|
-
import '../../assets/index46.css';const p = "
|
|
4
|
-
figure:
|
|
5
|
-
preview:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
i
|
|
13
|
-
|
|
1
|
+
import { jsxs as n, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import c from "classix";
|
|
3
|
+
import '../../assets/index46.css';const f = "_figure_8kovu_1", p = "_preview_8kovu_20", u = "_reserved_8kovu_43", e = {
|
|
4
|
+
figure: f,
|
|
5
|
+
preview: p,
|
|
6
|
+
reserved: u
|
|
7
|
+
}, g = ({
|
|
8
|
+
accessibleLabel: r,
|
|
9
|
+
children: o,
|
|
10
|
+
className: s,
|
|
11
|
+
reserveSpace: t = !1,
|
|
12
|
+
variant: i = "default"
|
|
13
|
+
}) => /* @__PURE__ */ n("figure", { className: c(e.figure, i === "preview" && e.preview, i === "preview" && t && e.reserved, s), "data-component": "figure", children: [
|
|
14
|
+
o,
|
|
15
|
+
r && /* @__PURE__ */ v("figcaption", { "data-content": "screen-reader", children: r })
|
|
14
16
|
] });
|
|
15
17
|
export {
|
|
16
|
-
|
|
18
|
+
g as Figure
|
|
17
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index19.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index19.css');const r=require("react/jsx-runtime"),z=require("classix"),i=require("react"),L=require("../button/index.cjs"),te=require("../controls/index.cjs"),ne=require("../dialog/index.cjs"),re=require("../header/index.cjs"),ie="_wrapper_vtkwq_1",se="_toolbar_vtkwq_6",oe="_iframe_vtkwq_12",m={wrapper:ie,toolbar:se,iframe:oe,"fullscreen-iframe":"_fullscreen-iframe_vtkwq_18","print-content":"_print-content_vtkwq_23"},k=120,ce=12e3,ae=8,le=({accessibleLabel:v,autoResize:l=!1,className:S,closeFullscreenLabel:W="Close fullscreen",fullscreenLabel:X="View in fullscreen",hasFullscreenView:J=!0,loading:K="lazy",onLoad:w,printContent:C,referrerPolicy:F="no-referrer",sandbox:O="",srcDoc:f,style:N,...I})=>{const _=i.useRef(null),g=i.useRef(null),h=i.useRef(void 0),p=i.useRef(!0),x=i.useRef(f),y=i.useRef(void 0),[P,Q]=i.useState(k),[M,b]=i.useState(!1),R=i.useCallback(()=>{g.current!==null&&(window.cancelAnimationFrame(g.current),g.current=null)},[]),T=i.useCallback(()=>{if(!(!l||!p.current))try{const e=_.current,n=e==null?void 0:e.contentDocument;if(!e||!(n!=null&&n.body))return;const s=n.querySelector("[data-iframe-content]")??n.body,t=s.getBoundingClientRect(),c=e.clientHeight||Number.parseFloat(e.style.height),u=n.documentElement.scrollHeight,H=Math.max(s.scrollHeight,s.offsetHeight,t.height),o=Math.max(s===n.body&&s.scrollHeight<=c?0:s.scrollHeight,s.offsetHeight,t.height,t.bottom||0),A=u>c+1?u:0,Z=Number.parseFloat(window.getComputedStyle(s).height),D=Math.abs(H-c)<=1||Math.abs(Z-c)<=1&&s.scrollHeight<=s.offsetHeight,B=Math.min(Math.max(Math.ceil(D?c:Math.max(o,A)+ae),k),ce),d=y.current,q=Math.max(o,A),U=e.clientWidth,ee=(d==null?void 0:d.document)===n&&d.width===U,E=d?c-d.viewportHeight:0,V=d?q-d.contentHeight:0,G=!!(ee&&q>c&&(E>1&&Math.abs(V-E)<=1||d.viewportDependent&&Math.abs(E)<=1&&Math.abs(V)<=1));y.current={document:n,viewportHeight:c,width:U,contentHeight:q,viewportDependent:G},G||Q($=>$===B?$:B)}catch{return}},[l]),a=i.useCallback(()=>{!l||!p.current||g.current!==null||(g.current=window.requestAnimationFrame(()=>{g.current=null,T()}))},[l,T]),j=i.useCallback(()=>{var e,n,s;if((e=h.current)==null||e.call(h),h.current=void 0,y.current=void 0,!!l)try{const t=(n=_.current)==null?void 0:n.contentDocument;if(!(t!=null&&t.body))return;let c=!0;const u=()=>{c&&a()},H=t.querySelector("[data-iframe-content]")??t.body,o=typeof ResizeObserver>"u"?void 0:new ResizeObserver(u);o==null||o.observe(H),H!==t.body&&(o==null||o.observe(t.body)),t.addEventListener("load",u,!0),t.addEventListener("error",u,!0),(s=t.fonts)==null||s.ready.then(u).catch(()=>{}),h.current=()=>{c=!1,o==null||o.disconnect(),t.removeEventListener("load",u,!0),t.removeEventListener("error",u,!0)}}catch{return}},[l,a]),Y=e=>{p.current=!0,j(),w==null||w(e),a()};return i.useEffect(()=>(p.current=x.current===f,x.current===f&&(j(),a()),x.current=f,()=>{var e;p.current=!1,(e=h.current)==null||e.call(h),R()}),[R,j,a,f]),i.useEffect(()=>{var e;if(l)return window.addEventListener("resize",a),(e=window.visualViewport)==null||e.addEventListener("resize",a),()=>{var n;window.removeEventListener("resize",a),(n=window.visualViewport)==null||n.removeEventListener("resize",a)}},[l,a]),r.jsxs("div",{className:m.wrapper,"data-component":"iframe",children:[J&&r.jsx("div",{className:m.toolbar,children:r.jsx(L.Button,{"aria-expanded":M,"aria-haspopup":"dialog",onClick:()=>b(!0),variant:"tertiary",children:X})}),r.jsx("iframe",{...I,className:z(m.iframe,S),loading:K,onLoad:Y,ref:_,referrerPolicy:F,sandbox:O,srcDoc:f,style:l?{...N,height:P,minHeight:k}:N,title:v}),!M&&r.jsx("div",{className:m["print-content"],"data-iframe-print-content":!0,children:C??r.jsx("p",{children:v})}),M&&r.jsxs(ne.Dialog,{"aria-label":`${v} fullscreen`,controls:r.jsx(te.Controls,{children:r.jsx(L.Button,{onClick:()=>b(!1),children:W})}),fullscreen:!0,header:r.jsx(re.Header,{children:r.jsx("h2",{children:v})}),open:!0,setOpen:b,children:[r.jsx("iframe",{...I,className:z(m.iframe,m["fullscreen-iframe"],S),loading:"eager",onLoad:w,referrerPolicy:F,sandbox:O,srcDoc:f,title:`${v} fullscreen`}),r.jsx("div",{className:m["print-content"],"data-iframe-print-content":!0,children:C??r.jsx("p",{children:v})})]})]})};exports.Iframe=le;
|
|
@@ -1,93 +1,98 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Controls as
|
|
6
|
-
import { Dialog as
|
|
7
|
-
import { Header as
|
|
8
|
-
import '../../assets/index19.css';const
|
|
9
|
-
wrapper:
|
|
10
|
-
toolbar:
|
|
11
|
-
iframe:
|
|
1
|
+
import { jsxs as W, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import X from "classix";
|
|
3
|
+
import { useRef as v, useState as J, useCallback as _, useEffect as K } from "react";
|
|
4
|
+
import { Button as Q } from "../button/index.js";
|
|
5
|
+
import { Controls as oe } from "../controls/index.js";
|
|
6
|
+
import { Dialog as ce } from "../dialog/index.js";
|
|
7
|
+
import { Header as se } from "../header/index.js";
|
|
8
|
+
import '../../assets/index19.css';const ae = "_wrapper_vtkwq_1", le = "_toolbar_vtkwq_6", ue = "_iframe_vtkwq_12", m = {
|
|
9
|
+
wrapper: ae,
|
|
10
|
+
toolbar: le,
|
|
11
|
+
iframe: ue,
|
|
12
12
|
"fullscreen-iframe": "_fullscreen-iframe_vtkwq_18",
|
|
13
13
|
"print-content": "_print-content_vtkwq_23"
|
|
14
|
-
},
|
|
15
|
-
accessibleLabel:
|
|
16
|
-
autoResize:
|
|
17
|
-
className:
|
|
18
|
-
closeFullscreenLabel:
|
|
19
|
-
fullscreenLabel:
|
|
20
|
-
hasFullscreenView:
|
|
21
|
-
loading:
|
|
22
|
-
onLoad:
|
|
23
|
-
printContent:
|
|
24
|
-
referrerPolicy:
|
|
25
|
-
sandbox:
|
|
14
|
+
}, N = 120, de = 12e3, he = 8, _e = ({
|
|
15
|
+
accessibleLabel: f,
|
|
16
|
+
autoResize: a = !1,
|
|
17
|
+
className: O,
|
|
18
|
+
closeFullscreenLabel: R = "Close fullscreen",
|
|
19
|
+
fullscreenLabel: Y = "View in fullscreen",
|
|
20
|
+
hasFullscreenView: Z = !0,
|
|
21
|
+
loading: P = "lazy",
|
|
22
|
+
onLoad: g,
|
|
23
|
+
printContent: S,
|
|
24
|
+
referrerPolicy: A = "no-referrer",
|
|
25
|
+
sandbox: C = "",
|
|
26
26
|
srcDoc: h,
|
|
27
|
-
style:
|
|
28
|
-
...
|
|
27
|
+
style: I,
|
|
28
|
+
...T
|
|
29
29
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}, []),
|
|
33
|
-
if (!
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
!
|
|
50
|
-
|
|
51
|
-
l.current = null, _();
|
|
52
|
-
}, 250);
|
|
30
|
+
const y = v(null), p = v(null), d = v(void 0), w = v(!0), M = v(h), E = v(void 0), [D, ee] = J(N), [b, x] = J(!1), B = _(() => {
|
|
31
|
+
p.current !== null && (window.cancelAnimationFrame(p.current), p.current = null);
|
|
32
|
+
}, []), U = _(() => {
|
|
33
|
+
if (!(!a || !w.current))
|
|
34
|
+
try {
|
|
35
|
+
const e = y.current, r = e == null ? void 0 : e.contentDocument;
|
|
36
|
+
if (!e || !(r != null && r.body)) return;
|
|
37
|
+
const n = r.querySelector("[data-iframe-content]") ?? r.body, t = n.getBoundingClientRect(), c = e.clientHeight || Number.parseFloat(e.style.height), l = r.documentElement.scrollHeight, H = Math.max(n.scrollHeight, n.offsetHeight, t.height), i = Math.max(n === r.body && n.scrollHeight <= c ? 0 : n.scrollHeight, n.offsetHeight, t.height, t.bottom || 0), V = l > c + 1 ? l : 0, re = Number.parseFloat(window.getComputedStyle(n).height), ne = Math.abs(H - c) <= 1 || Math.abs(re - c) <= 1 && n.scrollHeight <= n.offsetHeight, G = Math.min(Math.max(Math.ceil(ne ? c : Math.max(i, V) + he), N), de), u = E.current, k = Math.max(i, V), j = e.clientWidth, ie = (u == null ? void 0 : u.document) === r && u.width === j, q = u ? c - u.viewportHeight : 0, $ = u ? k - u.contentHeight : 0, z = !!(ie && k > c && (q > 1 && Math.abs($ - q) <= 1 || u.viewportDependent && Math.abs(q) <= 1 && Math.abs($) <= 1));
|
|
38
|
+
E.current = {
|
|
39
|
+
document: r,
|
|
40
|
+
viewportHeight: c,
|
|
41
|
+
width: j,
|
|
42
|
+
contentHeight: k,
|
|
43
|
+
viewportDependent: z
|
|
44
|
+
}, z || ee((L) => L === G ? L : G);
|
|
45
|
+
} catch {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}, [a]), s = _(() => {
|
|
49
|
+
!a || !w.current || p.current !== null || (p.current = window.requestAnimationFrame(() => {
|
|
50
|
+
p.current = null, U();
|
|
53
51
|
}));
|
|
54
|
-
}, [
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
}, [a, U]), F = _(() => {
|
|
53
|
+
var e, r, n;
|
|
54
|
+
if ((e = d.current) == null || e.call(d), d.current = void 0, E.current = void 0, !!a)
|
|
55
|
+
try {
|
|
56
|
+
const t = (r = y.current) == null ? void 0 : r.contentDocument;
|
|
57
|
+
if (!(t != null && t.body)) return;
|
|
58
|
+
let c = !0;
|
|
59
|
+
const l = () => {
|
|
60
|
+
c && s();
|
|
61
|
+
}, H = t.querySelector("[data-iframe-content]") ?? t.body, i = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(l);
|
|
62
|
+
i == null || i.observe(H), H !== t.body && (i == null || i.observe(t.body)), t.addEventListener("load", l, !0), t.addEventListener("error", l, !0), (n = t.fonts) == null || n.ready.then(l).catch(() => {
|
|
63
|
+
}), d.current = () => {
|
|
64
|
+
c = !1, i == null || i.disconnect(), t.removeEventListener("load", l, !0), t.removeEventListener("error", l, !0);
|
|
65
|
+
};
|
|
66
|
+
} catch {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}, [a, s]), te = (e) => {
|
|
70
|
+
w.current = !0, F(), g == null || g(e), s();
|
|
66
71
|
};
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
var
|
|
72
|
-
if (
|
|
73
|
-
return window.addEventListener("resize",
|
|
74
|
-
var
|
|
75
|
-
window.removeEventListener("resize",
|
|
72
|
+
return K(() => (w.current = M.current === h, M.current === h && (F(), s()), M.current = h, () => {
|
|
73
|
+
var e;
|
|
74
|
+
w.current = !1, (e = d.current) == null || e.call(d), B();
|
|
75
|
+
}), [B, F, s, h]), K(() => {
|
|
76
|
+
var e;
|
|
77
|
+
if (a)
|
|
78
|
+
return window.addEventListener("resize", s), (e = window.visualViewport) == null || e.addEventListener("resize", s), () => {
|
|
79
|
+
var r;
|
|
80
|
+
window.removeEventListener("resize", s), (r = window.visualViewport) == null || r.removeEventListener("resize", s);
|
|
76
81
|
};
|
|
77
|
-
}, [
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
...
|
|
81
|
-
height:
|
|
82
|
-
minHeight:
|
|
83
|
-
} :
|
|
84
|
-
!
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
82
|
+
}, [a, s]), /* @__PURE__ */ W("div", { className: m.wrapper, "data-component": "iframe", children: [
|
|
83
|
+
Z && /* @__PURE__ */ o("div", { className: m.toolbar, children: /* @__PURE__ */ o(Q, { "aria-expanded": b, "aria-haspopup": "dialog", onClick: () => x(!0), variant: "tertiary", children: Y }) }),
|
|
84
|
+
/* @__PURE__ */ o("iframe", { ...T, className: X(m.iframe, O), loading: P, onLoad: te, ref: y, referrerPolicy: A, sandbox: C, srcDoc: h, style: a ? {
|
|
85
|
+
...I,
|
|
86
|
+
height: D,
|
|
87
|
+
minHeight: N
|
|
88
|
+
} : I, title: f }),
|
|
89
|
+
!b && /* @__PURE__ */ o("div", { className: m["print-content"], "data-iframe-print-content": !0, children: S ?? /* @__PURE__ */ o("p", { children: f }) }),
|
|
90
|
+
b && /* @__PURE__ */ W(ce, { "aria-label": `${f} fullscreen`, controls: /* @__PURE__ */ o(oe, { children: /* @__PURE__ */ o(Q, { onClick: () => x(!1), children: R }) }), fullscreen: !0, header: /* @__PURE__ */ o(se, { children: /* @__PURE__ */ o("h2", { children: f }) }), open: !0, setOpen: x, children: [
|
|
91
|
+
/* @__PURE__ */ o("iframe", { ...T, className: X(m.iframe, m["fullscreen-iframe"], O), loading: "eager", onLoad: g, referrerPolicy: A, sandbox: C, srcDoc: h, title: `${f} fullscreen` }),
|
|
92
|
+
/* @__PURE__ */ o("div", { className: m["print-content"], "data-iframe-print-content": !0, children: S ?? /* @__PURE__ */ o("p", { children: f }) })
|
|
88
93
|
] })
|
|
89
94
|
] });
|
|
90
95
|
};
|
|
91
96
|
export {
|
|
92
|
-
|
|
97
|
+
_e as Iframe
|
|
93
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const m=require("react/jsx-runtime"),S=require("classix"),v=require("react"),q=require("../editor/index.cjs"),j=require("../list/index.cjs"),A=require("../tooltip/index.cjs"),B=require("../message/index.cjs"),D="_messages_88pw2_1",H="_fill_88pw2_22",b={messages:D,fill:H};function P(R){const g=v.useRef(null),a=v.useRef(()=>{});return v.useLayoutEffect(()=>{const e=g.current;if(!e)return;let c=!0,d=e.scrollTop,s;const i=()=>{const n=e.getBoundingClientRect().top,o=Array.from(e.children).find(f=>f instanceof HTMLElement&&f.getBoundingClientRect().bottom>n);s=o?{element:o,offset:o.getBoundingClientRect().top-n}:void 0},h=()=>{if(Math.abs(e.scrollTop-d)<=.5)return!1;const n=Math.max(0,e.scrollHeight-e.clientHeight);return!(d>n&&Math.abs(e.scrollTop-n)<=.5)},l=()=>{if(h()&&(c=!1,i()),c)e.scrollTop=e.scrollHeight;else if(s!=null&&s.element.isConnected&&e.contains(s.element)){const o=s.element.getBoundingClientRect().top-e.getBoundingClientRect().top-s.offset;Math.abs(o)>.5&&(e.scrollTop+=o)}d=e.scrollTop,i()};a.current=l;const r=()=>{c=!1,i()},E=()=>{h()&&(c=!1),d=e.scrollTop,i()},w=n=>{n.target===e&&r()},L=n=>{const o=n.target;o instanceof Element&&o.closest('input, textarea, select, [contenteditable="true"]')||["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(n.key)&&r()},t=typeof ResizeObserver>"u"?void 0:new ResizeObserver(l),x=()=>{t==null||t.disconnect(),t==null||t.observe(e),Array.from(e.children).forEach(n=>t==null?void 0:t.observe(n)),l()},u=new MutationObserver(x);return u.observe(e,{childList:!0,subtree:!0,characterData:!0}),x(),e.addEventListener("scroll",E,{passive:!0}),e.addEventListener("wheel",r,{passive:!0}),e.addEventListener("touchmove",r,{passive:!0}),e.addEventListener("pointerdown",w),e.addEventListener("keydown",L),e.addEventListener("load",l,!0),e.addEventListener("error",l,!0),()=>{a.current=()=>{},t==null||t.disconnect(),u.disconnect(),e.removeEventListener("scroll",E),e.removeEventListener("wheel",r),e.removeEventListener("touchmove",r),e.removeEventListener("pointerdown",w),e.removeEventListener("keydown",L),e.removeEventListener("load",l,!0),e.removeEventListener("error",l,!0)}},[]),v.useLayoutEffect(()=>a.current(),[R]),g}const k=({autofocus:R=!0,fill:g=!1,files:a,handleUpload:e,inlineImages:c,maxEditorRows:d=5,message:s="",messages:i,minEditorRows:h=1,onChange:l,onFilesChange:r,onInlineImagesChange:E,onSubmit:w,placeholder:L,sending:t,submitLabel:x="Send message",tooltipLabel:u})=>{var _;const[n,o]=v.useState([]),f=a??n,y=(_=i[i.length-1])==null?void 0:_.id,M=P(y),T=s.replace(/<[^>]*>/g,"").replace(/ /g," ").trim()==="";return m.jsxs("div",{className:S(b.messages,g&&b.fill),"data-component":"messages",children:[m.jsx(j.List,{"data-message-list":!0,ref:M,tabIndex:0,children:i.map(p=>m.jsx(B.Message,{...p},p.id))}),u&&m.jsx(A.Tooltip,{variant:"static",children:u}),m.jsx(q.Editor,{autofocus:R,content:s,disabled:t||T&&f.length===0&&!(c!=null&&c.length),files:f,inlineImages:c,isSubmitting:t,maxRows:d,minRows:h,onChange:l,onFilesChange:p=>{a===void 0&&o(p),r==null||r(p)},onInlineImagesChange:E,onSubmit:w,onUpload:e,placeholder:L,submitLabel:x})]})};exports.Messages=k;
|
|
@@ -1,76 +1,98 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Editor as
|
|
5
|
-
import { List as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import { Message as
|
|
8
|
-
import '../../assets/index15.css';const
|
|
9
|
-
messages:
|
|
10
|
-
fill:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const G = window.setTimeout(() => {
|
|
38
|
-
o.current = !1;
|
|
39
|
-
}, 5e3), T = () => {
|
|
40
|
-
e.scrollTop = e.scrollHeight;
|
|
41
|
-
};
|
|
42
|
-
E && T();
|
|
43
|
-
const w = (t) => {
|
|
44
|
-
o.current && t.target instanceof HTMLImageElement && T();
|
|
45
|
-
}, R = (t) => {
|
|
46
|
-
t.deltaY < 0 && (o.current = !1);
|
|
47
|
-
};
|
|
48
|
-
let n;
|
|
49
|
-
const S = (t) => {
|
|
50
|
-
var s;
|
|
51
|
-
n = (s = t.touches[0]) == null ? void 0 : s.clientY;
|
|
52
|
-
}, _ = (t) => {
|
|
53
|
-
var Y;
|
|
54
|
-
const s = (Y = t.touches[0]) == null ? void 0 : Y.clientY;
|
|
55
|
-
s !== void 0 && n !== void 0 && s > n && (o.current = !1), n = s;
|
|
1
|
+
import { jsxs as A, jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import B from "classix";
|
|
3
|
+
import { useRef as M, useLayoutEffect as T, useState as D } from "react";
|
|
4
|
+
import { Editor as H } from "../editor/index.js";
|
|
5
|
+
import { List as k } from "../list/index.js";
|
|
6
|
+
import { Tooltip as C } from "../tooltip/index.js";
|
|
7
|
+
import { Message as P } from "../message/index.js";
|
|
8
|
+
import '../../assets/index15.css';const U = "_messages_88pw2_1", j = "_fill_88pw2_22", y = {
|
|
9
|
+
messages: U,
|
|
10
|
+
fill: j
|
|
11
|
+
};
|
|
12
|
+
function q(R) {
|
|
13
|
+
const p = M(null), a = M(() => {
|
|
14
|
+
});
|
|
15
|
+
return T(() => {
|
|
16
|
+
const e = p.current;
|
|
17
|
+
if (!e) return;
|
|
18
|
+
let l = !0, d = e.scrollTop, r;
|
|
19
|
+
const i = () => {
|
|
20
|
+
const o = e.getBoundingClientRect().top, n = Array.from(e.children).find((u) => u instanceof HTMLElement && u.getBoundingClientRect().bottom > o);
|
|
21
|
+
r = n ? {
|
|
22
|
+
element: n,
|
|
23
|
+
offset: n.getBoundingClientRect().top - o
|
|
24
|
+
} : void 0;
|
|
25
|
+
}, v = () => {
|
|
26
|
+
if (Math.abs(e.scrollTop - d) <= 0.5) return !1;
|
|
27
|
+
const o = Math.max(0, e.scrollHeight - e.clientHeight);
|
|
28
|
+
return !(d > o && Math.abs(e.scrollTop - o) <= 0.5);
|
|
29
|
+
}, c = () => {
|
|
30
|
+
if (v() && (l = !1, i()), l)
|
|
31
|
+
e.scrollTop = e.scrollHeight;
|
|
32
|
+
else if (r != null && r.element.isConnected && e.contains(r.element)) {
|
|
33
|
+
const n = r.element.getBoundingClientRect().top - e.getBoundingClientRect().top - r.offset;
|
|
34
|
+
Math.abs(n) > 0.5 && (e.scrollTop += n);
|
|
35
|
+
}
|
|
36
|
+
d = e.scrollTop, i();
|
|
56
37
|
};
|
|
57
|
-
|
|
38
|
+
a.current = c;
|
|
39
|
+
const s = () => {
|
|
40
|
+
l = !1, i();
|
|
41
|
+
}, g = () => {
|
|
42
|
+
v() && (l = !1), d = e.scrollTop, i();
|
|
43
|
+
}, h = (o) => {
|
|
44
|
+
o.target === e && s();
|
|
45
|
+
}, w = (o) => {
|
|
46
|
+
const n = o.target;
|
|
47
|
+
n instanceof Element && n.closest('input, textarea, select, [contenteditable="true"]') || ["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(o.key) && s();
|
|
48
|
+
}, t = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(c), E = () => {
|
|
49
|
+
t == null || t.disconnect(), t == null || t.observe(e), Array.from(e.children).forEach((o) => t == null ? void 0 : t.observe(o)), c();
|
|
50
|
+
}, f = new MutationObserver(E);
|
|
51
|
+
return f.observe(e, {
|
|
52
|
+
childList: !0,
|
|
53
|
+
subtree: !0,
|
|
54
|
+
characterData: !0
|
|
55
|
+
}), E(), e.addEventListener("scroll", g, {
|
|
58
56
|
passive: !0
|
|
59
|
-
}), e.addEventListener("
|
|
57
|
+
}), e.addEventListener("wheel", s, {
|
|
60
58
|
passive: !0
|
|
61
|
-
}), e.addEventListener("touchmove",
|
|
59
|
+
}), e.addEventListener("touchmove", s, {
|
|
62
60
|
passive: !0
|
|
63
|
-
}), () => {
|
|
64
|
-
|
|
61
|
+
}), e.addEventListener("pointerdown", h), e.addEventListener("keydown", w), e.addEventListener("load", c, !0), e.addEventListener("error", c, !0), () => {
|
|
62
|
+
a.current = () => {
|
|
63
|
+
}, t == null || t.disconnect(), f.disconnect(), e.removeEventListener("scroll", g), e.removeEventListener("wheel", s), e.removeEventListener("touchmove", s), e.removeEventListener("pointerdown", h), e.removeEventListener("keydown", w), e.removeEventListener("load", c, !0), e.removeEventListener("error", c, !0);
|
|
65
64
|
};
|
|
66
|
-
}, [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
}, []), T(() => a.current(), [R]), p;
|
|
66
|
+
}
|
|
67
|
+
const V = ({
|
|
68
|
+
autofocus: R = !0,
|
|
69
|
+
fill: p = !1,
|
|
70
|
+
files: a,
|
|
71
|
+
handleUpload: e,
|
|
72
|
+
inlineImages: l,
|
|
73
|
+
maxEditorRows: d = 5,
|
|
74
|
+
message: r = "",
|
|
75
|
+
messages: i,
|
|
76
|
+
minEditorRows: v = 1,
|
|
77
|
+
onChange: c,
|
|
78
|
+
onFilesChange: s,
|
|
79
|
+
onInlineImagesChange: g,
|
|
80
|
+
onSubmit: h,
|
|
81
|
+
placeholder: w,
|
|
82
|
+
sending: t,
|
|
83
|
+
submitLabel: E = "Send message",
|
|
84
|
+
tooltipLabel: f
|
|
85
|
+
}) => {
|
|
86
|
+
var b;
|
|
87
|
+
const [o, n] = D([]), u = a ?? o, x = (b = i[i.length - 1]) == null ? void 0 : b.id, S = q(x), _ = r.replace(/<[^>]*>/g, "").replace(/ /g, " ").trim() === "";
|
|
88
|
+
return /* @__PURE__ */ A("div", { className: B(y.messages, p && y.fill), "data-component": "messages", children: [
|
|
89
|
+
/* @__PURE__ */ L(k, { "data-message-list": !0, ref: S, tabIndex: 0, children: i.map((m) => /* @__PURE__ */ L(P, { ...m }, m.id)) }),
|
|
90
|
+
f && /* @__PURE__ */ L(C, { variant: "static", children: f }),
|
|
91
|
+
/* @__PURE__ */ L(H, { autofocus: R, content: r, disabled: t || _ && u.length === 0 && !(l != null && l.length), files: u, inlineImages: l, isSubmitting: t, maxRows: d, minRows: v, onChange: c, onFilesChange: (m) => {
|
|
92
|
+
a === void 0 && n(m), s == null || s(m);
|
|
93
|
+
}, onInlineImagesChange: g, onSubmit: h, onUpload: e, placeholder: w, submitLabel: E })
|
|
72
94
|
] });
|
|
73
95
|
};
|
|
74
96
|
export {
|
|
75
|
-
|
|
97
|
+
V as Messages
|
|
76
98
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -343,12 +343,13 @@ export declare const Fieldset: ({ className, ...props }: FieldsetProps) => JSX.E
|
|
|
343
343
|
|
|
344
344
|
export declare type FieldsetProps = React.ComponentPropsWithoutRef<'fieldset'>;
|
|
345
345
|
|
|
346
|
-
export declare const Figure: ({ accessibleLabel, children, className, variant, }: FigureProps) => JSX.Element;
|
|
346
|
+
export declare const Figure: ({ accessibleLabel, children, className, reserveSpace, variant, }: FigureProps) => JSX.Element;
|
|
347
347
|
|
|
348
348
|
declare type FigureProps = {
|
|
349
349
|
accessibleLabel?: string;
|
|
350
350
|
children?: React.ReactNode;
|
|
351
351
|
className?: string;
|
|
352
|
+
reserveSpace?: boolean;
|
|
352
353
|
variant?: 'default' | 'preview';
|
|
353
354
|
};
|
|
354
355
|
|
|
@@ -809,9 +810,10 @@ export declare type MessageOptions = {
|
|
|
809
810
|
type?: 'default' | 'minimal' | 'system' | 'user';
|
|
810
811
|
};
|
|
811
812
|
|
|
812
|
-
export declare const Messages: ({ fill, files, handleUpload, inlineImages, maxEditorRows, message, messages, minEditorRows, onChange, onFilesChange, onInlineImagesChange, onSubmit, placeholder, sending, submitLabel, tooltipLabel, }: MessagesProps) => JSX.Element;
|
|
813
|
+
export declare const Messages: ({ autofocus, fill, files, handleUpload, inlineImages, maxEditorRows, message, messages, minEditorRows, onChange, onFilesChange, onInlineImagesChange, onSubmit, placeholder, sending, submitLabel, tooltipLabel, }: MessagesProps) => JSX.Element;
|
|
813
814
|
|
|
814
815
|
export declare type MessagesProps = {
|
|
816
|
+
autofocus?: boolean;
|
|
815
817
|
fill?: boolean;
|
|
816
818
|
files?: readonly File[];
|
|
817
819
|
handleUpload: (files: FileList) => Promise<void> | void;
|
package/dist/tokens.json
CHANGED