@solibo/solibo-ui 2.2.15 → 2.2.17

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.
Files changed (46) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/assets/index10.css +1 -1
  3. package/dist/assets/index13.css +1 -1
  4. package/dist/assets/index3.css +1 -1
  5. package/dist/assets/index30.css +1 -1
  6. package/dist/assets/index41.css +1 -1
  7. package/dist/assets/index42.css +1 -1
  8. package/dist/assets/index53.css +1 -1
  9. package/dist/assets/index54.css +1 -1
  10. package/dist/assets/index6.css +1 -1
  11. package/dist/assets/index9.css +1 -1
  12. package/dist/components/card/index.cjs +1 -1
  13. package/dist/components/card/index.js +50 -50
  14. package/dist/components/checkbox/index.cjs +1 -1
  15. package/dist/components/checkbox/index.js +24 -23
  16. package/dist/components/dropdown/index.cjs +1 -1
  17. package/dist/components/dropdown/index.js +211 -190
  18. package/dist/components/dropzone/index.cjs +1 -1
  19. package/dist/components/dropzone/index.js +84 -56
  20. package/dist/components/editor/index.cjs +1 -1
  21. package/dist/components/editor/index.js +1 -1
  22. package/dist/components/input/index.cjs +1 -1
  23. package/dist/components/input/index.js +1 -1
  24. package/dist/components/label/index.cjs +1 -1
  25. package/dist/components/label/index.js +16 -14
  26. package/dist/components/list/index.cjs +1 -1
  27. package/dist/components/list/index.js +20 -20
  28. package/dist/components/page-layout/index.cjs +1 -1
  29. package/dist/components/page-layout/index.js +13 -13
  30. package/dist/components/radio/index.cjs +1 -1
  31. package/dist/components/radio/index.js +13 -13
  32. package/dist/components/search/index.cjs +1 -1
  33. package/dist/components/search/index.js +78 -70
  34. package/dist/components/textarea/index.cjs +1 -1
  35. package/dist/components/textarea/index.js +39 -32
  36. package/dist/components/toggle/index.cjs +1 -1
  37. package/dist/components/toggle/index.js +10 -10
  38. package/dist/index-6TyCExT0.js +87 -0
  39. package/dist/index-DEQcFR32.cjs +1 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.ts +34 -9
  42. package/dist/index.js +1 -1
  43. package/dist/tokens.json +1 -1
  44. package/package.json +1 -1
  45. package/dist/index-Bre56YYa.js +0 -90
  46. package/dist/index-CHJNMNDr.cjs +0 -1
