@solibo/solibo-ui 2.2.15 → 2.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +50 -50
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +24 -23
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +200 -190
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +84 -56
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/label/index.cjs +1 -1
- package/dist/components/label/index.js +16 -14
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +20 -20
- package/dist/components/page-layout/index.cjs +1 -1
- package/dist/components/page-layout/index.js +13 -13
- package/dist/components/radio/index.cjs +1 -1
- package/dist/components/radio/index.js +13 -13
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +1 -1
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +39 -32
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +10 -10
- package/dist/index-6TyCExT0.js +87 -0
- package/dist/index-DEQcFR32.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +31 -8
- package/dist/index.js +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/index-Bre56YYa.js +0 -90
- package/dist/index-CHJNMNDr.cjs +0 -1
|
@@ -1,75 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { useRef as T, useState as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
-
},
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
38
|
+
}, S = (e) => {
|
|
39
|
+
const t = z.current;
|
|
40
|
+
if (!t) return;
|
|
25
41
|
const r = new DataTransfer();
|
|
26
|
-
for (const
|
|
27
|
-
|
|
28
|
-
target:
|
|
29
|
-
currentTarget:
|
|
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
|
-
},
|
|
47
|
+
}, $ = (e) => {
|
|
32
48
|
const {
|
|
33
|
-
validFiles:
|
|
49
|
+
validFiles: t,
|
|
34
50
|
emptyFiles: r,
|
|
35
|
-
oversizedFiles:
|
|
36
|
-
} = e.reduce((
|
|
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 ||
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
const
|
|
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
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
55
|
-
|
|
71
|
+
const s = h ? r : r.slice(0, 1);
|
|
72
|
+
S(s);
|
|
56
73
|
};
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
}, onDrop:
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import '../../assets/index54.css';const
|
|
4
|
-
label:
|
|
5
|
-
description:
|
|
6
|
-
inline:
|
|
7
|
-
},
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
+
f as Label
|
|
18
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const
|
|
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
|
|
18
|
+
const m = i.isValidElement(o) && o.key != null ? o.key : c;
|
|
19
19
|
return i.createElement(n, {
|
|
20
|
-
key:
|
|
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:
|
|
46
|
-
layout:
|
|
47
|
-
maxVisibleItems:
|
|
45
|
+
horizontal: m,
|
|
46
|
+
layout: f = "grid",
|
|
47
|
+
maxVisibleItems: d,
|
|
48
48
|
ordered: k,
|
|
49
|
-
ref:
|
|
49
|
+
ref: h,
|
|
50
50
|
style: H,
|
|
51
|
-
...
|
|
51
|
+
..._
|
|
52
52
|
}) {
|
|
53
|
-
const
|
|
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 =
|
|
55
|
+
const e = p.current;
|
|
56
56
|
if (!e || !s) return;
|
|
57
57
|
const C = () => {
|
|
58
|
-
const
|
|
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
|
-
},
|
|
61
|
-
|
|
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
|
-
|
|
68
|
+
v.disconnect(), R.disconnect();
|
|
69
69
|
};
|
|
70
70
|
}, [t, s, w]);
|
|
71
|
-
const z = I(n, l.list,
|
|
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":
|
|
73
|
+
"--list-columns": a,
|
|
74
74
|
"--list-column-width": g,
|
|
75
|
-
"--list-max-height": s &&
|
|
75
|
+
"--list-max-height": s && u != null ? `${u}px` : void 0
|
|
76
76
|
}, x = k ? /* @__PURE__ */ b("ol", { className: z, ref: (e) => {
|
|
77
|
-
|
|
78
|
-
}, style: E, ...f, tabIndex:
|
|
79
|
-
|
|
80
|
-
}, style: E, ...f, tabIndex:
|
|
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
|
|
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 = "
|
|
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-
|
|
9
|
-
"fill-viewport": "_fill-
|
|
8
|
+
"with-sidebar": "_with-sidebar_19g9t_24",
|
|
9
|
+
"fill-viewport": "_fill-viewport_19g9t_34",
|
|
10
10
|
loading: v,
|
|
11
|
-
"loading-content": "_loading-
|
|
12
|
-
"without-padding": "_without-
|
|
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:
|
|
21
|
-
loadingLabel:
|
|
20
|
+
loading: a = !1,
|
|
21
|
+
loadingLabel: g = "Loading",
|
|
22
22
|
padding: _ = "default",
|
|
23
23
|
sidebar: n,
|
|
24
|
-
style:
|
|
25
|
-
...
|
|
24
|
+
style: c,
|
|
25
|
+
...u
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
...
|
|
27
|
+
const p = {
|
|
28
|
+
...c,
|
|
29
29
|
"--page-content-max-width": i
|
|
30
30
|
};
|
|
31
|
-
return /* @__PURE__ */ f("main", { "aria-busy": l ?? (
|
|
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
|
-
|
|
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"),
|
|
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
|
|
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
|
|
8
|
-
label:
|
|
9
|
-
radio:
|
|
10
|
-
touched:
|
|
11
|
-
},
|
|
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:
|
|
23
|
-
onBlur:
|
|
24
|
-
} = B(o.checked),
|
|
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__ */
|
|
28
|
-
t && /* @__PURE__ */
|
|
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
|
-
|
|
30
|
+
e && /* @__PURE__ */ r(v, { errorId: e, errorMessage: d })
|
|
31
31
|
] });
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
T as Radio
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),m=require("react"),b=require("../button/index.cjs"),I=require("../checkbox/index.cjs"),T=require("../chip/index.cjs"),H=require("../collapsible/index.cjs"),P=require("../../index-BwfsmdF6.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),m=require("react"),b=require("../button/index.cjs"),I=require("../checkbox/index.cjs"),T=require("../chip/index.cjs"),H=require("../collapsible/index.cjs"),P=require("../../index-BwfsmdF6.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-DEQcFR32.cjs"),J="_search_wsuwb_3",K="_controls_wsuwb_15",Q="_chips_wsuwb_35",S="_radio_wsuwb_101",l={search:J,controls:K,chips:Q,"filter-dialog":"_filter-dialog_wsuwb_42","filter-groups":"_filter-groups_wsuwb_47","filter-group":"_filter-group_wsuwb_47","filter-option":"_filter-option_wsuwb_83","option-copy":"_option-copy_wsuwb_89",radio:S,"collapsible-options":"_collapsible-options_wsuwb_124"},U=({filterButtonLabel:x="Filters",filterDialogColumns:f=1,filterDialogTitle:k="Filters",filterGroups:d=[],onChange:q,onSelectedFiltersChange:i,removeFilterLabel:M=c=>`Remove ${c.label} filter`,resetLabel:u="Reset",searchLabel:$="Search",searchPlaceholder:O="Search",selectedFilters:t=[],showResultsLabel:B="Show results",value:D=""})=>{const c=m.useId(),[j,r]=m.useState(!1),R=m.useMemo(()=>new Map(d.flatMap(s=>{var n;return[...s.options,...((n=s.collapsible)==null?void 0:n.options)??[]]}).map(s=>[s.value,s])),[d]),h=t.flatMap(s=>{const n=R.get(s);return n?[n]:[]}),p=(s,n,e)=>{var N;if(!i)return;const _=new Set([...(e==null?void 0:e.options.map(o=>o.value))??[],...((N=e==null?void 0:e.collapsible)==null?void 0:N.options.map(o=>o.value))??[]]),y=t.filter(o=>!_.has(o));if(n&&(e==null?void 0:e.defaultValue)===s){i(y);return}i(n?(e==null?void 0:e.control)==="radio"||(e==null?void 0:e.selectionMode)==="single"?[...y,s]:[...new Set([...t,s])]:t.filter(o=>o!==s))},v=(s,n)=>{var e;return t.includes(s)||n.defaultValue===s&&![...n.options,...((e=n.collapsible)==null?void 0:e.options)??[]].some(_=>t.includes(_.value))},w=(s,n)=>a.jsx("div",{className:l["filter-option"],"data-component":"renderfilter",children:n.control==="radio"?a.jsxs("label",{className:l.radio,children:[a.jsx("input",{checked:v(s.value,n),name:`${c}-filter-${n.label??"group"}`,onChange:e=>p(s.value,e.target.checked,n),type:"radio"}),a.jsxs("span",{className:l["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]})]}):a.jsx(I.Checkbox,{checked:v(s.value,n),label:a.jsxs("span",{className:l["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]}),onChange:e=>p(s.value,e.target.checked,n)})},s.value);return a.jsxs("div",{className:l.search,"data-component":"search",children:[a.jsxs("div",{className:l.controls,children:[a.jsx(E.Input,{"aria-label":$,icon:"MagnifyingGlass",onChange:s=>q(s.target.value),placeholder:O,type:"search",value:D}),d.length>0&&a.jsx(b.Button,{"aria-expanded":j,"aria-haspopup":"dialog",badge:h.length,icon:"Funnel",onClick:()=>r(!0),variant:"tertiary",children:x})]}),h.length>0&&a.jsxs("div",{"aria-label":x,className:l.chips,children:[h.map(s=>a.jsx(T.Chip,{accessibleLabel:M(s),label:s.label,onDelete:()=>p(s.value,!1)},s.value)),a.jsx(b.Button,{onClick:()=>i==null?void 0:i([]),variant:"tertiary",children:u})]}),j&&a.jsx(z.Dialog,{"aria-labelledby":c,className:l["filter-dialog"],controls:a.jsxs(P.Controls,{children:[a.jsx(b.Button,{onClick:()=>{i==null||i([]),r(!1)},children:u}),a.jsx(b.Button,{onClick:()=>r(!1),variant:"primary",children:B})]}),header:a.jsx(A.Header,{children:a.jsx("h2",{id:c,children:k})}),open:!0,setOpen:r,children:a.jsx("div",{className:l["filter-groups"],"data-columns":f,children:d.map((s,n)=>a.jsxs("section",{"aria-labelledby":s.label?`${c}-${n}`:void 0,className:l["filter-group"],"data-column-span":s.columnSpan??1,role:s.control==="radio"?"radiogroup":"group",children:[s.label&&a.jsx("h3",{id:`${c}-${n}`,children:s.label}),s.options.map(e=>w(e,s)),s.collapsible&&a.jsx(H.Collapsible,{summary:s.collapsible.label,children:a.jsx("div",{className:l["collapsible-options"],children:s.collapsible.options.map(e=>w(e,s))})})]},s.label??n))})})]})};exports.Search=U;
|