@solibo/solibo-ui 2.2.8 → 2.2.10

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.
@@ -1 +1 @@
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(/&nbsp;/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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const p=require("react/jsx-runtime"),q=require("classix"),m=require("react"),j=require("../editor/index.cjs"),A=require("../list/index.cjs"),B=require("../tooltip/index.cjs"),D=require("../message/index.cjs"),H="_messages_88pw2_1",P="_fill_88pw2_22",y={messages:H,fill:P};function k(R){const v=m.useRef(null),a=m.useRef(()=>{});return m.useLayoutEffect(()=>{const e=v.current;if(!e)return;let c=!0,d=e.scrollTop,s;const i=()=>{const t=e.getBoundingClientRect().top,o=Array.from(e.children).find(x=>x instanceof HTMLElement&&x.getBoundingClientRect().bottom>t);s=o?{element:o,offset:o.getBoundingClientRect().top-t}:void 0},g=()=>{if(Math.abs(e.scrollTop-d)<=.5)return!1;const t=Math.max(0,e.scrollHeight-e.clientHeight);return!(d>t&&Math.abs(e.scrollTop-t)<=.5)},l=()=>{if(g()&&(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()},h=()=>{g()&&(c=!1),d=e.scrollTop,i()},E=t=>{t.target===e&&r()},w=t=>{const o=t.target;o instanceof Element&&o.closest('input, textarea, select, [contenteditable="true"]')||["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(t.key)&&r()},n=typeof ResizeObserver>"u"?void 0:new ResizeObserver(l),u=()=>{n==null||n.disconnect(),n==null||n.observe(e),Array.from(e.children).forEach(t=>n==null?void 0:n.observe(t)),l()},L=new MutationObserver(u);return L.observe(e,{childList:!0,subtree:!0,characterData:!0}),u(),e.addEventListener("scroll",h,{passive:!0}),e.addEventListener("wheel",r,{passive:!0}),e.addEventListener("touchmove",r,{passive:!0}),e.addEventListener("pointerdown",E),e.addEventListener("keydown",w),e.addEventListener("load",l,!0),e.addEventListener("error",l,!0),()=>{a.current=()=>{},n==null||n.disconnect(),L.disconnect(),e.removeEventListener("scroll",h),e.removeEventListener("wheel",r),e.removeEventListener("touchmove",r),e.removeEventListener("pointerdown",E),e.removeEventListener("keydown",w),e.removeEventListener("load",l,!0),e.removeEventListener("error",l,!0)}},[]),m.useLayoutEffect(()=>a.current(),[R]),v}const C=({autofocus:R=!0,fill:v=!1,files:a,handleUpload:e,inlineImages:c,maxEditorRows:d=5,message:s="",messages:i,minEditorRows:g=1,onChange:l,onFilesChange:r,onInlineImagesChange:h,onSubmit:E,placeholder:w,resizableEditor:n=!1,sending:u,submitLabel:L="Send message",tooltipLabel:t})=>{var _;const[o,x]=m.useState([]),b=a??o,M=(_=i[i.length-1])==null?void 0:_.id,T=k(M),S=s.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim()==="";return p.jsxs("div",{className:q(y.messages,v&&y.fill),"data-component":"messages",children:[p.jsx(A.List,{"data-message-list":!0,ref:T,tabIndex:0,children:i.map(f=>p.jsx(D.Message,{...f},f.id))}),t&&p.jsx(B.Tooltip,{variant:"static",children:t}),p.jsx(j.Editor,{autofocus:R,content:s,disabled:u||S&&b.length===0&&!(c!=null&&c.length),files:b,inlineImages:c,isSubmitting:u,maxRows:d,minRows:g,onChange:l,onFilesChange:f=>{a===void 0&&x(f),r==null||r(f)},onInlineImagesChange:h,onSubmit:E,onUpload:e,placeholder:w,resizable:n?"top":!1,submitLabel:L})]})};exports.Messages=C;
@@ -1,98 +1,99 @@
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
1
+ import { jsxs as B, jsx as L } from "react/jsx-runtime";
2
+ import D from "classix";
3
+ import { useRef as T, useLayoutEffect as y, useState as H } from "react";
4
+ import { Editor as k } from "../editor/index.js";
5
+ import { List as C } from "../list/index.js";
6
+ import { Tooltip as P } from "../tooltip/index.js";
7
+ import { Message as U } from "../message/index.js";
8
+ import '../../assets/index15.css';const j = "_messages_88pw2_1", q = "_fill_88pw2_22", x = {
9
+ messages: j,
10
+ fill: q
11
11
  };
12
- function q(R) {
13
- const p = M(null), a = M(() => {
12
+ function K(R) {
13
+ const m = T(null), a = T(() => {
14
14
  });
15
- return T(() => {
16
- const e = p.current;
15
+ return y(() => {
16
+ const e = m.current;
17
17
  if (!e) return;
18
- let l = !0, d = e.scrollTop, r;
18
+ let l = !0, d = e.scrollTop, s;
19
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 ? {
20
+ const t = e.getBoundingClientRect().top, n = Array.from(e.children).find((E) => E instanceof HTMLElement && E.getBoundingClientRect().bottom > t);
21
+ s = n ? {
22
22
  element: n,
23
- offset: n.getBoundingClientRect().top - o
23
+ offset: n.getBoundingClientRect().top - t
24
24
  } : void 0;
25
- }, v = () => {
25
+ }, p = () => {
26
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);
27
+ const t = Math.max(0, e.scrollHeight - e.clientHeight);
28
+ return !(d > t && Math.abs(e.scrollTop - t) <= 0.5);
29
29
  }, c = () => {
30
- if (v() && (l = !1, i()), l)
30
+ if (p() && (l = !1, i()), l)
31
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;
32
+ else if (s != null && s.element.isConnected && e.contains(s.element)) {
33
+ const n = s.element.getBoundingClientRect().top - e.getBoundingClientRect().top - s.offset;
34
34
  Math.abs(n) > 0.5 && (e.scrollTop += n);
35
35
  }
36
36
  d = e.scrollTop, i();
37
37
  };
38
38
  a.current = c;
39
- const s = () => {
39
+ const r = () => {
40
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, {
41
+ }, v = () => {
42
+ p() && (l = !1), d = e.scrollTop, i();
43
+ }, g = (t) => {
44
+ t.target === e && r();
45
+ }, h = (t) => {
46
+ const n = t.target;
47
+ n instanceof Element && n.closest('input, textarea, select, [contenteditable="true"]') || ["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(t.key) && r();
48
+ }, o = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(c), f = () => {
49
+ o == null || o.disconnect(), o == null || o.observe(e), Array.from(e.children).forEach((t) => o == null ? void 0 : o.observe(t)), c();
50
+ }, w = new MutationObserver(f);
51
+ return w.observe(e, {
52
52
  childList: !0,
53
53
  subtree: !0,
54
54
  characterData: !0
55
- }), E(), e.addEventListener("scroll", g, {
55
+ }), f(), e.addEventListener("scroll", v, {
56
56
  passive: !0
57
- }), e.addEventListener("wheel", s, {
57
+ }), e.addEventListener("wheel", r, {
58
58
  passive: !0
59
- }), e.addEventListener("touchmove", s, {
59
+ }), e.addEventListener("touchmove", r, {
60
60
  passive: !0
61
- }), e.addEventListener("pointerdown", h), e.addEventListener("keydown", w), e.addEventListener("load", c, !0), e.addEventListener("error", c, !0), () => {
61
+ }), e.addEventListener("pointerdown", g), e.addEventListener("keydown", h), e.addEventListener("load", c, !0), e.addEventListener("error", c, !0), () => {
62
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);
63
+ }, o == null || o.disconnect(), w.disconnect(), e.removeEventListener("scroll", v), e.removeEventListener("wheel", r), e.removeEventListener("touchmove", r), e.removeEventListener("pointerdown", g), e.removeEventListener("keydown", h), e.removeEventListener("load", c, !0), e.removeEventListener("error", c, !0);
64
64
  };
65
- }, []), T(() => a.current(), [R]), p;
65
+ }, []), y(() => a.current(), [R]), m;
66
66
  }
67
- const V = ({
67
+ const W = ({
68
68
  autofocus: R = !0,
69
- fill: p = !1,
69
+ fill: m = !1,
70
70
  files: a,
71
71
  handleUpload: e,
72
72
  inlineImages: l,
73
73
  maxEditorRows: d = 5,
74
- message: r = "",
74
+ message: s = "",
75
75
  messages: i,
76
- minEditorRows: v = 1,
76
+ minEditorRows: p = 1,
77
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
78
+ onFilesChange: r,
79
+ onInlineImagesChange: v,
80
+ onSubmit: g,
81
+ placeholder: h,
82
+ resizableEditor: o = !1,
83
+ sending: f,
84
+ submitLabel: w = "Send message",
85
+ tooltipLabel: t
85
86
  }) => {
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(/&nbsp;/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 })
87
+ var M;
88
+ const [n, E] = H([]), b = a ?? n, S = (M = i[i.length - 1]) == null ? void 0 : M.id, _ = K(S), A = s.replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").trim() === "";
89
+ return /* @__PURE__ */ B("div", { className: D(x.messages, m && x.fill), "data-component": "messages", children: [
90
+ /* @__PURE__ */ L(C, { "data-message-list": !0, ref: _, tabIndex: 0, children: i.map((u) => /* @__PURE__ */ L(U, { ...u }, u.id)) }),
91
+ t && /* @__PURE__ */ L(P, { variant: "static", children: t }),
92
+ /* @__PURE__ */ L(k, { autofocus: R, content: s, disabled: f || A && b.length === 0 && !(l != null && l.length), files: b, inlineImages: l, isSubmitting: f, maxRows: d, minRows: p, onChange: c, onFilesChange: (u) => {
93
+ a === void 0 && E(u), r == null || r(u);
94
+ }, onInlineImagesChange: v, onSubmit: g, onUpload: e, placeholder: h, resizable: o ? "top" : !1, submitLabel: w })
94
95
  ] });
95
96
  };
96
97
  export {
97
- V as Messages
98
+ W as Messages
98
99
  };
package/dist/index.d.ts CHANGED
@@ -304,7 +304,7 @@ declare type DropzoneProps = {
304
304
  variant?: 'default' | 'minimal';
305
305
  };
306
306
 
307
- export declare const Editor: ({ autofocus, autolink, content, disabled, errorMessage, fill, files, inline, inlineImages, invalid, isSubmitting, maxRows, minRows, onChange, onFilesChange, onInlineImagesChange, onSubmit, onUpload, placeholder, required, submitLabel, }: EditorProps) => JSX.Element;
307
+ export declare const Editor: ({ autofocus, autolink, content, disabled, errorMessage, fill, files, inline, inlineImages, invalid, isSubmitting, maxRows, minRows, onChange, onFilesChange, onInlineImagesChange, onSubmit, onUpload, placeholder, required, resizable, submitLabel, }: EditorProps) => JSX.Element;
308
308
 
309
309
  export declare type EditorProps = {
310
310
  autofocus?: boolean;
@@ -327,6 +327,10 @@ export declare type EditorProps = {
327
327
  onUpload?: (files: FileList) => Promise<void> | void;
328
328
  placeholder?: string;
329
329
  required?: boolean;
330
+ /** Enables vertical resizing: true uses the native bottom grip, 'top' uses a top
331
+ * handle that grows upward. Ignored with fill. Automatic sizing keeps minRows/maxRows
332
+ * until resized; manual expansion is not capped by maxRows. */
333
+ resizable?: boolean | 'top';
330
334
  submitLabel?: string;
331
335
  };
332
336
 
@@ -810,7 +814,7 @@ export declare type MessageOptions = {
810
814
  type?: 'default' | 'minimal' | 'system' | 'user';
811
815
  };
812
816
 
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;
817
+ export declare const Messages: ({ autofocus, fill, files, handleUpload, inlineImages, maxEditorRows, message, messages, minEditorRows, onChange, onFilesChange, onInlineImagesChange, onSubmit, placeholder, resizableEditor, sending, submitLabel, tooltipLabel, }: MessagesProps) => JSX.Element;
814
818
 
815
819
  export declare type MessagesProps = {
816
820
  autofocus?: boolean;
@@ -827,6 +831,8 @@ export declare type MessagesProps = {
827
831
  onInlineImagesChange?: (images: PendingInlineImage[]) => void;
828
832
  onSubmit: () => Promise<void> | void;
829
833
  placeholder?: string;
834
+ /** Adds a top handle: drag upward to grow beyond maxEditorRows. Automatic sizing is preserved until dragged. */
835
+ resizableEditor?: boolean;
830
836
  sending: boolean;
831
837
  submitLabel?: string;
832
838
  tooltipLabel?: string;
package/dist/tokens.json CHANGED
@@ -363,7 +363,7 @@
363
363
  },
364
364
  "com.solibo": {
365
365
  "packageName": "@solibo/solibo-ui",
366
- "packageVersion": "2.2.8"
366
+ "packageVersion": "2.2.10"
367
367
  }
368
368
  },
369
369
  "$name": "TEST Solibo UI Tokens (Copy)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solibo/solibo-ui",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "./dist/index.js",