@@ -1,75 +1,103 @@
1
- import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
- import x from "classix";
3
- import { useRef as T, useState as j } from "react";
4
- import { Button as k } from "../button/index.js";
5
- import { Icon as A } from "../icon/index.js";
6
- import '../../assets/index42.css';const R = "_dropzone_1rpsf_1", S = "_dragging_1rpsf_19", w = "_minimal_1rpsf_23", u = {
7
- dropzone: R,
8
- dragging: S,
9
- minimal: w
10
- }, P = ({
11
- accepts: D,
12
- label: g = "Select files",
13
- maxFileSize: F,
14
- multiple: d = !1,
15
- onChange: i,
16
- onValidation: f,
17
- variant: a = "default",
18
- ..._
1
+ import { jsxs as I, jsx as o } from "react/jsx-runtime";
2
+ import Q from "classix";
3
+ import { useId as W, useRef as T, useState as X } from "react";
4
+ import { Button as Y } from "../button/index.js";
5
+ import { FieldError as Z } from "../form/index.js";
6
+ import { Label as q } from "../label/index.js";
7
+ import '../../assets/index42.css';const L = "_field_1tf8u_1", V = "_dropzone_1tf8u_19", M = "_upload_1tf8u_34", C = "_hint_1tf8u_46", ee = "_files_1tf8u_52", te = "_minimal_1tf8u_59", re = "_dragging_1tf8u_76", l = {
8
+ field: L,
9
+ dropzone: V,
10
+ upload: M,
11
+ hint: C,
12
+ files: ee,
13
+ minimal: te,
14
+ dragging: re
15
+ }, de = ({
16
+ "aria-describedby": w,
17
+ accepts: O,
18
+ children: N,
19
+ className: P,
20
+ description: x,
21
+ disabled: i = !1,
22
+ dropLabel: U = "or drag and drop",
23
+ errorMessage: c,
24
+ id: b,
25
+ invalid: p = !1,
26
+ label: a,
27
+ maxFileSize: j,
28
+ multiple: h = !1,
29
+ name: G,
30
+ onChange: d,
31
+ onValidation: y,
32
+ required: B = !1,
33
+ uploadLabel: m = a ?? "Select files",
34
+ variant: n = "default"
19
35
  }) => {
20
- const m = T(null), [y, o] = j(!1), c = (e) => {
36
+ const F = W(), E = b ?? F, D = (p || c) && c ? `${F}-error` : void 0, R = x && n !== "minimal" ? `${F}-description` : void 0, k = [w, R, D].filter(Boolean).join(" ") || void 0, f = T(0), A = T(null), z = T(null), [H, g] = X(!1), _ = (e) => {
21
37
  e.preventDefault(), e.stopPropagation();
22
- }, v = (e) => {
23
- const s = m.current;
24
- if (!s) return;
38
+ }, S = (e) => {
39
+ const t = z.current;
40
+ if (!t) return;
25
41
  const r = new DataTransfer();
26
- for (const t of e) r.items.add(t);
27
- s.files = r.files, i == null || i({
28
- target: s,
29
- currentTarget: s
42
+ for (const s of e) r.items.add(s);
43
+ t.files = r.files, d == null || d({
44
+ target: t,
45
+ currentTarget: t
30
46
  });
31
- }, z = (e) => {
47
+ }, $ = (e) => {
32
48
  const {
33
- validFiles: s,
49
+ validFiles: t,
34
50
  emptyFiles: r,
35
- oversizedFiles: t
36
- } = e.reduce((p, n) => (n.size === 0 ? p.emptyFiles.push(n) : F && n.size > F ? p.oversizedFiles.push(n) : p.validFiles.push(n), p), {
51
+ oversizedFiles: s
52
+ } = e.reduce((v, u) => (u.size === 0 ? v.emptyFiles.push(u) : j && u.size > j ? v.oversizedFiles.push(u) : v.validFiles.push(u), v), {
37
53
  validFiles: [],
38
54
  emptyFiles: [],
39
55
  oversizedFiles: []
40
56
  });
41
- return (r.length > 0 || t.length > 0) && (f == null || f(r, t)), s;
42
- }, h = (e) => {
43
- c(e), o(!1);
44
- const s = Array.from(e.dataTransfer.files ?? []), r = z(s);
57
+ return (r.length > 0 || s.length > 0) && (y == null || y(r, s)), t;
58
+ }, J = (e) => {
59
+ if (_(e), f.current = 0, g(!1), i) return;
60
+ const t = Array.from(e.dataTransfer.files ?? []), r = $(t);
45
61
  if (r.length === 0) return;
46
- const t = d ? r : r.slice(0, 1);
47
- v(t);
48
- }, I = (e) => {
49
- const s = Array.from(e.target.files ?? []), r = z(s);
50
- if (r.length === s.length) {
51
- i == null || i(e);
62
+ const s = h ? r : r.slice(0, 1);
63
+ S(s);
64
+ }, K = (e) => {
65
+ if (i) return;
66
+ const t = Array.from(e.target.files ?? []), r = $(t);
67
+ if (r.length === t.length) {
68
+ d == null || d(e);
52
69
  return;
53
70
  }
54
- const t = d ? r : r.slice(0, 1);
55
- v(t);
71
+ const s = h ? r : r.slice(0, 1);
72
+ S(s);
56
73
  };
57
- return /* @__PURE__ */ l("div", { className: x(u.dropzone, u[a], y && u.dragging), onDragEnter: (e) => {
58
- c(e), o(!0);
74
+ return /* @__PURE__ */ I("div", { className: Q(l.field, l[n], H && !i && l.dragging, P), role: "group", "aria-label": a ?? m, "data-disabled": i || void 0, "data-invalid": p || !!c || void 0, onDragEnter: (e) => {
75
+ var t, r;
76
+ _(e), !(i || !((r = (t = e.dataTransfer) == null ? void 0 : t.types) != null && r.includes("Files"))) && (f.current += 1, g(!0));
59
77
  }, onDragOver: (e) => {
60
- c(e), o(!0);
78
+ var t, r;
79
+ _(e), !(i || !((r = (t = e.dataTransfer) == null ? void 0 : t.types) != null && r.includes("Files"))) && (e.dataTransfer.dropEffect = "copy", g(!0));
61
80
  }, onDragLeave: (e) => {
62
- c(e), o(!1);
63
- }, onDrop: h, ..._, "data-component": "dropzone", children: /* @__PURE__ */ b("label", { children: [
64
- /* @__PURE__ */ l("input", { accept: D, "aria-label": g, hidden: !0, multiple: d, onChange: I, ref: m, type: "file" }),
65
- /* @__PURE__ */ l(A, { name: "UploadSimple", size: a === "minimal" ? "medium" : "large" }),
66
- /* @__PURE__ */ l("br", {}),
67
- a !== "minimal" && /* @__PURE__ */ l(k, { onClick: () => {
68
- var e;
69
- return (e = m.current) == null ? void 0 : e.click();
70
- }, type: "button", children: g })
71
- ] }) });
81
+ _(e), f.current = Math.max(0, f.current - 1), f.current === 0 && g(!1);
82
+ }, onDrop: J, "data-component": "dropzone", children: [
83
+ a && n !== "minimal" && /* @__PURE__ */ o("label", { htmlFor: E, children: /* @__PURE__ */ o(q, { label: a, description: x, descriptionId: R, required: B }) }),
84
+ /* @__PURE__ */ I("div", { children: [
85
+ /* @__PURE__ */ I("div", { className: l.dropzone, children: [
86
+ /* @__PURE__ */ o("input", { accept: O, "aria-label": a ?? m, "aria-describedby": k, "aria-invalid": p || !!c || void 0, disabled: i, hidden: !0, id: E, name: G, multiple: h, onInvalid: (e) => {
87
+ var t;
88
+ e.preventDefault(), (t = A.current) == null || t.focus();
89
+ }, onChange: K, ref: z, required: B, type: "file" }),
90
+ /* @__PURE__ */ o(Y, { "aria-label": n === "minimal" ? m : void 0, "aria-describedby": k, "aria-invalid": p || !!c || void 0, className: l.upload, disabled: i, icon: "UploadSimple", ref: A, onClick: () => {
91
+ var e;
92
+ return (e = z.current) == null ? void 0 : e.click();
93
+ }, size: "small", variant: n === "minimal" ? "tertiary" : "secondary", children: n !== "minimal" && m }),
94
+ n !== "minimal" && /* @__PURE__ */ o("span", { className: l.hint, children: U })
95
+ ] }),
96
+ D && /* @__PURE__ */ o(Z, { errorId: D, errorMessage: c })
97
+ ] }),
98
+ N && /* @__PURE__ */ o("div", { className: l.files, children: N })
99
+ ] });
72
100
  };
73
101
  export {
74
- P as Dropzone
102
+ de as Dropzone
75
103
  };
@@ -1 +1 @@
1
- "use strict";require('../../assets/index43.css');var be=Object.defineProperty;var Ie=(l,t,e)=>t in l?be(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var V=(l,t,e)=>Ie(l,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),fe=require("@lexical/html"),P=require("@lexical/link"),O=require("@lexical/list"),De=require("@lexical/react/LexicalAutoFocusPlugin"),Ce=require("@lexical/react/LexicalAutoLinkPlugin"),he=require("@lexical/react/LexicalComposerContext"),ye=require("@lexical/react/LexicalContentEditable"),Le=require("@lexical/react/LexicalErrorBoundary"),ke=require("@lexical/react/LexicalExtensionComposer"),ve=require("@lexical/react/LexicalHistoryPlugin"),we=require("@lexical/react/LexicalLinkPlugin"),Ne=require("@lexical/react/LexicalListPlugin"),Me=require("@lexical/react/LexicalOnChangePlugin"),Ae=require("@lexical/react/LexicalRichTextPlugin"),se=require("classix"),c=require("lexical"),s=require("react"),me=require("sanitize-html"),j=require("../button/index.cjs"),Se=require("../file/index.cjs"),R=require("../icon/index.cjs"),je=require("@lexical/utils"),_e=require("../../index-CHJNMNDr.cjs"),Re=require("../toolbar/index.cjs"),Te="_field_x93yd_3",Ee="_editor_x93yd_8",$e="_submit_x93yd_23",Pe="_resizable_x93yd_68",Oe="_resized_x93yd_72",Be="_invalid_x93yd_98",qe="_error_x93yd_102",Ue="_dragging_x93yd_108",ze="_content_x93yd_112",He="_embedded_x93yd_124",Fe="_files_x93yd_144",We="_placeholder_x93yd_154",Ke="_fill_x93yd_162",Ge="_meta_x93yd_194",Ye="_active_x93yd_203",Xe="_bold_x93yd_272",Ze="_italic_x93yd_276",Ve="_underline_x93yd_280",Je="_link_x93yd_284",Qe="_list_x93yd_290",et="_paragraph_x93yd_291",f={field:Te,editor:Ee,submit:$e,"image-resize-handle":"_image-resize-handle_x93yd_47","with-controls":"_with-controls_x93yd_53",resizable:Pe,resized:Oe,"resize-handle":"_resize-handle_x93yd_76",invalid:Be,error:qe,dragging:Ue,content:ze,embedded:He,"has-files":"_has-files_x93yd_140",files:Fe,placeholder:We,fill:Ke,"fill-editor":"_fill-editor_x93yd_170",meta:Ge,active:Ye,"inline-image":"_inline-image_x93yd_215",bold:Xe,italic:Ze,underline:Ve,link:Je,list:Qe,paragraph:et};function tt({alt:l="",editor:t,height:e,nodeKey:d,soliboDocumentId:p,soliboDocumentSlot:_,src:I,width:o}){const u=s.useRef(null),x=s.useRef(null),[A,L]=s.useState(),C=()=>{const a=t.getRootElement();if(!a)return 1/0;const m=getComputedStyle(a);return Math.max(1,a.clientWidth-(parseFloat(m.paddingLeft)||0)-(parseFloat(m.paddingRight)||0))},v=(a,m=C())=>Math.round(Math.min(m,Math.max(Math.min(32,m),a))),B=a=>{t.update(()=>{const m=c.$getNodeByKey(d);de(m)&&m.setWidth(a)}),L(void 0)};return i.jsxs("span",{className:f["inline-image"],contentEditable:!1,tabIndex:_?0:void 0,onKeyDown:a=>{!_||a.target!==a.currentTarget||!["Backspace","Delete"].includes(a.key)||(a.preventDefault(),a.stopPropagation(),t.update(()=>{const m=c.$getNodeByKey(d);if(!de(m))return;const D=m.getParent();c.$isParagraphNode(D)&&D.getChildrenSize()===1?D.remove():m.remove(),t.dispatchCommand(pe,_)}),t.focus())},"data-component":"editorimage",children:[i.jsx("img",{alt:l,"data-solibo-document-id":p,"data-solibo-document-slot":_,draggable:!1,height:A===void 0?e:void 0,ref:u,src:I,width:A??o,onClick:a=>{var m;a.preventDefault(),_&&((m=a.currentTarget.parentElement)==null||m.focus()),t.dispatchCommand(xe,{key:d,soliboDocumentSlot:_,src:I,width:o})}}),i.jsx("button",{type:"button","aria-label":`Resize image${l?`: ${l}`:""}`,title:"Drag to resize; use arrow keys to adjust width",className:f["image-resize-handle"],tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation()},onKeyDown:a=>{var D;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(a.key))return;a.preventDefault(),a.stopPropagation();const m=((D=u.current)==null?void 0:D.getBoundingClientRect().width)??o??32;B(v(m+(["ArrowRight","ArrowUp"].includes(a.key)?10:-10)))},onPointerDown:a=>{a.button!==0||!u.current||(a.preventDefault(),a.stopPropagation(),a.currentTarget.focus({preventScroll:!0}),a.currentTarget.setPointerCapture(a.pointerId),x.current={pointerId:a.pointerId,x:a.clientX,width:u.current.getBoundingClientRect().width,maximum:C()})},onPointerMove:a=>{const m=x.current;!m||m.pointerId!==a.pointerId||L(v(m.width+a.clientX-m.x,m.maximum))},onPointerUp:a=>{const m=x.current;!m||m.pointerId!==a.pointerId||(x.current=null,B(v(m.width+a.clientX-m.x,m.maximum)),a.currentTarget.releasePointerCapture(a.pointerId))},onPointerCancel:()=>{x.current=null,L(void 0)},onLostPointerCapture:()=>{x.current=null,L(void 0)}})]})}const pe=c.createCommand(),xe=c.createCommand();class oe extends c.DecoratorNode{constructor(e,d,p,_,I,o,u){super(I);V(this,"__src");V(this,"__alt");V(this,"__width");V(this,"__height");V(this,"__soliboDocumentId");V(this,"__soliboDocumentSlot");this.__src=e,this.__alt=d,this.__width=p,this.__height=_,this.__soliboDocumentId=o,this.__soliboDocumentSlot=u}static getType(){return"image"}static clone(e){return new oe(e.__src,e.__alt,e.__width,e.__height,e.__key,e.__soliboDocumentId,e.__soliboDocumentSlot)}static importJSON(e){return ue({alt:e.alt,height:e.height,soliboDocumentId:e.soliboDocumentId,soliboDocumentSlot:e.soliboDocumentSlot,src:e.src,width:e.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:e=>({conversion:d=>{if(!(d instanceof HTMLImageElement))return null;const p=d.getAttribute("src")??"";if(!p)return null;const _=d.getAttribute("width"),I=d.getAttribute("height");return{node:ue({alt:d.getAttribute("alt")??"",height:I?Number(I):void 0,soliboDocumentId:d.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:d.getAttribute("data-solibo-document-slot")??void 0,src:p,width:_?Number(_):void 0})}},priority:0})}}exportDOM(){const e=document.createElement("img");return this.__soliboDocumentSlot||e.setAttribute("src",this.__src),this.__soliboDocumentId&&e.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&e.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&e.setAttribute("alt",this.__alt),this.__width&&e.setAttribute("width",String(this.__width)),this.__height&&e.setAttribute("height",String(this.__height)),{element:e}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(e){const d=this.getWritable();return d.__src=e,d}setWidth(e){const d=this.getWritable();return d.__width=e,d.__height=void 0,d}decorate(e){return i.jsx(tt,{alt:this.__alt,editor:e,height:this.__height,nodeKey:this.getKey(),soliboDocumentId:this.__soliboDocumentId,soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})}}function ue({alt:l="",height:t,soliboDocumentId:e,soliboDocumentSlot:d,src:p,width:_}){return c.$applyNodeReplacement(new oe(p,l,_,t,void 0,e,d))}function de(l){return l instanceof oe}const rt=({createImages:l,onRemove:t})=>{const[e]=he.useLexicalComposerContext();return s.useEffect(()=>e.registerCommand(pe,d=>(t(d),!0),c.COMMAND_PRIORITY_HIGH),[e,t]),s.useEffect(()=>e.registerCommand(c.PASTE_COMMAND,d=>{var o;if(!("clipboardData"in d))return!1;const p=d,_=Array.from(((o=p.clipboardData)==null?void 0:o.items)??[]).flatMap(u=>{if(u.kind!=="file"||!u.type.startsWith("image/"))return[];const x=u.getAsFile();return x?[x]:[]});if(_.length===0)return!1;p.preventDefault();const I=l(_);return e.update(()=>{c.$insertNodes(I.map(u=>ue(u)))}),!0},c.COMMAND_PRIORITY_HIGH),[l,e]),null},it=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,nt=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,st=[l=>{const t=it.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:`mailto:${t[0]}`}:null},l=>{const t=nt.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:t[0].startsWith("http")?t[0]:`https://${t[0]}`}:null}];function ge(l){try{const t=new URL(l);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function ot({editableRef:l}){const t=s.useRef(null),[e,d]=s.useState(0),[p,_]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const u=()=>{d(Math.round(o.getBoundingClientRect().height)),_(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(u(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(u);return x.observe(o),()=>x.disconnect()},[l]);const I=o=>{const u=l.current;if(!u)return;const x=parseFloat(getComputedStyle(u).minHeight)||0;u.style.height=`${Math.max(x,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":p,"aria-valuenow":e,"aria-valuetext":`${e} pixels`,className:f["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const u=l.current;u&&(o.key==="Home"?(o.preventDefault(),u.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),I(u.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const u=l.current;o.button!==0||!u||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),t.current={pointerId:o.pointerId,y:o.clientY,height:u.getBoundingClientRect().height})},onPointerMove:o=>{!t.current||t.current.pointerId!==o.pointerId||I(t.current.height+t.current.y-o.clientY)},onPointerUp:o=>{!t.current||t.current.pointerId!==o.pointerId||(t.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{t.current=null},onPointerCancel:()=>{t.current=null},"data-component":"editorresizehandle"})}const at=({onFilesSelected:l,onInlineImageRemove:t})=>{const[e]=he.useLexicalComposerContext(),[d,p]=s.useState(!1),[_,I]=s.useState(!1),[o,u]=s.useState(!1),[x,A]=s.useState(!1),[L,C]=s.useState(!1),[v,B]=s.useState(!1),[a,m]=s.useState(""),[D,H]=s.useState(null),[q,F]=s.useState(null),[U,T]=s.useState(""),W=ge(U.trim()),re=s.useRef(null),J=s.useRef(null),ie=s.useRef(null),E=s.useRef(null),K=s.useRef(!1),Q=r=>r.preventDefault(),ee=s.useCallback(r=>{E.current=c.$isRangeSelection(r)?r.clone():null},[]),X=s.useCallback(r=>{e.update(()=>{E.current&&c.$setSelection(E.current),r()}),E.current=null},[e]),ae=r=>{K.current=!0,r.preventDefault()},Z=()=>{if(K.current){K.current=!1;return}k()},w=s.useCallback(()=>{I(!1),m(""),H(null),F(null)},[]),$=s.useCallback(()=>{C(!1),T("")},[]),le=s.useCallback(r=>{I(!0),m((r==null?void 0:r.src)??""),H((r==null?void 0:r.key)??null),F((r==null?void 0:r.soliboDocumentSlot)??null),$(),r!=null&&r.soliboDocumentSlot||setTimeout(()=>{var b;return(b=J.current)==null?void 0:b.focus()},0)},[$]),ce=s.useCallback(r=>{e.getEditorState().read(()=>{ee(c.$getSelection())}),C(!0),T(r),w(),setTimeout(()=>{var b;return(b=ie.current)==null?void 0:b.focus()},0)},[w,e,ee]),N=s.useCallback(()=>{const r=U.trim();ge(r)&&(X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:r,target:"_blank"});const b=c.$getSelection();if(!c.$isRangeSelection(b))return;const M=b.getNodes().at(-1)??null,z=(M==null?void 0:M.getParent())??null,y=P.$isLinkNode(M)?M:P.$isLinkNode(z)?z:null;if(y){const n=y.getLastChild();if(c.$isTextNode(n)){const S=n.getTextContent(),ne=S.replace(/\s+$/,"");ne!==S&&n.setTextContent(ne)}const h=y.getNextSibling();if(c.$isTextNode(h)&&/^\s/.test(h.getTextContent())){h.select(1,1);return}const g=c.$createTextNode(" ");y.insertAfter(g),g.selectEnd()}}),$())},[$,e,U,X]),k=s.useCallback(()=>{const r=a.trim();if(!r){w();return}e.update(()=>{if(D){const b=c.$getNodeByKey(D);de(b)&&b.setSrc(r);return}c.$insertNodes([ue({src:r})])}),w()},[w,e,D,a]),G=s.useCallback(()=>{if(!D){w();return}e.update(()=>{const r=c.$getNodeByKey(D);if(de(r)){const b=r.getParent();c.$isParagraphNode(b)&&b.getChildrenSize()===1?b.remove():r.remove(),q&&(t==null||t(q))}}),w()},[w,e,D,q,t]),te=s.useCallback(()=>{X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,null)}),$()},[$,e,X]),Y=s.useCallback(()=>{const r=c.$getSelection();if(!c.$isRangeSelection(r)){if(c.$isNodeSelection(r)){const z=r.getNodes(),y=z[0]??null,n=(y==null?void 0:y.getParent())??null;p(z.some(g=>c.$isTextNode(g)&&g.hasFormat("bold"))),u(z.some(g=>c.$isTextNode(g)&&g.hasFormat("italic"))),A(z.some(g=>c.$isTextNode(g)&&g.hasFormat("underline"))),B(O.$isListNode(n)||O.$isListItemNode(n)||O.$isListNode(y)||O.$isListItemNode(y));const h=P.$isLinkNode(y)?y:P.$isLinkNode(n)?n:null;if(h){C(!0),T(h.getURL());return}C(!1),T(""),E.current=null;return}p(!1),u(!1),A(!1),B(!1),C(!1),T(""),E.current=null;return}const[b]=r.getNodes(),M=(b==null?void 0:b.getParent())??null;if(p(r.hasFormat("bold")),u(r.hasFormat("italic")),A(r.hasFormat("underline")),B(O.$isListNode(M)||O.$isListItemNode(M)),P.$isLinkNode(M)){C(!0),T(M.getURL()),ee(r);return}C(!1),T(""),E.current=null},[ee]);return s.useEffect(()=>je.mergeRegister(e.registerUpdateListener(({editorState:r})=>{r.read(()=>{Y()})}),e.registerCommand(xe,r=>(r.soliboDocumentSlot?(w(),$()):le(r),!0),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(e.getEditorState().read(()=>{Y()}),!1),c.COMMAND_PRIORITY_LOW)),[w,$,e,le,Y]),i.jsxs(Re.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(j.Button,{"aria-label":"Bold","data-active":d,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextB"})}),i.jsx(j.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextItalic"})}),i.jsx(j.Button,{"aria-label":"Underline","data-active":x,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextUnderline"})}),i.jsx(j.Button,{"aria-label":"List","data-active":v,onClick:()=>{v?e.dispatchCommand(O.REMOVE_LIST_COMMAND,void 0):e.dispatchCommand(O.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx(R.Icon,{name:"ListBullets"})}),i.jsx(j.Button,{"aria-label":"Link","data-active":L,onClick:()=>{L?ce(U):(e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:"https://"}),ce("https://"))},title:"Link",variant:"tertiary",children:i.jsx(R.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:r=>{r.target.files&&l(r.target.files),r.target.value=""},ref:re,type:"file"}),i.jsx(j.Button,{"aria-label":"Upload files",onClick:()=>{var r;return(r=re.current)==null?void 0:r.click()},title:"Upload files",variant:"tertiary",children:i.jsx(R.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:se(f.meta,L||_?f.active:""),children:[L&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{"aria-invalid":!W,onBlur:()=>N(),onChange:r=>T(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),N())},ref:ie,value:U}),i.jsx(j.Button,{"aria-label":"Apply link",disabled:!W,onClick:()=>{N()},onMouseDown:Q,variant:"tertiary",children:i.jsx(R.Icon,{name:"Check"})}),i.jsx(j.Button,{"aria-label":"Remove link",onClick:()=>te(),onMouseDown:Q,variant:"tertiary",children:i.jsx(R.Icon,{name:"Trash",variant:"danger"})})]}),_&&i.jsxs(i.Fragment,{children:[!q&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{className:se(f.active),onBlur:Z,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),K.current=!0,k())},ref:J,value:a}),i.jsx(j.Button,{"aria-label":"Apply image",onClick:()=>k(),onMouseDown:ae,variant:"tertiary",children:i.jsx(R.Icon,{name:"Check"})})]}),i.jsx(j.Button,{"aria-label":"Remove image",onClick:()=>G(),onMouseDown:ae,variant:"tertiary",children:i.jsx(R.Icon,{name:"Trash",variant:"danger"})})]})]})]})},lt=c.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[P.AutoLinkNode,P.LinkNode,O.ListNode,O.ListItemNode,oe],onError(l){throw l},theme:{link:f.link,list:{ol:f.list,ul:f.list},paragraph:f.paragraph,text:{bold:f.bold,italic:f.italic,underline:f.underline}}});function ct({autofocus:l,content:t="",sessionKey:e,lastEmittedContentRef:d,imagePreviews:p}){const[_]=he.useLexicalComposerContext(),I=s.useRef(e);return s.useEffect(()=>{const o=I.current!==e;I.current=e,!(!o&&d.current===t)&&(_.update(()=>{const x=new DOMParser().parseFromString(t,"text/html");x.querySelectorAll("img[data-solibo-document-slot]").forEach(C=>{const v=p.get(C.getAttribute("data-solibo-document-slot"));v&&C.setAttribute("src",v)});const A=fe.$generateNodesFromDOM(_,x),L=c.$getRoot();L.clear().select(),c.$insertNodes(A),l||o?L.selectEnd():c.$setSelection(null)},{discrete:!0}),o&&_.dispatchCommand(c.CLEAR_HISTORY_COMMAND,void 0))},[l,t,_,p,d,e]),null}const ut=({autofocus:l=!1,attachmentsEnabled:t=!0,sessionKey:e,autolink:d=!1,content:p,controls:_,disabled:I=!1,errorMessage:o,fill:u=!1,files:x,inline:A=!1,inlineImages:L,invalid:C=!1,isSubmitting:v=!1,maxRows:B=12,minRows:a=1,onChange:m,onFilesChange:D,onInlineImagesChange:H,onSubmit:q,onUpload:F,placeholder:U,required:T=!1,resizable:W=!1,submitLabel:re="Submit",variant:J="default"})=>{const ie=s.useId(),E=s.useRef(void 0),K=s.useRef(!1),Q=s.useRef(null),[ee,X]=s.useState(!1),[ae,Z]=s.useState(!1),[w,$]=s.useState([]),[le,ce]=s.useState([]),N=s.useRef(new Map),k=x??w,G=L??le;s.useEffect(()=>{const n=Q.current;if(!n)return;if(!W||u){n.style.removeProperty("height"),X(!1);return}const h=()=>X(n.style.height!==""),g=new MutationObserver(h);return g.observe(n,{attributes:!0,attributeFilter:["style"]}),h(),()=>g.disconnect()},[u,W]);const te=n=>{x===void 0&&$(n),D==null||D(n)},Y=s.useCallback(n=>{L===void 0&&ce(n),H==null||H(n)},[L,H]),r=s.useCallback(n=>{const h=n.map(g=>{const S=`pasted-${crypto.randomUUID()}`,ne=URL.createObjectURL(g);return N.current.set(S,ne),{image:{alt:g.name,soliboDocumentSlot:S,src:ne},pending:{file:g,slot:S}}});return Y([...G,...h.map(({pending:g})=>g)]),h.map(({image:g})=>g)},[G,Y]),b=s.useCallback(n=>{Y(G.filter(g=>g.slot!==n));const h=N.current.get(n);h&&URL.revokeObjectURL(h),N.current.delete(n)},[G,Y]);s.useEffect(()=>()=>{N.current.forEach(n=>URL.revokeObjectURL(n)),N.current.clear()},[]),s.useEffect(()=>{const n=new Set(G.map(h=>h.slot));N.current.forEach((h,g)=>{n.has(g)||(URL.revokeObjectURL(h),N.current.delete(g))})},[G]);const M=n=>{if(typeof DataTransfer<"u"){const h=new DataTransfer;return n.forEach(g=>h.items.add(g)),h.files}return Object.assign([...n],{item:h=>n[h]??null})},z=async()=>{if(!(I||v||K.current)){K.current=!0;try{t&&k.length>0&&await(F==null?void 0:F(M(k))),await(q==null?void 0:q()),t&&k.length>0&&te([])}catch{return}finally{K.current=!1}}},y=n=>{n.preventDefault(),n.stopPropagation()};return i.jsxs("div",{className:se(f.field,u&&f.fill),"data-max-rows":B,"data-min-rows":a,onDragEnter:n=>{y(n),Z(t&&!!D)},onDragOver:n=>{y(n),Z(t&&!!D)},onDragLeave:n=>{y(n),Z(!1)},onDropCapture:n=>{var g;const h=(g=n.dataTransfer)==null?void 0:g.files;h!=null&&h.length&&(y(n),t&&(D||F)&&te([...k,...Array.from(h)]),Z(!1))},onDrop:n=>{n.preventDefault(),Z(!1)},"data-component":"editor",children:[W==="top"&&!u&&i.jsx(ot,{editableRef:Q}),i.jsx("div",{className:se(f.editor,!!_&&f["with-controls"],J==="embedded"&&f.embedded,u&&f["fill-editor"],W===!0&&!u&&f.resizable,W&&!u&&ee&&f.resized,C&&f.invalid,k.length>0&&f["has-files"]),style:{"--editor-max-height":`calc(${B*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${a*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(ke.LexicalExtensionComposer,{contentEditable:null,extension:lt,children:[!A&&J!=="embedded"&&i.jsx(at,{onInlineImageRemove:t?b:void 0,onFilesSelected:t&&(F||D)?n=>{te([...k,...Array.from(n)])}:void 0}),i.jsx("div",{className:se(f.content,ae&&f.dragging),children:i.jsx(Ae.RichTextPlugin,{contentEditable:i.jsx(ye.ContentEditable,{ref:Q,"aria-placeholder":U??"",ariaErrorMessage:C&&o?ie:void 0,ariaInvalid:C||void 0,ariaRequired:T||void 0,placeholder:()=>U?i.jsx("div",{className:f.placeholder,children:U}):null}),ErrorBoundary:Le.LexicalErrorBoundary})}),!A&&J!=="embedded"&&(_||q)&&i.jsx("div",{className:f.submit,children:_??i.jsx(j.Button,{"aria-label":re,"data-cy":"toolbar-submit-button",disabled:I,icon:"PaperPlaneTilt",isLoading:v,onClick:()=>void z(),variant:"primary",children:i.jsx("span",{children:re})})}),t&&k.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:f.files,role:"region",children:k.map((n,h)=>i.jsx(Se.File,{deleteAccessibleLabel:`Remove ${n.name} from upload queue`,name:n.name,onDelete:()=>te(k.filter((g,S)=>S!==h))},`${n.name}-${n.size}-${n.lastModified}-${h}`))}),l&&i.jsx(De.AutoFocusPlugin,{}),d&&i.jsx(Ce.AutoLinkPlugin,{matchers:st}),i.jsx(ve.HistoryPlugin,{}),t&&H&&i.jsx(rt,{createImages:r,onRemove:b}),p!==void 0&&i.jsx(ct,{autofocus:l,content:p,sessionKey:e,lastEmittedContentRef:E,imagePreviews:N.current}),i.jsx(we.LinkPlugin,{validateUrl:ge}),i.jsx(Ne.ListPlugin,{}),m&&i.jsx(Me.OnChangePlugin,{ignoreHistoryMergeTagChange:!1,onChange:(n,h)=>{n.read(()=>{const g=fe.$generateHtmlFromNodes(h,null),S=me(g,{allowedAttributes:{...me.defaults.allowedAttributes,img:[...me.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});E.current=S,m(S)})}})]})}),C&&o&&i.jsxs("div",{className:f.error,id:ie,children:[i.jsx(R.Icon,{name:"Warning",gap:"right",size:"small"}),o]})]})};exports.Editor=ut;
1
+ "use strict";require('../../assets/index43.css');var be=Object.defineProperty;var Ie=(l,t,e)=>t in l?be(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var V=(l,t,e)=>Ie(l,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),fe=require("@lexical/html"),P=require("@lexical/link"),O=require("@lexical/list"),De=require("@lexical/react/LexicalAutoFocusPlugin"),Ce=require("@lexical/react/LexicalAutoLinkPlugin"),he=require("@lexical/react/LexicalComposerContext"),ye=require("@lexical/react/LexicalContentEditable"),Le=require("@lexical/react/LexicalErrorBoundary"),ke=require("@lexical/react/LexicalExtensionComposer"),ve=require("@lexical/react/LexicalHistoryPlugin"),we=require("@lexical/react/LexicalLinkPlugin"),Ne=require("@lexical/react/LexicalListPlugin"),Me=require("@lexical/react/LexicalOnChangePlugin"),Ae=require("@lexical/react/LexicalRichTextPlugin"),se=require("classix"),c=require("lexical"),s=require("react"),me=require("sanitize-html"),j=require("../button/index.cjs"),Se=require("../file/index.cjs"),R=require("../icon/index.cjs"),je=require("@lexical/utils"),_e=require("../../index-DEQcFR32.cjs"),Re=require("../toolbar/index.cjs"),Te="_field_x93yd_3",Ee="_editor_x93yd_8",$e="_submit_x93yd_23",Pe="_resizable_x93yd_68",Oe="_resized_x93yd_72",Be="_invalid_x93yd_98",qe="_error_x93yd_102",Ue="_dragging_x93yd_108",ze="_content_x93yd_112",He="_embedded_x93yd_124",Fe="_files_x93yd_144",We="_placeholder_x93yd_154",Ke="_fill_x93yd_162",Ge="_meta_x93yd_194",Ye="_active_x93yd_203",Xe="_bold_x93yd_272",Ze="_italic_x93yd_276",Ve="_underline_x93yd_280",Je="_link_x93yd_284",Qe="_list_x93yd_290",et="_paragraph_x93yd_291",f={field:Te,editor:Ee,submit:$e,"image-resize-handle":"_image-resize-handle_x93yd_47","with-controls":"_with-controls_x93yd_53",resizable:Pe,resized:Oe,"resize-handle":"_resize-handle_x93yd_76",invalid:Be,error:qe,dragging:Ue,content:ze,embedded:He,"has-files":"_has-files_x93yd_140",files:Fe,placeholder:We,fill:Ke,"fill-editor":"_fill-editor_x93yd_170",meta:Ge,active:Ye,"inline-image":"_inline-image_x93yd_215",bold:Xe,italic:Ze,underline:Ve,link:Je,list:Qe,paragraph:et};function tt({alt:l="",editor:t,height:e,nodeKey:d,soliboDocumentId:p,soliboDocumentSlot:_,src:I,width:o}){const u=s.useRef(null),x=s.useRef(null),[A,L]=s.useState(),C=()=>{const a=t.getRootElement();if(!a)return 1/0;const m=getComputedStyle(a);return Math.max(1,a.clientWidth-(parseFloat(m.paddingLeft)||0)-(parseFloat(m.paddingRight)||0))},v=(a,m=C())=>Math.round(Math.min(m,Math.max(Math.min(32,m),a))),B=a=>{t.update(()=>{const m=c.$getNodeByKey(d);de(m)&&m.setWidth(a)}),L(void 0)};return i.jsxs("span",{className:f["inline-image"],contentEditable:!1,tabIndex:_?0:void 0,onKeyDown:a=>{!_||a.target!==a.currentTarget||!["Backspace","Delete"].includes(a.key)||(a.preventDefault(),a.stopPropagation(),t.update(()=>{const m=c.$getNodeByKey(d);if(!de(m))return;const D=m.getParent();c.$isParagraphNode(D)&&D.getChildrenSize()===1?D.remove():m.remove(),t.dispatchCommand(pe,_)}),t.focus())},"data-component":"editorimage",children:[i.jsx("img",{alt:l,"data-solibo-document-id":p,"data-solibo-document-slot":_,draggable:!1,height:A===void 0?e:void 0,ref:u,src:I,width:A??o,onClick:a=>{var m;a.preventDefault(),_&&((m=a.currentTarget.parentElement)==null||m.focus()),t.dispatchCommand(xe,{key:d,soliboDocumentSlot:_,src:I,width:o})}}),i.jsx("button",{type:"button","aria-label":`Resize image${l?`: ${l}`:""}`,title:"Drag to resize; use arrow keys to adjust width",className:f["image-resize-handle"],tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation()},onKeyDown:a=>{var D;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(a.key))return;a.preventDefault(),a.stopPropagation();const m=((D=u.current)==null?void 0:D.getBoundingClientRect().width)??o??32;B(v(m+(["ArrowRight","ArrowUp"].includes(a.key)?10:-10)))},onPointerDown:a=>{a.button!==0||!u.current||(a.preventDefault(),a.stopPropagation(),a.currentTarget.focus({preventScroll:!0}),a.currentTarget.setPointerCapture(a.pointerId),x.current={pointerId:a.pointerId,x:a.clientX,width:u.current.getBoundingClientRect().width,maximum:C()})},onPointerMove:a=>{const m=x.current;!m||m.pointerId!==a.pointerId||L(v(m.width+a.clientX-m.x,m.maximum))},onPointerUp:a=>{const m=x.current;!m||m.pointerId!==a.pointerId||(x.current=null,B(v(m.width+a.clientX-m.x,m.maximum)),a.currentTarget.releasePointerCapture(a.pointerId))},onPointerCancel:()=>{x.current=null,L(void 0)},onLostPointerCapture:()=>{x.current=null,L(void 0)}})]})}const pe=c.createCommand(),xe=c.createCommand();class oe extends c.DecoratorNode{constructor(e,d,p,_,I,o,u){super(I);V(this,"__src");V(this,"__alt");V(this,"__width");V(this,"__height");V(this,"__soliboDocumentId");V(this,"__soliboDocumentSlot");this.__src=e,this.__alt=d,this.__width=p,this.__height=_,this.__soliboDocumentId=o,this.__soliboDocumentSlot=u}static getType(){return"image"}static clone(e){return new oe(e.__src,e.__alt,e.__width,e.__height,e.__key,e.__soliboDocumentId,e.__soliboDocumentSlot)}static importJSON(e){return ue({alt:e.alt,height:e.height,soliboDocumentId:e.soliboDocumentId,soliboDocumentSlot:e.soliboDocumentSlot,src:e.src,width:e.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:e=>({conversion:d=>{if(!(d instanceof HTMLImageElement))return null;const p=d.getAttribute("src")??"";if(!p)return null;const _=d.getAttribute("width"),I=d.getAttribute("height");return{node:ue({alt:d.getAttribute("alt")??"",height:I?Number(I):void 0,soliboDocumentId:d.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:d.getAttribute("data-solibo-document-slot")??void 0,src:p,width:_?Number(_):void 0})}},priority:0})}}exportDOM(){const e=document.createElement("img");return this.__soliboDocumentSlot||e.setAttribute("src",this.__src),this.__soliboDocumentId&&e.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&e.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&e.setAttribute("alt",this.__alt),this.__width&&e.setAttribute("width",String(this.__width)),this.__height&&e.setAttribute("height",String(this.__height)),{element:e}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(e){const d=this.getWritable();return d.__src=e,d}setWidth(e){const d=this.getWritable();return d.__width=e,d.__height=void 0,d}decorate(e){return i.jsx(tt,{alt:this.__alt,editor:e,height:this.__height,nodeKey:this.getKey(),soliboDocumentId:this.__soliboDocumentId,soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})}}function ue({alt:l="",height:t,soliboDocumentId:e,soliboDocumentSlot:d,src:p,width:_}){return c.$applyNodeReplacement(new oe(p,l,_,t,void 0,e,d))}function de(l){return l instanceof oe}const rt=({createImages:l,onRemove:t})=>{const[e]=he.useLexicalComposerContext();return s.useEffect(()=>e.registerCommand(pe,d=>(t(d),!0),c.COMMAND_PRIORITY_HIGH),[e,t]),s.useEffect(()=>e.registerCommand(c.PASTE_COMMAND,d=>{var o;if(!("clipboardData"in d))return!1;const p=d,_=Array.from(((o=p.clipboardData)==null?void 0:o.items)??[]).flatMap(u=>{if(u.kind!=="file"||!u.type.startsWith("image/"))return[];const x=u.getAsFile();return x?[x]:[]});if(_.length===0)return!1;p.preventDefault();const I=l(_);return e.update(()=>{c.$insertNodes(I.map(u=>ue(u)))}),!0},c.COMMAND_PRIORITY_HIGH),[l,e]),null},it=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,nt=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,st=[l=>{const t=it.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:`mailto:${t[0]}`}:null},l=>{const t=nt.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:t[0].startsWith("http")?t[0]:`https://${t[0]}`}:null}];function ge(l){try{const t=new URL(l);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function ot({editableRef:l}){const t=s.useRef(null),[e,d]=s.useState(0),[p,_]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const u=()=>{d(Math.round(o.getBoundingClientRect().height)),_(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(u(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(u);return x.observe(o),()=>x.disconnect()},[l]);const I=o=>{const u=l.current;if(!u)return;const x=parseFloat(getComputedStyle(u).minHeight)||0;u.style.height=`${Math.max(x,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":p,"aria-valuenow":e,"aria-valuetext":`${e} pixels`,className:f["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const u=l.current;u&&(o.key==="Home"?(o.preventDefault(),u.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),I(u.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const u=l.current;o.button!==0||!u||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),t.current={pointerId:o.pointerId,y:o.clientY,height:u.getBoundingClientRect().height})},onPointerMove:o=>{!t.current||t.current.pointerId!==o.pointerId||I(t.current.height+t.current.y-o.clientY)},onPointerUp:o=>{!t.current||t.current.pointerId!==o.pointerId||(t.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{t.current=null},onPointerCancel:()=>{t.current=null},"data-component":"editorresizehandle"})}const at=({onFilesSelected:l,onInlineImageRemove:t})=>{const[e]=he.useLexicalComposerContext(),[d,p]=s.useState(!1),[_,I]=s.useState(!1),[o,u]=s.useState(!1),[x,A]=s.useState(!1),[L,C]=s.useState(!1),[v,B]=s.useState(!1),[a,m]=s.useState(""),[D,H]=s.useState(null),[q,F]=s.useState(null),[U,T]=s.useState(""),W=ge(U.trim()),re=s.useRef(null),J=s.useRef(null),ie=s.useRef(null),E=s.useRef(null),K=s.useRef(!1),Q=r=>r.preventDefault(),ee=s.useCallback(r=>{E.current=c.$isRangeSelection(r)?r.clone():null},[]),X=s.useCallback(r=>{e.update(()=>{E.current&&c.$setSelection(E.current),r()}),E.current=null},[e]),ae=r=>{K.current=!0,r.preventDefault()},Z=()=>{if(K.current){K.current=!1;return}k()},w=s.useCallback(()=>{I(!1),m(""),H(null),F(null)},[]),$=s.useCallback(()=>{C(!1),T("")},[]),le=s.useCallback(r=>{I(!0),m((r==null?void 0:r.src)??""),H((r==null?void 0:r.key)??null),F((r==null?void 0:r.soliboDocumentSlot)??null),$(),r!=null&&r.soliboDocumentSlot||setTimeout(()=>{var b;return(b=J.current)==null?void 0:b.focus()},0)},[$]),ce=s.useCallback(r=>{e.getEditorState().read(()=>{ee(c.$getSelection())}),C(!0),T(r),w(),setTimeout(()=>{var b;return(b=ie.current)==null?void 0:b.focus()},0)},[w,e,ee]),N=s.useCallback(()=>{const r=U.trim();ge(r)&&(X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:r,target:"_blank"});const b=c.$getSelection();if(!c.$isRangeSelection(b))return;const M=b.getNodes().at(-1)??null,z=(M==null?void 0:M.getParent())??null,y=P.$isLinkNode(M)?M:P.$isLinkNode(z)?z:null;if(y){const n=y.getLastChild();if(c.$isTextNode(n)){const S=n.getTextContent(),ne=S.replace(/\s+$/,"");ne!==S&&n.setTextContent(ne)}const h=y.getNextSibling();if(c.$isTextNode(h)&&/^\s/.test(h.getTextContent())){h.select(1,1);return}const g=c.$createTextNode(" ");y.insertAfter(g),g.selectEnd()}}),$())},[$,e,U,X]),k=s.useCallback(()=>{const r=a.trim();if(!r){w();return}e.update(()=>{if(D){const b=c.$getNodeByKey(D);de(b)&&b.setSrc(r);return}c.$insertNodes([ue({src:r})])}),w()},[w,e,D,a]),G=s.useCallback(()=>{if(!D){w();return}e.update(()=>{const r=c.$getNodeByKey(D);if(de(r)){const b=r.getParent();c.$isParagraphNode(b)&&b.getChildrenSize()===1?b.remove():r.remove(),q&&(t==null||t(q))}}),w()},[w,e,D,q,t]),te=s.useCallback(()=>{X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,null)}),$()},[$,e,X]),Y=s.useCallback(()=>{const r=c.$getSelection();if(!c.$isRangeSelection(r)){if(c.$isNodeSelection(r)){const z=r.getNodes(),y=z[0]??null,n=(y==null?void 0:y.getParent())??null;p(z.some(g=>c.$isTextNode(g)&&g.hasFormat("bold"))),u(z.some(g=>c.$isTextNode(g)&&g.hasFormat("italic"))),A(z.some(g=>c.$isTextNode(g)&&g.hasFormat("underline"))),B(O.$isListNode(n)||O.$isListItemNode(n)||O.$isListNode(y)||O.$isListItemNode(y));const h=P.$isLinkNode(y)?y:P.$isLinkNode(n)?n:null;if(h){C(!0),T(h.getURL());return}C(!1),T(""),E.current=null;return}p(!1),u(!1),A(!1),B(!1),C(!1),T(""),E.current=null;return}const[b]=r.getNodes(),M=(b==null?void 0:b.getParent())??null;if(p(r.hasFormat("bold")),u(r.hasFormat("italic")),A(r.hasFormat("underline")),B(O.$isListNode(M)||O.$isListItemNode(M)),P.$isLinkNode(M)){C(!0),T(M.getURL()),ee(r);return}C(!1),T(""),E.current=null},[ee]);return s.useEffect(()=>je.mergeRegister(e.registerUpdateListener(({editorState:r})=>{r.read(()=>{Y()})}),e.registerCommand(xe,r=>(r.soliboDocumentSlot?(w(),$()):le(r),!0),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(e.getEditorState().read(()=>{Y()}),!1),c.COMMAND_PRIORITY_LOW)),[w,$,e,le,Y]),i.jsxs(Re.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(j.Button,{"aria-label":"Bold","data-active":d,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextB"})}),i.jsx(j.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextItalic"})}),i.jsx(j.Button,{"aria-label":"Underline","data-active":x,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx(R.Icon,{name:"TextUnderline"})}),i.jsx(j.Button,{"aria-label":"List","data-active":v,onClick:()=>{v?e.dispatchCommand(O.REMOVE_LIST_COMMAND,void 0):e.dispatchCommand(O.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx(R.Icon,{name:"ListBullets"})}),i.jsx(j.Button,{"aria-label":"Link","data-active":L,onClick:()=>{L?ce(U):(e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:"https://"}),ce("https://"))},title:"Link",variant:"tertiary",children:i.jsx(R.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:r=>{r.target.files&&l(r.target.files),r.target.value=""},ref:re,type:"file"}),i.jsx(j.Button,{"aria-label":"Upload files",onClick:()=>{var r;return(r=re.current)==null?void 0:r.click()},title:"Upload files",variant:"tertiary",children:i.jsx(R.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:se(f.meta,L||_?f.active:""),children:[L&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{"aria-invalid":!W,onBlur:()=>N(),onChange:r=>T(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),N())},ref:ie,value:U}),i.jsx(j.Button,{"aria-label":"Apply link",disabled:!W,onClick:()=>{N()},onMouseDown:Q,variant:"tertiary",children:i.jsx(R.Icon,{name:"Check"})}),i.jsx(j.Button,{"aria-label":"Remove link",onClick:()=>te(),onMouseDown:Q,variant:"tertiary",children:i.jsx(R.Icon,{name:"Trash",variant:"danger"})})]}),_&&i.jsxs(i.Fragment,{children:[!q&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{className:se(f.active),onBlur:Z,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),K.current=!0,k())},ref:J,value:a}),i.jsx(j.Button,{"aria-label":"Apply image",onClick:()=>k(),onMouseDown:ae,variant:"tertiary",children:i.jsx(R.Icon,{name:"Check"})})]}),i.jsx(j.Button,{"aria-label":"Remove image",onClick:()=>G(),onMouseDown:ae,variant:"tertiary",children:i.jsx(R.Icon,{name:"Trash",variant:"danger"})})]})]})]})},lt=c.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[P.AutoLinkNode,P.LinkNode,O.ListNode,O.ListItemNode,oe],onError(l){throw l},theme:{link:f.link,list:{ol:f.list,ul:f.list},paragraph:f.paragraph,text:{bold:f.bold,italic:f.italic,underline:f.underline}}});function ct({autofocus:l,content:t="",sessionKey:e,lastEmittedContentRef:d,imagePreviews:p}){const[_]=he.useLexicalComposerContext(),I=s.useRef(e);return s.useEffect(()=>{const o=I.current!==e;I.current=e,!(!o&&d.current===t)&&(_.update(()=>{const x=new DOMParser().parseFromString(t,"text/html");x.querySelectorAll("img[data-solibo-document-slot]").forEach(C=>{const v=p.get(C.getAttribute("data-solibo-document-slot"));v&&C.setAttribute("src",v)});const A=fe.$generateNodesFromDOM(_,x),L=c.$getRoot();L.clear().select(),c.$insertNodes(A),l||o?L.selectEnd():c.$setSelection(null)},{discrete:!0}),o&&_.dispatchCommand(c.CLEAR_HISTORY_COMMAND,void 0))},[l,t,_,p,d,e]),null}const ut=({autofocus:l=!1,attachmentsEnabled:t=!0,sessionKey:e,autolink:d=!1,content:p,controls:_,disabled:I=!1,errorMessage:o,fill:u=!1,files:x,inline:A=!1,inlineImages:L,invalid:C=!1,isSubmitting:v=!1,maxRows:B=12,minRows:a=1,onChange:m,onFilesChange:D,onInlineImagesChange:H,onSubmit:q,onUpload:F,placeholder:U,required:T=!1,resizable:W=!1,submitLabel:re="Submit",variant:J="default"})=>{const ie=s.useId(),E=s.useRef(void 0),K=s.useRef(!1),Q=s.useRef(null),[ee,X]=s.useState(!1),[ae,Z]=s.useState(!1),[w,$]=s.useState([]),[le,ce]=s.useState([]),N=s.useRef(new Map),k=x??w,G=L??le;s.useEffect(()=>{const n=Q.current;if(!n)return;if(!W||u){n.style.removeProperty("height"),X(!1);return}const h=()=>X(n.style.height!==""),g=new MutationObserver(h);return g.observe(n,{attributes:!0,attributeFilter:["style"]}),h(),()=>g.disconnect()},[u,W]);const te=n=>{x===void 0&&$(n),D==null||D(n)},Y=s.useCallback(n=>{L===void 0&&ce(n),H==null||H(n)},[L,H]),r=s.useCallback(n=>{const h=n.map(g=>{const S=`pasted-${crypto.randomUUID()}`,ne=URL.createObjectURL(g);return N.current.set(S,ne),{image:{alt:g.name,soliboDocumentSlot:S,src:ne},pending:{file:g,slot:S}}});return Y([...G,...h.map(({pending:g})=>g)]),h.map(({image:g})=>g)},[G,Y]),b=s.useCallback(n=>{Y(G.filter(g=>g.slot!==n));const h=N.current.get(n);h&&URL.revokeObjectURL(h),N.current.delete(n)},[G,Y]);s.useEffect(()=>()=>{N.current.forEach(n=>URL.revokeObjectURL(n)),N.current.clear()},[]),s.useEffect(()=>{const n=new Set(G.map(h=>h.slot));N.current.forEach((h,g)=>{n.has(g)||(URL.revokeObjectURL(h),N.current.delete(g))})},[G]);const M=n=>{if(typeof DataTransfer<"u"){const h=new DataTransfer;return n.forEach(g=>h.items.add(g)),h.files}return Object.assign([...n],{item:h=>n[h]??null})},z=async()=>{if(!(I||v||K.current)){K.current=!0;try{t&&k.length>0&&await(F==null?void 0:F(M(k))),await(q==null?void 0:q()),t&&k.length>0&&te([])}catch{return}finally{K.current=!1}}},y=n=>{n.preventDefault(),n.stopPropagation()};return i.jsxs("div",{className:se(f.field,u&&f.fill),"data-max-rows":B,"data-min-rows":a,onDragEnter:n=>{y(n),Z(t&&!!D)},onDragOver:n=>{y(n),Z(t&&!!D)},onDragLeave:n=>{y(n),Z(!1)},onDropCapture:n=>{var g;const h=(g=n.dataTransfer)==null?void 0:g.files;h!=null&&h.length&&(y(n),t&&(D||F)&&te([...k,...Array.from(h)]),Z(!1))},onDrop:n=>{n.preventDefault(),Z(!1)},"data-component":"editor",children:[W==="top"&&!u&&i.jsx(ot,{editableRef:Q}),i.jsx("div",{className:se(f.editor,!!_&&f["with-controls"],J==="embedded"&&f.embedded,u&&f["fill-editor"],W===!0&&!u&&f.resizable,W&&!u&&ee&&f.resized,C&&f.invalid,k.length>0&&f["has-files"]),style:{"--editor-max-height":`calc(${B*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${a*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(ke.LexicalExtensionComposer,{contentEditable:null,extension:lt,children:[!A&&J!=="embedded"&&i.jsx(at,{onInlineImageRemove:t?b:void 0,onFilesSelected:t&&(F||D)?n=>{te([...k,...Array.from(n)])}:void 0}),i.jsx("div",{className:se(f.content,ae&&f.dragging),children:i.jsx(Ae.RichTextPlugin,{contentEditable:i.jsx(ye.ContentEditable,{ref:Q,"aria-placeholder":U??"",ariaErrorMessage:C&&o?ie:void 0,ariaInvalid:C||void 0,ariaRequired:T||void 0,placeholder:()=>U?i.jsx("div",{className:f.placeholder,children:U}):null}),ErrorBoundary:Le.LexicalErrorBoundary})}),!A&&J!=="embedded"&&(_||q)&&i.jsx("div",{className:f.submit,children:_??i.jsx(j.Button,{"aria-label":re,"data-cy":"toolbar-submit-button",disabled:I,icon:"PaperPlaneTilt",isLoading:v,onClick:()=>void z(),variant:"primary",children:i.jsx("span",{children:re})})}),t&&k.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:f.files,role:"region",children:k.map((n,h)=>i.jsx(Se.File,{deleteAccessibleLabel:`Remove ${n.name} from upload queue`,name:n.name,onDelete:()=>te(k.filter((g,S)=>S!==h))},`${n.name}-${n.size}-${n.lastModified}-${h}`))}),l&&i.jsx(De.AutoFocusPlugin,{}),d&&i.jsx(Ce.AutoLinkPlugin,{matchers:st}),i.jsx(ve.HistoryPlugin,{}),t&&H&&i.jsx(rt,{createImages:r,onRemove:b}),p!==void 0&&i.jsx(ct,{autofocus:l,content:p,sessionKey:e,lastEmittedContentRef:E,imagePreviews:N.current}),i.jsx(we.LinkPlugin,{validateUrl:ge}),i.jsx(Ne.ListPlugin,{}),m&&i.jsx(Me.OnChangePlugin,{ignoreHistoryMergeTagChange:!1,onChange:(n,h)=>{n.read(()=>{const g=fe.$generateHtmlFromNodes(h,null),S=me(g,{allowedAttributes:{...me.defaults.allowedAttributes,img:[...me.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});E.current=S,m(S)})}})]})}),C&&o&&i.jsxs("div",{className:f.error,id:ie,children:[i.jsx(R.Icon,{name:"Warning",gap:"right",size:"small"}),o]})]})};exports.Editor=ut;
@@ -24,7 +24,7 @@ import { Button as T } from "../button/index.js";
24
24
  import { File as de } from "../file/index.js";
25
25
  import { Icon as E } from "../icon/index.js";
26
26
  import { mergeRegister as me } from "@lexical/utils";
27
- import { I as Mt } from "../../index-Bre56YYa.js";
27
+ import { I as Mt } from "../../index-6TyCExT0.js";
28
28
  import { Toolbar as he } from "../toolbar/index.js";
29
29
  const ge = "_field_x93yd_3", fe = "_editor_x93yd_8", pe = "_submit_x93yd_23", _e = "_resizable_x93yd_68", be = "_resized_x93yd_72", De = "_invalid_x93yd_98", ve = "_error_x93yd_102", Ie = "_dragging_x93yd_108", ye = "_content_x93yd_112", we = "_embedded_x93yd_124", xe = "_files_x93yd_144", Ce = "_placeholder_x93yd_154", ke = "_fill_x93yd_162", Ae = "_meta_x93yd_194", Le = "_active_x93yd_203", Me = "_bold_x93yd_272", Ne = "_italic_x93yd_276", Se = "_underline_x93yd_280", Pe = "_link_x93yd_284", Te = "_list_x93yd_290", Ee = "_paragraph_x93yd_291", g = {
30
30
  field: ge,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("react");require("../form/index.cjs");require("../../icons-BIdcCH-v.cjs");require("../label/index.cjs");require("../../use-touched-Bq5Gjbpz.cjs");const e=require("../../index-CHJNMNDr.cjs");exports.Input=e.Input;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("react");require("../form/index.cjs");require("../../icons-BIdcCH-v.cjs");require("../label/index.cjs");require("../../use-touched-Bq5Gjbpz.cjs");const e=require("../../index-DEQcFR32.cjs");exports.Input=e.Input;
@@ -5,7 +5,7 @@ import "../form/index.js";
5
5
  import "../../icons-DVeBguFb.js";
6
6
  import "../label/index.js";
7
7
  import "../../use-touched-B999bBr8.js";
8
- import { I as f } from "../../index-Bre56YYa.js";
8
+ import { I as f } from "../../index-6TyCExT0.js";
9
9
  export {
10
10
  f as Input
11
11
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index54.css');const n=require("react/jsx-runtime"),c=require("classix"),a="_label_c06i2_1",r="_description_c06i2_5",o="_inline_c06i2_12",e={label:a,description:r,inline:o},d=({description:i,inline:l,label:s,required:t})=>n.jsxs("div",{className:c(l&&e.inline,e.label),"data-required":t?!0:void 0,"data-component":"label",children:[s,i&&n.jsx("span",{className:e.description,children:i})]});exports.Label=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index54.css');const e=require("react/jsx-runtime"),a=require("classix"),o="_label_bfjte_1",d="_description_bfjte_10",b="_inline_bfjte_18",n={label:o,description:d,inline:b},u=({description:i,descriptionId:l,inline:c,label:t,labelId:s,required:r})=>e.jsxs("div",{className:a(c&&n.inline,n.label),"data-required":r?!0:void 0,"data-component":"label",children:[s?e.jsx("span",{id:s,children:t}):t,i&&e.jsx("span",{className:n.description,id:l,children:i})]});exports.Label=u;
@@ -1,18 +1,20 @@
1
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
- import o from "classix";
3
- import '../../assets/index54.css';const a = "_label_c06i2_1", r = "_description_c06i2_5", d = "_inline_c06i2_12", e = {
4
- label: a,
5
- description: r,
6
- inline: d
7
- }, m = ({
1
+ import { jsxs as c, jsx as s } from "react/jsx-runtime";
2
+ import a from "classix";
3
+ import '../../assets/index54.css';const d = "_label_bfjte_1", p = "_description_bfjte_10", _ = "_inline_bfjte_18", e = {
4
+ label: d,
5
+ description: p,
6
+ inline: _
7
+ }, f = ({
8
8
  description: i,
9
- inline: n,
10
- label: l,
11
- required: s
12
- }) => /* @__PURE__ */ c("div", { className: o(n && e.inline, e.label), "data-required": s ? !0 : void 0, "data-component": "label", children: [
13
- l,
14
- i && /* @__PURE__ */ t("span", { className: e.description, children: i })
9
+ descriptionId: l,
10
+ inline: o,
11
+ label: n,
12
+ labelId: t,
13
+ required: r
14
+ }) => /* @__PURE__ */ c("div", { className: a(o && e.inline, e.label), "data-required": r ? !0 : void 0, "data-component": "label", children: [
15
+ t ? /* @__PURE__ */ s("span", { id: t, children: n }) : n,
16
+ i && /* @__PURE__ */ s("span", { className: e.description, id: l, children: i })
15
17
  ] });
16
18
  export {
17
- m as Label
19
+ f as Label
18
20
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const u=require("react/jsx-runtime"),H=require("classix"),r=require("react");function T(e){return r.isValidElement(e)&&e.type===r.Fragment}function O(e,n=[]){return r.Children.forEach(e,i=>{T(i)?O(i.props.children,n):n.push(i)}),n}function F(e,{wrapper:n="li"}={}){return O(e).filter(s=>s!==null).map((s,c)=>{if(r.isValidElement(s)&&s.type===n)return s;const m=r.isValidElement(s)&&s.key!=null?s.key:c;return r.createElement(n,{key:m,"data-component":"wrapchildren"},s)})}const V="_controls_uue68_1",A="_horizontal_uue68_9",I="_list_uue68_20",D="_columns_uue68_61",P="_masonry_uue68_71",$="_scrollable_uue68_81",G="_overflowing_uue68_88",J="_sized_uue68_111",K="_compact_uue68_123",l={controls:V,horizontal:A,list:I,columns:D,masonry:P,scrollable:$,overflowing:G,sized:J,compact:K},M=(e,n)=>{typeof e=="function"?e(n):e&&(e.current=n)};function Q({children:e,className:n,columns:i=1,columnWidth:b,compact:s=!1,controls:c,horizontal:m,layout:h="grid",maxVisibleItems:f,ordered:B,ref:p,style:S,...d}){const v=Number.isFinite(i)?Math.max(1,Math.floor(i)):1,y=r.useRef(null),[a,k]=r.useState(),o=h==="grid"&&v===1&&!m&&f!=null&&Number.isFinite(f)&&f>=1?Math.floor(f):void 0,w=!!o&&a!=null;r.useLayoutEffect(()=>{const t=y.current;if(!t||!o)return;const R=()=>{const g=Array.from(t.children).filter(j=>j instanceof HTMLElement&&getComputedStyle(j).display!=="none"),N=g[o-1],q=g.length>o&&N?N.getBoundingClientRect().bottom-t.getBoundingClientRect().top+t.scrollTop+(parseFloat(getComputedStyle(t).paddingBottom)||0):void 0;k(q)},_=new ResizeObserver(R),C=()=>{_.disconnect(),_.observe(t),Array.from(t.children).forEach(g=>_.observe(g)),R()},L=new MutationObserver(C);return L.observe(t,{childList:!0,subtree:!0,characterData:!0}),C(),()=>{_.disconnect(),L.disconnect()}},[e,o,w]);const x=H(n,l.list,h==="masonry"?l.masonry:v>1&&l.columns,!!o&&l.scrollable,w&&l.overflowing,m&&l.horizontal,s&&l.compact,b&&l.sized),z={...S,"--list-columns":v,"--list-column-width":b,"--list-max-height":o&&a!=null?`${a}px`:void 0},E=B?u.jsx("ol",{className:x,ref:t=>{y.current=t,M(p,t)},style:z,...d,tabIndex:d.tabIndex??(o&&a!=null?0:void 0),"data-component":"list",children:F(e)}):u.jsx("ul",{className:x,ref:t=>{y.current=t,M(p,t)},style:z,...d,tabIndex:d.tabIndex??(o&&a!=null?0:void 0),"data-component":"list",children:F(e)});return c==null?E:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:l.controls,"data-component":"list",children:c}),E]})}exports.List=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const m=require("react/jsx-runtime"),H=require("classix"),r=require("react");function T(e){return r.isValidElement(e)&&e.type===r.Fragment}function O(e,n=[]){return r.Children.forEach(e,i=>{T(i)?O(i.props.children,n):n.push(i)}),n}function F(e,{wrapper:n="li"}={}){return O(e).filter(o=>o!==null).map((o,c)=>{if(r.isValidElement(o)&&o.type===n)return o;const d=r.isValidElement(o)&&o.key!=null?o.key:c;return r.createElement(n,{key:d,"data-component":"wrapchildren"},o)})}const V="_controls_uue68_1",A="_horizontal_uue68_9",I="_list_uue68_20",D="_columns_uue68_61",P="_masonry_uue68_71",$="_scrollable_uue68_81",G="_overflowing_uue68_88",J="_sized_uue68_111",K="_compact_uue68_123",l={controls:V,horizontal:A,list:I,columns:D,masonry:P,scrollable:$,overflowing:G,sized:J,compact:K},M=(e,n)=>{typeof e=="function"?e(n):e&&(e.current=n)};function Q({children:e,className:n,columns:i=1,columnWidth:b,compact:o=!1,controls:c,horizontal:d,layout:f="grid",maxVisibleItems:_,ordered:B,ref:p,style:S,...y}){const a=Number.isFinite(i)?Math.max(1,Math.floor(i)):1,h=r.useRef(null),[u,k]=r.useState(),s=f==="grid"&&a===1&&!d&&_!=null&&Number.isFinite(_)&&_>=1?Math.floor(_):void 0,w=!!s&&u!=null;r.useLayoutEffect(()=>{const t=h.current;if(!t||!s)return;const R=()=>{const v=Array.from(t.children).filter(j=>j instanceof HTMLElement&&getComputedStyle(j).display!=="none"),N=v[s-1],q=v.length>s&&N?N.getBoundingClientRect().bottom-t.getBoundingClientRect().top+t.scrollTop+(parseFloat(getComputedStyle(t).paddingBottom)||0):void 0;k(q)},g=new ResizeObserver(R),C=()=>{g.disconnect(),g.observe(t),Array.from(t.children).forEach(v=>g.observe(v)),R()},L=new MutationObserver(C);return L.observe(t,{childList:!0,subtree:!0,characterData:!0}),C(),()=>{g.disconnect(),L.disconnect()}},[e,s,w]);const x=H(n,l.list,f==="masonry"?l.masonry:a>1&&l.columns,!!s&&l.scrollable,w&&l.overflowing,d&&l.horizontal,o&&l.compact,b&&l.sized),z={...S,"--list-columns":a,"--list-column-width":b,"--list-max-height":s&&u!=null?`${u}px`:void 0},E=B?m.jsx("ol",{className:x,ref:t=>{h.current=t,M(p,t)},style:z,...y,"data-layout":f==="masonry"?"masonry":a>1?"columns":void 0,tabIndex:y.tabIndex??(s&&u!=null?0:void 0),"data-component":"list",children:F(e)}):m.jsx("ul",{className:x,ref:t=>{h.current=t,M(p,t)},style:z,...y,"data-layout":f==="masonry"?"masonry":a>1?"columns":void 0,tabIndex:y.tabIndex??(s&&u!=null?0:void 0),"data-component":"list",children:F(e)});return c==null?E:m.jsxs(m.Fragment,{children:[m.jsx("div",{className:l.controls,"data-component":"list",children:c}),E]})}exports.List=Q;
@@ -15,9 +15,9 @@ function B(t, {
15
15
  return O(t).filter((o) => o !== null).map((o, c) => {
16
16
  if (i.isValidElement(o) && o.type === n)
17
17
  return o;
18
- const u = i.isValidElement(o) && o.key != null ? o.key : c;
18
+ const m = i.isValidElement(o) && o.key != null ? o.key : c;
19
19
  return i.createElement(n, {
20
- key: u,
20
+ key: m,
21
21
  "data-component": "wrapchildren"
22
22
  }, o);
23
23
  });
@@ -42,42 +42,42 @@ function nt({
42
42
  columnWidth: g,
43
43
  compact: o = !1,
44
44
  controls: c,
45
- horizontal: u,
46
- layout: h = "grid",
47
- maxVisibleItems: m,
45
+ horizontal: m,
46
+ layout: f = "grid",
47
+ maxVisibleItems: d,
48
48
  ordered: k,
49
- ref: y,
49
+ ref: h,
50
50
  style: H,
51
- ...f
51
+ ..._
52
52
  }) {
53
- const p = Number.isFinite(r) ? Math.max(1, Math.floor(r)) : 1, v = T(null), [a, S] = D(), s = h === "grid" && p === 1 && !u && m != null && Number.isFinite(m) && m >= 1 ? Math.floor(m) : void 0, w = !!s && a != null;
53
+ const a = Number.isFinite(r) ? Math.max(1, Math.floor(r)) : 1, p = T(null), [u, S] = D(), s = f === "grid" && a === 1 && !m && d != null && Number.isFinite(d) && d >= 1 ? Math.floor(d) : void 0, w = !!s && u != null;
54
54
  $(() => {
55
- const e = v.current;
55
+ const e = p.current;
56
56
  if (!e || !s) return;
57
57
  const C = () => {
58
- const _ = Array.from(e.children).filter((L) => L instanceof HTMLElement && getComputedStyle(L).display !== "none"), F = _[s - 1], V = _.length > s && F ? F.getBoundingClientRect().bottom - e.getBoundingClientRect().top + e.scrollTop + (parseFloat(getComputedStyle(e).paddingBottom) || 0) : void 0;
58
+ const y = Array.from(e.children).filter((L) => L instanceof HTMLElement && getComputedStyle(L).display !== "none"), F = y[s - 1], V = y.length > s && F ? F.getBoundingClientRect().bottom - e.getBoundingClientRect().top + e.scrollTop + (parseFloat(getComputedStyle(e).paddingBottom) || 0) : void 0;
59
59
  S(V);
60
- }, d = new ResizeObserver(C), N = () => {
61
- d.disconnect(), d.observe(e), Array.from(e.children).forEach((_) => d.observe(_)), C();
60
+ }, v = new ResizeObserver(C), N = () => {
61
+ v.disconnect(), v.observe(e), Array.from(e.children).forEach((y) => v.observe(y)), C();
62
62
  }, R = new MutationObserver(N);
63
63
  return R.observe(e, {
64
64
  childList: !0,
65
65
  subtree: !0,
66
66
  characterData: !0
67
67
  }), N(), () => {
68
- d.disconnect(), R.disconnect();
68
+ v.disconnect(), R.disconnect();
69
69
  };
70
70
  }, [t, s, w]);
71
- const z = I(n, l.list, h === "masonry" ? l.masonry : p > 1 && l.columns, !!s && l.scrollable, w && l.overflowing, u && l.horizontal, o && l.compact, g && l.sized), E = {
71
+ const z = I(n, l.list, f === "masonry" ? l.masonry : a > 1 && l.columns, !!s && l.scrollable, w && l.overflowing, m && l.horizontal, o && l.compact, g && l.sized), E = {
72
72
  ...H,
73
- "--list-columns": p,
73
+ "--list-columns": a,
74
74
  "--list-column-width": g,
75
- "--list-max-height": s && a != null ? `${a}px` : void 0
75
+ "--list-max-height": s && u != null ? `${u}px` : void 0
76
76
  }, x = k ? /* @__PURE__ */ b("ol", { className: z, ref: (e) => {
77
- v.current = e, M(y, e);
78
- }, style: E, ...f, tabIndex: f.tabIndex ?? (s && a != null ? 0 : void 0), "data-component": "list", children: B(t) }) : /* @__PURE__ */ b("ul", { className: z, ref: (e) => {
79
- v.current = e, M(y, e);
80
- }, style: E, ...f, tabIndex: f.tabIndex ?? (s && a != null ? 0 : void 0), "data-component": "list", children: B(t) });
77
+ p.current = e, M(h, e);
78
+ }, style: E, ..._, "data-layout": f === "masonry" ? "masonry" : a > 1 ? "columns" : void 0, tabIndex: _.tabIndex ?? (s && u != null ? 0 : void 0), "data-component": "list", children: B(t) }) : /* @__PURE__ */ b("ul", { className: z, ref: (e) => {
79
+ p.current = e, M(h, e);
80
+ }, style: E, ..._, "data-layout": f === "masonry" ? "masonry" : a > 1 ? "columns" : void 0, tabIndex: _.tabIndex ?? (s && u != null ? 0 : void 0), "data-component": "list", children: B(t) });
81
81
  return c == null ? x : /* @__PURE__ */ j(A, { children: [
82
82
  /* @__PURE__ */ b("div", { className: l.controls, "data-component": "list", children: c }),
83
83
  x
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index13.css');const t=require("react/jsx-runtime"),y=require("classix"),w=require("../loading/index.cjs"),f="_layout_5pc8a_1",h="_constrained_5pc8a_7",m="_reading_5pc8a_12",b="_loading_5pc8a_40",a={layout:f,constrained:h,reading:m,"with-sidebar":"_with-sidebar_5pc8a_24","fill-viewport":"_fill-viewport_5pc8a_34",loading:b,"loading-content":"_loading-content_5pc8a_48","without-padding":"_without-padding_5pc8a_87"},v=({"aria-busy":l,children:s,className:d,contentLayout:n="default",contentMaxWidth:i,fillViewport:c=!1,loading:e=!1,loadingLabel:r="Loading",padding:_="default",sidebar:o,style:u,...g})=>{const p={...u,"--page-content-max-width":i};return t.jsxs("main",{"aria-busy":l??(e||void 0),className:y(a.layout,!!o&&a["with-sidebar"],c&&a["fill-viewport"],i&&n==="default"&&a.constrained,n==="reading"&&a.reading,_==="none"&&a["without-padding"],e&&a.loading,d),style:p,...g,"data-component":"pagelayout",children:[o,e?t.jsx("div",{className:a["loading-content"],role:"status","aria-label":r,children:t.jsx(w.Loading,{size:"large"})}):s]})};exports.PageLayout=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index13.css');const e=require("react/jsx-runtime"),p=require("classix"),w=require("../loading/index.cjs"),f="_layout_19g9t_1",h="_constrained_19g9t_7",m="_reading_19g9t_12",b="_loading_19g9t_40",t={layout:f,constrained:h,reading:m,"with-sidebar":"_with-sidebar_19g9t_24","fill-viewport":"_fill-viewport_19g9t_34",loading:b,"loading-content":"_loading-content_19g9t_48","without-padding":"_without-padding_19g9t_100"},v=({"aria-busy":l,children:s,className:d,contentLayout:n="default",contentMaxWidth:i,fillViewport:r=!1,loading:a=!1,loadingLabel:g="Loading",padding:_="default",sidebar:o,style:c,...u})=>{const y={...c,"--page-content-max-width":i};return e.jsxs("main",{"aria-busy":l??(a||void 0),className:p(t.layout,!!o&&t["with-sidebar"],r&&t["fill-viewport"],i&&n==="default"&&t.constrained,n==="reading"&&t.reading,_==="none"&&t["without-padding"],a&&t.loading,d),style:y,...u,"data-component":"pagelayout",children:[o,a?e.jsx("div",{className:t["loading-content"],role:"status","aria-label":g,children:e.jsx(w.Loading,{size:"large"})}):s]})};exports.PageLayout=v;
@@ -1,15 +1,15 @@
1
1
  import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
2
  import m from "classix";
3
3
  import { Loading as y } from "../loading/index.js";
4
- import '../../assets/index13.css';const w = "_layout_5pc8a_1", h = "_constrained_5pc8a_7", b = "_reading_5pc8a_12", v = "_loading_5pc8a_40", a = {
4
+ import '../../assets/index13.css';const w = "_layout_19g9t_1", h = "_constrained_19g9t_7", b = "_reading_19g9t_12", v = "_loading_19g9t_40", t = {
5
5
  layout: w,
6
6
  constrained: h,
7
7
  reading: b,
8
- "with-sidebar": "_with-sidebar_5pc8a_24",
9
- "fill-viewport": "_fill-viewport_5pc8a_34",
8
+ "with-sidebar": "_with-sidebar_19g9t_24",
9
+ "fill-viewport": "_fill-viewport_19g9t_34",
10
10
  loading: v,
11
- "loading-content": "_loading-content_5pc8a_48",
12
- "without-padding": "_without-padding_5pc8a_87"
11
+ "loading-content": "_loading-content_19g9t_48",
12
+ "without-padding": "_without-padding_19g9t_100"
13
13
  }, N = ({
14
14
  "aria-busy": l,
15
15
  children: d,
@@ -17,20 +17,20 @@ import '../../assets/index13.css';const w = "_layout_5pc8a_1", h = "_constrained
17
17
  contentLayout: o = "default",
18
18
  contentMaxWidth: i,
19
19
  fillViewport: s = !1,
20
- loading: t = !1,
21
- loadingLabel: c = "Loading",
20
+ loading: a = !1,
21
+ loadingLabel: g = "Loading",
22
22
  padding: _ = "default",
23
23
  sidebar: n,
24
- style: p,
25
- ...g
24
+ style: c,
25
+ ...u
26
26
  }) => {
27
- const u = {
28
- ...p,
27
+ const p = {
28
+ ...c,
29
29
  "--page-content-max-width": i
30
30
  };
31
- return /* @__PURE__ */ f("main", { "aria-busy": l ?? (t || void 0), className: m(a.layout, !!n && a["with-sidebar"], s && a["fill-viewport"], i && o === "default" && a.constrained, o === "reading" && a.reading, _ === "none" && a["without-padding"], t && a.loading, r), style: u, ...g, "data-component": "pagelayout", children: [
31
+ return /* @__PURE__ */ f("main", { "aria-busy": l ?? (a || void 0), className: m(t.layout, !!n && t["with-sidebar"], s && t["fill-viewport"], i && o === "default" && t.constrained, o === "reading" && t.reading, _ === "none" && t["without-padding"], a && t.loading, r), style: p, ...u, "data-component": "pagelayout", children: [
32
32
  n,
33
- t ? /* @__PURE__ */ e("div", { className: a["loading-content"], role: "status", "aria-label": c, children: /* @__PURE__ */ e(y, { size: "large" }) }) : d
33
+ a ? /* @__PURE__ */ e("div", { className: t["loading-content"], role: "status", "aria-label": g, children: /* @__PURE__ */ e(y, { size: "large" }) }) : d
34
34
  ] });
35
35
  };
36
36
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index10.css');const e=require("react/jsx-runtime"),x=require("classix"),j=require("react"),y=require("../form/index.cjs"),v=require("../label/index.cjs"),s=require("../../use-touched-Bq5Gjbpz.cjs"),g="_label_14rhg_3",q="_radio_14rhg_21",B="_touched_14rhg_38",n={label:g,radio:q,touched:B},f=({className:a,description:l,errorMessage:t,invalid:c=!1,label:i,onBlur:u,required:d,...o})=>{const b=j.useId(),{touched:h,onBlur:_}=s.useTouched(o.checked),r=c&&t?b:void 0,m=[o["aria-describedby"],r].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{"data-component":"radio",children:[e.jsxs("label",{className:n.label,children:[e.jsx("input",{...o,type:"radio",className:x(n.radio,a,h&&n.touched),"aria-describedby":m,"aria-invalid":c?!0:o["aria-invalid"],onBlur:s.composeEventHandlers(_,u),required:d}),i&&e.jsx(v.Label,{description:l,inline:!0,label:i,required:d})]}),r&&e.jsx(y.FieldError,{errorId:r,errorMessage:t})]})};exports.Radio=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index10.css');const e=require("react/jsx-runtime"),x=require("classix"),j=require("react"),y=require("../form/index.cjs"),v=require("../label/index.cjs"),s=require("../../use-touched-Bq5Gjbpz.cjs"),q="_label_7o1p1_3",B="_radio_7o1p1_18",f="_touched_7o1p1_35",n={label:q,radio:B,touched:f},p=({className:a,description:l,errorMessage:t,invalid:c=!1,label:i,onBlur:u,required:d,...o})=>{const b=j.useId(),{touched:_,onBlur:h}=s.useTouched(o.checked),r=c&&t?b:void 0,m=[o["aria-describedby"],r].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{"data-component":"radio",children:[e.jsxs("label",{className:n.label,children:[e.jsx("input",{...o,type:"radio",className:x(n.radio,a,_&&n.touched),"aria-describedby":m,"aria-invalid":c?!0:o["aria-invalid"],onBlur:s.composeEventHandlers(h,u),required:d}),i&&e.jsx(v.Label,{description:l,inline:!0,label:i,required:d})]}),r&&e.jsx(y.FieldError,{errorId:r,errorMessage:t})]})};exports.Radio=p;
@@ -1,14 +1,14 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
2
  import f from "classix";
3
3
  import { useId as p } from "react";
4
4
  import { FieldError as v } from "../form/index.js";
5
5
  import { Label as y } from "../label/index.js";
6
6
  import { u as B, c as x } from "../../use-touched-B999bBr8.js";
7
- import '../../assets/index10.css';const g = "_label_14rhg_3", j = "_radio_14rhg_21", E = "_touched_14rhg_38", a = {
8
- label: g,
9
- radio: j,
10
- touched: E
11
- }, R = ({
7
+ import '../../assets/index10.css';const j = "_label_7o1p1_3", E = "_radio_7o1p1_18", I = "_touched_7o1p1_35", a = {
8
+ label: j,
9
+ radio: E,
10
+ touched: I
11
+ }, T = ({
12
12
  className: l,
13
13
  description: s,
14
14
  errorMessage: d,
@@ -19,17 +19,17 @@ import '../../assets/index10.css';const g = "_label_14rhg_3", j = "_radio_14rhg_
19
19
  ...o
20
20
  }) => {
21
21
  const u = p(), {
22
- touched: h,
23
- onBlur: b
24
- } = B(o.checked), r = i && d ? u : void 0, _ = [o["aria-describedby"], r].filter(Boolean).join(" ") || void 0;
22
+ touched: b,
23
+ onBlur: h
24
+ } = B(o.checked), e = i && d ? u : void 0, _ = [o["aria-describedby"], e].filter(Boolean).join(" ") || void 0;
25
25
  return /* @__PURE__ */ n("div", { "data-component": "radio", children: [
26
26
  /* @__PURE__ */ n("label", { className: a.label, children: [
27
- /* @__PURE__ */ e("input", { ...o, type: "radio", className: f(a.radio, l, h && a.touched), "aria-describedby": _, "aria-invalid": i ? !0 : o["aria-invalid"], onBlur: x(b, m), required: c }),
28
- t && /* @__PURE__ */ e(y, { description: s, inline: !0, label: t, required: c })
27
+ /* @__PURE__ */ r("input", { ...o, type: "radio", className: f(a.radio, l, b && a.touched), "aria-describedby": _, "aria-invalid": i ? !0 : o["aria-invalid"], onBlur: x(h, m), required: c }),
28
+ t && /* @__PURE__ */ r(y, { description: s, inline: !0, label: t, required: c })
29
29
  ] }),
30
- r && /* @__PURE__ */ e(v, { errorId: r, errorMessage: d })
30
+ e && /* @__PURE__ */ r(v, { errorId: e, errorMessage: d })
31
31
  ] });
32
32
  };
33
33
  export {
34
- R as Radio
34
+ T as Radio
35
35
  };