@solibo/solibo-ui 2.2.10 → 2.2.12
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/index15.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index55.css +1 -1
- package/dist/assets/index56.css +1 -1
- package/dist/assets/index57.css +1 -0
- package/dist/assets/index58.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +1 -1
- package/dist/components/app-shell/index.cjs +1 -1
- package/dist/components/app-shell/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +34 -34
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/clipboard/index.cjs +1 -1
- package/dist/components/clipboard/index.js +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/comment/index.cjs +1 -0
- package/dist/components/comment/index.js +10 -0
- package/dist/components/comments/index.cjs +1 -0
- package/dist/components/comments/index.js +58 -0
- package/dist/components/controls/index.cjs +1 -2
- package/dist/components/controls/index.js +6 -139
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/index.cjs +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +491 -470
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +5 -5
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +42 -37
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +105 -79
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +14 -14
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +1 -1
- package/dist/content-Duav5qcc.js +10 -0
- package/dist/content-i-MRPlxK.cjs +1 -0
- package/dist/index-Bl5EEYDv.cjs +2 -0
- package/dist/index-DQuc_Zkg.js +149 -0
- package/dist/index-DqZSdMHT.cjs +1 -0
- package/dist/{index-Dd20d_9U.js → index-FSKjg3Z8.js} +1 -1
- package/dist/{index-Dx-KtGBg.js → index-HVXauXrX.js} +1 -1
- package/dist/index-KGoXYG8u.js +123 -0
- package/dist/{index-7blZaPiA.cjs → index-S1XsOUKE.cjs} +1 -1
- package/dist/{index-VLDsM9it.cjs → index-riaH5c_S.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +78 -3
- package/dist/index.js +110 -104
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
|
@@ -1,99 +1,125 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Editor as
|
|
5
|
-
import { List as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as j, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import U from "classix";
|
|
3
|
+
import { useRef as M, useLayoutEffect as k, useState as A } from "react";
|
|
4
|
+
import { Editor as K } from "../editor/index.js";
|
|
5
|
+
import { List as N } from "../list/index.js";
|
|
6
|
+
import { Tooltip as q } from "../tooltip/index.js";
|
|
7
|
+
import { Button as D } from "../button/index.js";
|
|
8
|
+
import { C as I } from "../../index-DQuc_Zkg.js";
|
|
9
|
+
import { h as x } from "../../content-Duav5qcc.js";
|
|
10
|
+
import { Message as $ } from "../message/index.js";
|
|
11
|
+
import '../../assets/index15.css';const F = "_messages_15gj2_1", G = "_fill_15gj2_22", J = "_composer_15gj2_35", _ = {
|
|
12
|
+
messages: F,
|
|
13
|
+
fill: G,
|
|
14
|
+
composer: J
|
|
11
15
|
};
|
|
12
|
-
function
|
|
13
|
-
const
|
|
16
|
+
function Q(m, l = !1) {
|
|
17
|
+
const v = M(l), d = M(null), i = M(() => {
|
|
14
18
|
});
|
|
15
|
-
return
|
|
16
|
-
const e =
|
|
19
|
+
return k(() => {
|
|
20
|
+
const e = d.current;
|
|
17
21
|
if (!e) return;
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
element:
|
|
23
|
-
offset:
|
|
22
|
+
let u = !0, p = e.scrollTop, c;
|
|
23
|
+
const g = () => {
|
|
24
|
+
const o = e.getBoundingClientRect().top, r = Array.from(e.children).find((L) => L instanceof HTMLElement && L.getBoundingClientRect().bottom > o);
|
|
25
|
+
c = r ? {
|
|
26
|
+
element: r,
|
|
27
|
+
offset: r.getBoundingClientRect().top - o
|
|
24
28
|
} : void 0;
|
|
25
|
-
},
|
|
26
|
-
if (Math.abs(e.scrollTop -
|
|
27
|
-
const
|
|
28
|
-
return !(
|
|
29
|
-
},
|
|
30
|
-
if (
|
|
29
|
+
}, b = () => {
|
|
30
|
+
if (Math.abs(e.scrollTop - p) <= 0.5) return !1;
|
|
31
|
+
const o = Math.max(0, e.scrollHeight - e.clientHeight);
|
|
32
|
+
return !(p > o && Math.abs(e.scrollTop - o) <= 0.5);
|
|
33
|
+
}, s = () => {
|
|
34
|
+
if (v.current && (u = !1), b() && (u = !1, g()), u)
|
|
31
35
|
e.scrollTop = e.scrollHeight;
|
|
32
|
-
else if (
|
|
33
|
-
const
|
|
34
|
-
Math.abs(
|
|
36
|
+
else if (c != null && c.element.isConnected && e.contains(c.element)) {
|
|
37
|
+
const r = c.element.getBoundingClientRect().top - e.getBoundingClientRect().top - c.offset;
|
|
38
|
+
Math.abs(r) > 0.5 && (e.scrollTop += r);
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
p = e.scrollTop, g();
|
|
37
41
|
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
return
|
|
42
|
+
i.current = s;
|
|
43
|
+
const f = () => {
|
|
44
|
+
u = !1, g();
|
|
45
|
+
}, y = () => {
|
|
46
|
+
b() && (u = !1), p = e.scrollTop, g();
|
|
47
|
+
}, E = (o) => {
|
|
48
|
+
o.target === e && f();
|
|
49
|
+
}, R = (o) => {
|
|
50
|
+
const r = o.target;
|
|
51
|
+
r instanceof Element && r.closest('input, textarea, select, [contenteditable="true"]') || ["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(o.key) && f();
|
|
52
|
+
}, n = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(s), C = () => {
|
|
53
|
+
n == null || n.disconnect(), n == null || n.observe(e), Array.from(e.children).forEach((o) => n == null ? void 0 : n.observe(o)), s();
|
|
54
|
+
}, h = new MutationObserver(C);
|
|
55
|
+
return h.observe(e, {
|
|
52
56
|
childList: !0,
|
|
53
57
|
subtree: !0,
|
|
54
58
|
characterData: !0
|
|
55
|
-
}),
|
|
59
|
+
}), C(), e.addEventListener("scroll", y, {
|
|
56
60
|
passive: !0
|
|
57
|
-
}), e.addEventListener("wheel",
|
|
61
|
+
}), e.addEventListener("wheel", f, {
|
|
58
62
|
passive: !0
|
|
59
|
-
}), e.addEventListener("touchmove",
|
|
63
|
+
}), e.addEventListener("touchmove", f, {
|
|
60
64
|
passive: !0
|
|
61
|
-
}), e.addEventListener("pointerdown",
|
|
62
|
-
|
|
63
|
-
},
|
|
65
|
+
}), e.addEventListener("pointerdown", E), e.addEventListener("keydown", R), e.addEventListener("load", s, !0), e.addEventListener("error", s, !0), () => {
|
|
66
|
+
i.current = () => {
|
|
67
|
+
}, n == null || n.disconnect(), h.disconnect(), e.removeEventListener("scroll", y), e.removeEventListener("wheel", f), e.removeEventListener("touchmove", f), e.removeEventListener("pointerdown", E), e.removeEventListener("keydown", R), e.removeEventListener("load", s, !0), e.removeEventListener("error", s, !0);
|
|
64
68
|
};
|
|
65
|
-
}, []),
|
|
69
|
+
}, []), k(() => {
|
|
70
|
+
v.current = l, i.current();
|
|
71
|
+
}, [m, l]), d;
|
|
66
72
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
files: a,
|
|
71
|
-
handleUpload: e,
|
|
72
|
-
inlineImages: l,
|
|
73
|
-
maxEditorRows: d = 5,
|
|
74
|
-
message: s = "",
|
|
75
|
-
messages: i,
|
|
76
|
-
minEditorRows: p = 1,
|
|
77
|
-
onChange: c,
|
|
78
|
-
onFilesChange: r,
|
|
79
|
-
onInlineImagesChange: v,
|
|
80
|
-
onSubmit: g,
|
|
81
|
-
placeholder: h,
|
|
82
|
-
resizableEditor: o = !1,
|
|
83
|
-
sending: f,
|
|
84
|
-
submitLabel: w = "Send message",
|
|
85
|
-
tooltipLabel: t
|
|
73
|
+
const V = ({
|
|
74
|
+
messages: m,
|
|
75
|
+
editingId: l
|
|
86
76
|
}) => {
|
|
87
|
-
var
|
|
88
|
-
const
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
var d;
|
|
78
|
+
const v = Q((d = m[m.length - 1]) == null ? void 0 : d.id, !!l);
|
|
79
|
+
return /* @__PURE__ */ a(N, { "data-message-list": !0, ref: v, tabIndex: 0, "data-component": "messagelist", children: m.map((i) => /* @__PURE__ */ a("li", { "data-message-editing": i.id === l || void 0, children: /* @__PURE__ */ a($, { ...i }) }, i.id)) });
|
|
80
|
+
}, se = ({
|
|
81
|
+
autofocus: m = !0,
|
|
82
|
+
editing: l,
|
|
83
|
+
fill: v = !1,
|
|
84
|
+
files: d,
|
|
85
|
+
handleUpload: i,
|
|
86
|
+
inlineImages: e,
|
|
87
|
+
maxEditorRows: u = 5,
|
|
88
|
+
message: p = "",
|
|
89
|
+
messages: c,
|
|
90
|
+
minEditorRows: g = 1,
|
|
91
|
+
onChange: b,
|
|
92
|
+
onFilesChange: s,
|
|
93
|
+
onInlineImagesChange: f,
|
|
94
|
+
onSubmit: y,
|
|
95
|
+
placeholder: E,
|
|
96
|
+
resizableEditor: R = !1,
|
|
97
|
+
sending: n,
|
|
98
|
+
submitLabel: C = "Send message",
|
|
99
|
+
tooltipLabel: h
|
|
100
|
+
}) => {
|
|
101
|
+
const [o, r] = A([]), L = d ?? o, t = l && c.some((S) => S.id === l.messageId) ? l : void 0, [H, B] = A(!1), T = M(!1), w = !!(t != null && t.saving) || H, P = async () => {
|
|
102
|
+
if (!(!t || !x(t.content) || w || T.current)) {
|
|
103
|
+
T.current = !0, B(!0);
|
|
104
|
+
try {
|
|
105
|
+
await t.onSave(t.content);
|
|
106
|
+
} catch {
|
|
107
|
+
} finally {
|
|
108
|
+
T.current = !1, B(!1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ j("div", { className: U(_.messages, v && _.fill), "data-component": "messages", children: [
|
|
113
|
+
/* @__PURE__ */ a(V, { messages: c, editingId: t == null ? void 0 : t.messageId }),
|
|
114
|
+
(t || h) && /* @__PURE__ */ a(q, { variant: "static", children: t ? t.editingLabel ?? "Editing message" : h }),
|
|
115
|
+
/* @__PURE__ */ a("div", { className: _.composer, children: /* @__PURE__ */ a(K, { autofocus: m, sessionKey: t ? `edit:${t.messageId}` : "reply", attachmentsEnabled: !t, controls: t ? /* @__PURE__ */ j(I, { variant: "inline", children: [
|
|
116
|
+
/* @__PURE__ */ a(D, { disabled: w, onClick: t.onCancel, variant: "secondary", children: t.cancelLabel ?? "Cancel" }),
|
|
117
|
+
/* @__PURE__ */ a(D, { disabled: !x(t.content) || w, isLoading: w, onClick: () => void P(), variant: "primary", children: t.saveLabel ?? "Save" })
|
|
118
|
+
] }) : void 0, content: (t == null ? void 0 : t.content) ?? p, disabled: n || !x(p) && L.length === 0 && !(e != null && e.length), files: L, inlineImages: e, isSubmitting: t ? w : n, maxRows: u, minRows: g, onChange: (t == null ? void 0 : t.onChange) ?? b, onFilesChange: (S) => {
|
|
119
|
+
d === void 0 && r(S), s == null || s(S);
|
|
120
|
+
}, onInlineImagesChange: f, onSubmit: t ? void 0 : y, onUpload: i, placeholder: E, resizable: R ? "top" : !1, submitLabel: C }) })
|
|
95
121
|
] });
|
|
96
122
|
};
|
|
97
123
|
export {
|
|
98
|
-
|
|
124
|
+
se as Messages
|
|
99
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const h=require("react/jsx-runtime"),T=require("classix"),t=require("react"),K=require("react-dom"),N=require("../button/index.cjs"),O="_popover_12bds_1",H="_inline_12bds_6",W="_below_12bds_47",M="_above_12bds_52",U="_trigger_12bds_62",a={popover:O,inline:H,"popover-panel":"_popover-panel_12bds_26",below:W,above:M,"floating-panel":"_floating-panel_12bds_57",trigger:U,"inline-trigger":"_inline-trigger_12bds_66"},X=({children:v,inline:m=!1,triggerAccessibleLabel:k,triggerAriaHasPopup:C,triggerButtonContent:z})=>{const y=t.useRef(null),P=t.useRef(void 0),c=t.useRef(null),R=t.useId(),d=t.useRef(null),[n,D]=t.useState(!1),[F,x]=t.useState(!1),[u,B]=t.useState(),[f,E]=t.useState(!1),[w,S]=t.useState("right"),b=({initialFocus:e}={})=>{var r;P.current=e,B((r=d.current)==null?void 0:r.getBoundingClientRect()),x(!1),E(!1),S("right"),D(!0)},l=t.useCallback(({restoreFocus:e=!0}={})=>{var r;D(!1),e&&((r=d.current)==null||r.focus({preventScroll:!0}))},[]),L=e=>{n&&e.key==="Escape"&&l()},j=e=>{if(!n){if(e.key==="ArrowDown"){e.preventDefault(),b({initialFocus:"first"});return}e.key==="ArrowUp"&&(e.preventDefault(),b({initialFocus:"last"}))}};t.useEffect(()=>{if(!n)return;const e=s=>{var i,p;const o=s.target;(i=y.current)!=null&&i.contains(o)||(p=c.current)!=null&&p.contains(o)||l({restoreFocus:!1})},r=s=>{var o,i;s.target instanceof Node&&((o=c.current)!=null&&o.contains(s.target))||l({restoreFocus:((i=c.current)==null?void 0:i.contains(document.activeElement))??!1})};return document.addEventListener("mousedown",e),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("scroll",r,!0)}},[l,n]);const g=t.useCallback(()=>{const e=c.current,r=d.current;if(!e||!r)return;const s=e.getBoundingClientRect(),o=r.getBoundingClientRect();B(o),x(!0);const i=o.top,p=window.innerHeight-o.bottom;E(s.height>p&&i>p),S(s.width>window.innerWidth-o.left&&o.right>window.innerWidth-o.left?"left":"right")},[]);t.useLayoutEffect(()=>{if(n)return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[n,g]);const q=e=>{e.preventDefault(),e.stopPropagation(),n?l({restoreFocus:!1}):b()},A={"aria-controls":n?R:void 0,"aria-expanded":n,"aria-haspopup":C,"aria-label":k,className:m?a["inline-trigger"]:a.trigger,onClick:q,onKeyDown:j},I=[w==="left"?"translateX(-100%)":"",f?"translateY(calc(-100% - var(--shape-spacing-2xs)))":""].filter(Boolean).join(" "),_=n?h.jsx("div",{className:T(a["popover-panel"],a[f?"above":"below"],a["floating-panel"]),"data-horizontal-placement":w,"data-placement":f?"above":"below",id:R,ref:c,style:u?{left:w==="left"?u.right:u.left,position:"fixed",top:f?u.top:u.bottom,transform:I||void 0}:{position:"fixed",left:0,top:0},children:typeof v=="function"?v({close:l,initialFocus:P.current,isOpen:n,isPositioned:F}):v}):null;return h.jsxs("div",{className:T(a.popover,m&&a.inline),"data-open":n,onKeyDown:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},ref:y,"data-component":"popover",children:[h.jsx(N.Button,{...A,ref:d,variant:m?"simple":"tertiary",children:z}),_&&typeof document<"u"?K.createPortal(_,document.body):_]})};exports.Popover=X;
|
|
@@ -3,7 +3,7 @@ import z from "classix";
|
|
|
3
3
|
import { useRef as m, useId as W, useState as f, useCallback as C, useEffect as U, useLayoutEffect as X } from "react";
|
|
4
4
|
import { createPortal as Y } from "react-dom";
|
|
5
5
|
import { Button as q } from "../button/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index56.css';const G = "_popover_12bds_1", J = "_inline_12bds_6", M = "_below_12bds_47", Q = "_above_12bds_52", V = "_trigger_12bds_62", i = {
|
|
7
7
|
popover: G,
|
|
8
8
|
inline: J,
|
|
9
9
|
"popover-panel": "_popover-panel_12bds_26",
|
|
@@ -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("
|
|
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-Bl5EEYDv.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-S1XsOUKE.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;
|
|
@@ -3,21 +3,21 @@ import { useId as H, useState as T, useMemo as q } from "react";
|
|
|
3
3
|
import { Button as p } from "../button/index.js";
|
|
4
4
|
import { Checkbox as z } from "../checkbox/index.js";
|
|
5
5
|
import { Chip as A } from "../chip/index.js";
|
|
6
|
-
import { Collapsible as
|
|
7
|
-
import {
|
|
8
|
-
import { Dialog as
|
|
9
|
-
import { Header as
|
|
10
|
-
import { I as
|
|
11
|
-
import '../../assets/index9.css';const
|
|
12
|
-
search:
|
|
13
|
-
controls:
|
|
14
|
-
chips:
|
|
6
|
+
import { Collapsible as C } from "../collapsible/index.js";
|
|
7
|
+
import { C as E } from "../../index-DQuc_Zkg.js";
|
|
8
|
+
import { Dialog as J } from "../dialog/index.js";
|
|
9
|
+
import { Header as K } from "../header/index.js";
|
|
10
|
+
import { I as P } from "../../index-FSKjg3Z8.js";
|
|
11
|
+
import '../../assets/index9.css';const Q = "_search_wsuwb_3", U = "_controls_wsuwb_15", V = "_chips_wsuwb_35", W = "_radio_wsuwb_101", o = {
|
|
12
|
+
search: Q,
|
|
13
|
+
controls: U,
|
|
14
|
+
chips: V,
|
|
15
15
|
"filter-dialog": "_filter-dialog_wsuwb_42",
|
|
16
16
|
"filter-groups": "_filter-groups_wsuwb_47",
|
|
17
17
|
"filter-group": "_filter-group_wsuwb_47",
|
|
18
18
|
"filter-option": "_filter-option_wsuwb_83",
|
|
19
19
|
"option-copy": "_option-copy_wsuwb_89",
|
|
20
|
-
radio:
|
|
20
|
+
radio: W,
|
|
21
21
|
"collapsible-options": "_collapsible-options_wsuwb_124"
|
|
22
22
|
}, ia = ({
|
|
23
23
|
filterButtonLabel: v = "Filters",
|
|
@@ -64,22 +64,22 @@ import '../../assets/index9.css';const U = "_search_wsuwb_3", V = "_controls_wsu
|
|
|
64
64
|
] }), onChange: (l) => h(a.value, l.target.checked, i) }) }, a.value);
|
|
65
65
|
return /* @__PURE__ */ c("div", { className: o.search, "data-component": "search", children: [
|
|
66
66
|
/* @__PURE__ */ c("div", { className: o.controls, children: [
|
|
67
|
-
/* @__PURE__ */ s(
|
|
67
|
+
/* @__PURE__ */ s(P, { "aria-label": x, icon: "MagnifyingGlass", onChange: (a) => D(a.target.value), placeholder: I, type: "search", value: R }),
|
|
68
68
|
d.length > 0 && /* @__PURE__ */ s(p, { "aria-expanded": f, "aria-haspopup": "dialog", badge: b.length, icon: "Funnel", onClick: () => m(!0), variant: "tertiary", children: v })
|
|
69
69
|
] }),
|
|
70
70
|
b.length > 0 && /* @__PURE__ */ c("div", { "aria-label": v, className: o.chips, children: [
|
|
71
71
|
b.map((a) => /* @__PURE__ */ s(A, { accessibleLabel: O(a), label: a.label, onDelete: () => h(a.value, !1) }, a.value)),
|
|
72
72
|
/* @__PURE__ */ s(p, { onClick: () => e == null ? void 0 : e([]), variant: "tertiary", children: w })
|
|
73
73
|
] }),
|
|
74
|
-
f && /* @__PURE__ */ s(
|
|
74
|
+
f && /* @__PURE__ */ s(J, { "aria-labelledby": n, className: o["filter-dialog"], controls: /* @__PURE__ */ c(E, { children: [
|
|
75
75
|
/* @__PURE__ */ s(p, { onClick: () => {
|
|
76
76
|
e == null || e([]), m(!1);
|
|
77
77
|
}, children: w }),
|
|
78
78
|
/* @__PURE__ */ s(p, { onClick: () => m(!1), variant: "primary", children: j })
|
|
79
|
-
] }), header: /* @__PURE__ */ s(
|
|
79
|
+
] }), header: /* @__PURE__ */ s(K, { children: /* @__PURE__ */ s("h2", { id: n, children: M }) }), open: !0, setOpen: m, children: /* @__PURE__ */ s("div", { className: o["filter-groups"], "data-columns": $, children: d.map((a, i) => /* @__PURE__ */ c("section", { "aria-labelledby": a.label ? `${n}-${i}` : void 0, className: o["filter-group"], "data-column-span": a.columnSpan ?? 1, role: a.control === "radio" ? "radiogroup" : "group", children: [
|
|
80
80
|
a.label && /* @__PURE__ */ s("h3", { id: `${n}-${i}`, children: a.label }),
|
|
81
81
|
a.options.map((l) => N(l, a)),
|
|
82
|
-
a.collapsible && /* @__PURE__ */ s(
|
|
82
|
+
a.collapsible && /* @__PURE__ */ s(C, { summary: a.collapsible.label, children: /* @__PURE__ */ s("div", { className: o["collapsible-options"], children: a.collapsible.options.map((l) => N(l, a)) }) })
|
|
83
83
|
] }, a.label ?? i)) }) })
|
|
84
84
|
] });
|
|
85
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("../../icons-BIdcCH-v.cjs");const e=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("../../icons-BIdcCH-v.cjs");const e=require("../../index-riaH5c_S.cjs");require("../../use-touched-Bq5Gjbpz.cjs");exports.Select=e.Select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index58.css');const a=require("react/jsx-runtime"),l=require("classix"),s="_toolbar_11xk1_1",n="_editor_11xk1_34",o={toolbar:s,default:"_default_11xk1_28",editor:n},c=({children:t,variant:e="default"})=>a.jsx("div",{className:l(o.toolbar,o[e]),onClick:r=>r.stopPropagation(),"data-component":"toolbar",children:t});exports.Toolbar=c;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import e from "classix";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index58.css';const s = "_toolbar_11xk1_1", n = "_editor_11xk1_34", o = {
|
|
4
4
|
toolbar: s,
|
|
5
5
|
default: "_default_11xk1_28",
|
|
6
6
|
editor: n
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("sanitize-html"),i=(t,{allowImages:e=!0}={})=>s(t,{allowedTags:e?["img"]:[],allowedAttributes:{}}).replace(/ /g," ").trim()!=="";exports.hasEditorContent=i;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";require('./assets/index38.css');const x=require("react/jsx-runtime"),te=require("classix"),d=require("react"),N=require("./menu-popover-bqblnK6P.cjs"),ne=require("./components/button/index.cjs"),j=(n,r="")=>d.Children.toArray(n).flatMap((t,g)=>{if(!d.isValidElement(t))return[t];const o=`${r}${t.key??g}`;return t.type===d.Fragment?j(t.props.children,`${o}/`):[d.cloneElement(t,{key:o})]}),G=n=>d.isValidElement(n)&&n.type===ne.Button,ie="_controls_cgtg8_13",re="_inline_cgtg8_43",oe="_embedded_cgtg8_48",se="_fixed_cgtg8_49",de="_adaptive_cgtg8_60",ce="_measurement_cgtg8_65",h={controls:ie,default:"_default_cgtg8_28",inline:re,embedded:oe,fixed:se,adaptive:de,measurement:ce,"non-button-content":"_non-button-content_cgtg8_103","overflow-trigger":"_overflow-trigger_cgtg8_132"},ae={primary:2,secondary:1,tertiary:0,simple:0},le={default:h.default,embedded:h.embedded,fixed:h.fixed,inline:h.inline},ue=n=>ae[n.props.variant??"secondary"];function me({buttons:n,menuAccessibleLabel:r,triggerAccessibleLabel:t}){const g=n.map(o=>({button:o,isDanger:o.props.intent==="danger",value:o}));return x.jsx(N.MenuPopover,{triggerAccessibleLabel:t,"data-component":"overflowmenu",children:({close:o,initialFocus:s})=>x.jsx(N.MenuActionList,{actions:g,initialFocus:s,menuAccessibleLabel:r,onSelect:()=>o(),usesMenuSemantics:!0})})}const p=(n,r)=>{const t=Number.parseFloat(String(n[r]));return Number.isFinite(t)?t:0},fe=n=>{if(!n.trim().endsWith("px"))return;const r=Number.parseFloat(n);return Number.isFinite(r)?r:void 0},ge=(n,r)=>{const t=n.parentElement;if(!t)return;const g=t.getBoundingClientRect(),o=getComputedStyle(t),s=g.width||t.clientWidth,k=g.left+p(o,"borderLeftWidth")+p(o,"paddingLeft"),C=g.left+s-p(o,"borderRightWidth")-p(o,"paddingRight"),_=Array.from(t.children).slice(0,Array.from(t.children).indexOf(n)),y=_.reduce((f,u)=>Math.max(f,u.getBoundingClientRect().right),k),a=_.length>0?p(o,"columnGap"):0,l=Math.max(0,C-y-a),R=(r==null?void 0:r.parent)===t?Math.max(0,s-r.parentWidth):0;return{availableWidth:R>0?Math.max(l,((r==null?void 0:r.availableWidth)??0)+R):l,parent:t,parentWidth:s}},he=({children:n,className:r,maxVisibleButtons:t,overflow:g,overflowAccessibleLabel:o="More actions",variant:s="default",...k})=>{const C=j(n),_=[],y=[];C.forEach(e=>{G(e)?_.push(e):y.push(e)});const a=_.map((e,c)=>({button:e,index:c,rank:ue(e)})).sort((e,c)=>e.rank-c.rank||e.index-c.index).map(({button:e,index:c})=>d.cloneElement(e,{key:e.key??c})),l=s==="embedded"||s==="fixed"&&g==="menu",R=typeof t=="number"&&Number.isFinite(t)?Math.floor(t):0,f=s==="embedded"&&R>0?Math.min(a.length,R):a.length,u=d.useRef(null),z=d.useRef(void 0),F=d.useRef(null),E=d.useRef(null),[V,M]=d.useState(f),S=a.map(e=>String(e.key)).join(`
|
|
2
|
+
`),[T,H]=d.useState(S);T!==S&&(H(S),M(f));const b=d.useCallback(()=>{var P,I,D;if(!l){M(f);return}const e=u.current,c=F.current;if(!e||!c)return;const W=Array.from(c.querySelectorAll('[data-component="button"]')),w=W.at(-1);if(!w)return;const v=W.slice(0,a.length).map(i=>i.getBoundingClientRect().width);if(v.length!==a.length)return;const m=getComputedStyle(e),Q=p(m,"paddingLeft")+p(m,"paddingRight")+p(m,"borderLeftWidth")+p(m,"borderRightWidth"),U=fe(m.maxWidth),B=s==="embedded"?ge(e,z.current):void 0;B&&(z.current=B);const X=(B==null?void 0:B.availableWidth)??((P=e.parentElement)==null?void 0:P.clientWidth)??0,Y=((I=window.visualViewport)==null?void 0:I.width)??document.documentElement.clientWidth,O=Math.min(...[U,X,Y].filter(i=>typeof i=="number"&&Number.isFinite(i)&&i>0));if(!Number.isFinite(O))return;const $=Math.max(0,O-Q),K=((D=E.current)==null?void 0:D.getBoundingClientRect().width)??0,Z=v.reduce((i,ee)=>i+ee,0);if(f===a.length&&K+Z<=$){M(i=>i===f?i:f);return}let L=K+w.getBoundingClientRect().width,A=0;for(let i=0;i<f&&!(L+v[i]>$);i+=1)L+=v[i],A=i+1;M(i=>i===A?i:A)},[l,a.length,s,f]);if(d.useLayoutEffect(()=>{var c,W,w,v;if(b(),!l)return;const e=typeof ResizeObserver>"u"?void 0:new ResizeObserver(b);return u.current&&(e==null||e.observe(u.current)),(c=u.current)!=null&&c.parentElement&&(e==null||e.observe(u.current.parentElement)),s==="embedded"&&((W=u.current)!=null&&W.parentElement)&&Array.from(u.current.parentElement.children).forEach(m=>{m!==u.current&&(e==null||e.observe(m))}),E.current&&(e==null||e.observe(E.current)),window.addEventListener("resize",b),(w=window.visualViewport)==null||w.addEventListener("resize",b),(v=document.fonts)==null||v.ready.then(b),()=>{var m;e==null||e.disconnect(),window.removeEventListener("resize",b),(m=window.visualViewport)==null||m.removeEventListener("resize",b)}},[l,n,b,s]),C.length===0)return null;const J=l?a.slice(0,V):a,q=l?a.slice(V):[];return x.jsxs("div",{"data-dynamic-position":s==="fixed"?!0:void 0,"data-adaptive":l?!0:void 0,className:te(h.controls,le[s],l&&h.adaptive,r),ref:u,...k,"data-component":"controls",children:[l&&x.jsxs("div",{"aria-hidden":"true",className:h.measurement,ref:F,children:[a.map((e,c)=>d.cloneElement(e,{"aria-hidden":!0,id:void 0,key:`measure-${String(e.key??c)}`,onClick:void 0,ref:void 0,tabIndex:-1})),x.jsx(N.MenuPopover,{triggerAccessibleLabel:o,children:null})]}),s!=="embedded"&&y.length>0&&x.jsx("span",{className:h["non-button-content"],ref:E,children:y}),J,q.length>0&&x.jsx("span",{className:h["overflow-trigger"],children:x.jsx(me,{buttons:q,menuAccessibleLabel:o,triggerAccessibleLabel:o})})]})};exports.Controls=he;exports.controlChildren=j;exports.isControlButton=G;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsxs as G, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import re from "classix";
|
|
3
|
+
import { Children as oe, isValidElement as T, Fragment as de, cloneElement as N, useRef as E, useState as P, useCallback as se, useLayoutEffect as ce } from "react";
|
|
4
|
+
import { a as H, M as ae } from "./menu-popover-Ceb_9V67.js";
|
|
5
|
+
import { Button as le } from "./components/button/index.js";
|
|
6
|
+
import './assets/index38.css';const J = (n, r = "") => oe.toArray(n).flatMap((t, f) => {
|
|
7
|
+
if (!T(t)) return [t];
|
|
8
|
+
const o = `${r}${t.key ?? f}`;
|
|
9
|
+
return t.type === de ? J(t.props.children, `${o}/`) : [N(t, {
|
|
10
|
+
key: o
|
|
11
|
+
})];
|
|
12
|
+
}), ue = (n) => T(n) && n.type === le, me = "_controls_cgtg8_13", fe = "_inline_cgtg8_43", ge = "_embedded_cgtg8_48", he = "_fixed_cgtg8_49", pe = "_adaptive_cgtg8_60", be = "_measurement_cgtg8_65", g = {
|
|
13
|
+
controls: me,
|
|
14
|
+
default: "_default_cgtg8_28",
|
|
15
|
+
inline: fe,
|
|
16
|
+
embedded: ge,
|
|
17
|
+
fixed: he,
|
|
18
|
+
adaptive: pe,
|
|
19
|
+
measurement: be,
|
|
20
|
+
"non-button-content": "_non-button-content_cgtg8_103",
|
|
21
|
+
"overflow-trigger": "_overflow-trigger_cgtg8_132"
|
|
22
|
+
}, ve = {
|
|
23
|
+
primary: 2,
|
|
24
|
+
secondary: 1,
|
|
25
|
+
tertiary: 0,
|
|
26
|
+
simple: 0
|
|
27
|
+
}, ye = {
|
|
28
|
+
default: g.default,
|
|
29
|
+
embedded: g.embedded,
|
|
30
|
+
fixed: g.fixed,
|
|
31
|
+
inline: g.inline
|
|
32
|
+
}, _e = (n) => ve[n.props.variant ?? "secondary"];
|
|
33
|
+
function xe({
|
|
34
|
+
buttons: n,
|
|
35
|
+
menuAccessibleLabel: r,
|
|
36
|
+
triggerAccessibleLabel: t
|
|
37
|
+
}) {
|
|
38
|
+
const f = n.map((o) => ({
|
|
39
|
+
button: o,
|
|
40
|
+
isDanger: o.props.intent === "danger",
|
|
41
|
+
value: o
|
|
42
|
+
}));
|
|
43
|
+
return /* @__PURE__ */ v(H, { triggerAccessibleLabel: t, "data-component": "overflowmenu", children: ({
|
|
44
|
+
close: o,
|
|
45
|
+
initialFocus: d
|
|
46
|
+
}) => /* @__PURE__ */ v(ae, { actions: f, initialFocus: d, menuAccessibleLabel: r, onSelect: () => o(), usesMenuSemantics: !0 }) });
|
|
47
|
+
}
|
|
48
|
+
const h = (n, r) => {
|
|
49
|
+
const t = Number.parseFloat(String(n[r]));
|
|
50
|
+
return Number.isFinite(t) ? t : 0;
|
|
51
|
+
}, We = (n) => {
|
|
52
|
+
if (!n.trim().endsWith("px")) return;
|
|
53
|
+
const r = Number.parseFloat(n);
|
|
54
|
+
return Number.isFinite(r) ? r : void 0;
|
|
55
|
+
}, we = (n, r) => {
|
|
56
|
+
const t = n.parentElement;
|
|
57
|
+
if (!t) return;
|
|
58
|
+
const f = t.getBoundingClientRect(), o = getComputedStyle(t), d = f.width || t.clientWidth, k = f.left + h(o, "borderLeftWidth") + h(o, "paddingLeft"), B = f.left + d - h(o, "borderRightWidth") - h(o, "paddingRight"), y = Array.from(t.children).slice(0, Array.from(t.children).indexOf(n)), _ = y.reduce((m, l) => Math.max(m, l.getBoundingClientRect().right), k), c = y.length > 0 ? h(o, "columnGap") : 0, a = Math.max(0, B - _ - c), x = (r == null ? void 0 : r.parent) === t ? Math.max(0, d - r.parentWidth) : 0;
|
|
59
|
+
return {
|
|
60
|
+
availableWidth: x > 0 ? Math.max(a, ((r == null ? void 0 : r.availableWidth) ?? 0) + x) : a,
|
|
61
|
+
parent: t,
|
|
62
|
+
parentWidth: d
|
|
63
|
+
};
|
|
64
|
+
}, ke = ({
|
|
65
|
+
children: n,
|
|
66
|
+
className: r,
|
|
67
|
+
maxVisibleButtons: t,
|
|
68
|
+
overflow: f,
|
|
69
|
+
overflowAccessibleLabel: o = "More actions",
|
|
70
|
+
variant: d = "default",
|
|
71
|
+
...k
|
|
72
|
+
}) => {
|
|
73
|
+
const B = J(n), y = [], _ = [];
|
|
74
|
+
B.forEach((e) => {
|
|
75
|
+
ue(e) ? y.push(e) : _.push(e);
|
|
76
|
+
});
|
|
77
|
+
const c = y.map((e, s) => ({
|
|
78
|
+
button: e,
|
|
79
|
+
index: s,
|
|
80
|
+
rank: _e(e)
|
|
81
|
+
})).sort((e, s) => e.rank - s.rank || e.index - s.index).map(({
|
|
82
|
+
button: e,
|
|
83
|
+
index: s
|
|
84
|
+
}) => N(e, {
|
|
85
|
+
key: e.key ?? s
|
|
86
|
+
})), a = d === "embedded" || d === "fixed" && f === "menu", x = typeof t == "number" && Number.isFinite(t) ? Math.floor(t) : 0, m = d === "embedded" && x > 0 ? Math.min(c.length, x) : c.length, l = E(null), z = E(void 0), F = E(null), C = E(null), [V, M] = P(m), S = c.map((e) => String(e.key)).join(`
|
|
87
|
+
`), [Q, U] = P(S);
|
|
88
|
+
Q !== S && (U(S), M(m));
|
|
89
|
+
const p = se(() => {
|
|
90
|
+
var I, q, D;
|
|
91
|
+
if (!a) {
|
|
92
|
+
M(m);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const e = l.current, s = F.current;
|
|
96
|
+
if (!e || !s) return;
|
|
97
|
+
const W = Array.from(s.querySelectorAll('[data-component="button"]')), w = W.at(-1);
|
|
98
|
+
if (!w) return;
|
|
99
|
+
const b = W.slice(0, c.length).map((i) => i.getBoundingClientRect().width);
|
|
100
|
+
if (b.length !== c.length) return;
|
|
101
|
+
const u = getComputedStyle(e), Y = h(u, "paddingLeft") + h(u, "paddingRight") + h(u, "borderLeftWidth") + h(u, "borderRightWidth"), Z = We(u.maxWidth), R = d === "embedded" ? we(e, z.current) : void 0;
|
|
102
|
+
R && (z.current = R);
|
|
103
|
+
const ee = (R == null ? void 0 : R.availableWidth) ?? ((I = e.parentElement) == null ? void 0 : I.clientWidth) ?? 0, te = ((q = window.visualViewport) == null ? void 0 : q.width) ?? document.documentElement.clientWidth, $ = Math.min(...[Z, ee, te].filter((i) => typeof i == "number" && Number.isFinite(i) && i > 0));
|
|
104
|
+
if (!Number.isFinite($)) return;
|
|
105
|
+
const j = Math.max(0, $ - Y), K = ((D = C.current) == null ? void 0 : D.getBoundingClientRect().width) ?? 0, ne = b.reduce((i, ie) => i + ie, 0);
|
|
106
|
+
if (m === c.length && K + ne <= j) {
|
|
107
|
+
M((i) => i === m ? i : m);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let L = K + w.getBoundingClientRect().width, A = 0;
|
|
111
|
+
for (let i = 0; i < m && !(L + b[i] > j); i += 1)
|
|
112
|
+
L += b[i], A = i + 1;
|
|
113
|
+
M((i) => i === A ? i : A);
|
|
114
|
+
}, [a, c.length, d, m]);
|
|
115
|
+
if (ce(() => {
|
|
116
|
+
var s, W, w, b;
|
|
117
|
+
if (p(), !a) return;
|
|
118
|
+
const e = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(p);
|
|
119
|
+
return l.current && (e == null || e.observe(l.current)), (s = l.current) != null && s.parentElement && (e == null || e.observe(l.current.parentElement)), d === "embedded" && ((W = l.current) != null && W.parentElement) && Array.from(l.current.parentElement.children).forEach((u) => {
|
|
120
|
+
u !== l.current && (e == null || e.observe(u));
|
|
121
|
+
}), C.current && (e == null || e.observe(C.current)), window.addEventListener("resize", p), (w = window.visualViewport) == null || w.addEventListener("resize", p), (b = document.fonts) == null || b.ready.then(p), () => {
|
|
122
|
+
var u;
|
|
123
|
+
e == null || e.disconnect(), window.removeEventListener("resize", p), (u = window.visualViewport) == null || u.removeEventListener("resize", p);
|
|
124
|
+
};
|
|
125
|
+
}, [a, n, p, d]), B.length === 0)
|
|
126
|
+
return null;
|
|
127
|
+
const X = a ? c.slice(0, V) : c, O = a ? c.slice(V) : [];
|
|
128
|
+
return /* @__PURE__ */ G("div", { "data-dynamic-position": d === "fixed" ? !0 : void 0, "data-adaptive": a ? !0 : void 0, className: re(g.controls, ye[d], a && g.adaptive, r), ref: l, ...k, "data-component": "controls", children: [
|
|
129
|
+
a && /* @__PURE__ */ G("div", { "aria-hidden": "true", className: g.measurement, ref: F, children: [
|
|
130
|
+
c.map((e, s) => N(e, {
|
|
131
|
+
"aria-hidden": !0,
|
|
132
|
+
id: void 0,
|
|
133
|
+
key: `measure-${String(e.key ?? s)}`,
|
|
134
|
+
onClick: void 0,
|
|
135
|
+
ref: void 0,
|
|
136
|
+
tabIndex: -1
|
|
137
|
+
})),
|
|
138
|
+
/* @__PURE__ */ v(H, { triggerAccessibleLabel: o, children: null })
|
|
139
|
+
] }),
|
|
140
|
+
d !== "embedded" && _.length > 0 && /* @__PURE__ */ v("span", { className: g["non-button-content"], ref: C, children: _ }),
|
|
141
|
+
X,
|
|
142
|
+
O.length > 0 && /* @__PURE__ */ v("span", { className: g["overflow-trigger"], children: /* @__PURE__ */ v(xe, { buttons: O, menuAccessibleLabel: o, triggerAccessibleLabel: o }) })
|
|
143
|
+
] });
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
ke as C,
|
|
147
|
+
J as c,
|
|
148
|
+
ue as i
|
|
149
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./assets/index36.css');const e=require("react/jsx-runtime"),a=require("react"),A=require("./components/avatar/index.cjs"),N=require("./components/button/index.cjs"),O=require("./components/group/index.cjs"),L=require("./components/icon/index.cjs"),U=require("./index-Bl5EEYDv.cjs"),G=require("./components/editor/index.cjs"),H=require("./content-i-MRPlxK.cjs"),K="_comment_1mvf0_1",T="_meta_1mvf0_12",V="_body_1mvf0_23",$="_notice_1mvf0_30",F="_toggle_1mvf0_46",J="_composer_1mvf0_51",M="_replies_1mvf0_73",Q="_text_1mvf0_82",s={comment:K,meta:T,body:V,notice:$,toggle:F,composer:J,replies:M,text:Q},I=({author:d,label:_,placeholder:j,submitLabel:h,cancelLabel:p,initialContent:v="",autofocus:y=!1,sending:b=!1,onCancel:o,onSubmit:w,onPublished:i})=>{const[c,n]=a.useState(v),[u,f]=a.useState(!1),l=H.hasEditorContent(c,{allowImages:!1}),r=b||u,g=async()=>{if(!(!l||r)){f(!0);try{const t=await w(c);t!==!1&&(n(""),typeof t=="string"&&(i==null||i(t)))}catch{return}finally{f(!1)}}};return e.jsxs("div",{"aria-label":_,className:s.composer,"data-active":l,role:"group","data-component":"commentcomposer",children:[d&&e.jsx("header",{children:e.jsx(A.Avatar,{...d})}),e.jsx(G.Editor,{autofocus:y,content:c,isSubmitting:r,maxRows:10,minRows:1,onChange:n,placeholder:j,variant:"embedded"}),e.jsx("footer",{children:e.jsxs(U.Controls,{variant:"inline",children:[(l||o)&&e.jsx(N.Button,{disabled:r,onClick:()=>{n(""),o==null||o()},variant:"secondary",children:p}),e.jsx(N.Button,{disabled:!l||r,isLoading:r,onClick:()=>void g(),variant:"primary",children:h})]})})]})},B=({id:d,author:_,authorImageUrl:j,authorColor:h="3",timestamp:p,timestampText:v,content:y,actions:b,notice:o,locked:w,reactions:i,editor:c,replies:n=[],replyComposer:u,replyLabel:f="Reply",showRepliesLabel:l="Show replies",hideRepliesLabel:r="Hide replies",onPublished:g})=>{const[t,z]=a.useState(!1),[S,D]=a.useState(!1),R=a.useId(),q=a.useRef(null);a.useEffect(()=>{var x,k,E;t&&S&&((x=q.current)==null||x.scrollIntoView({behavior:"smooth",block:"center"}),(E=(k=q.current)==null?void 0:k.querySelector('[contenteditable="true"]'))==null||E.focus({preventScroll:!0}))},[t,S]);const m=p?new Date(p):void 0,C=n.length>0||!!u;return e.jsxs("div",{"data-comment-id":d,"data-component":"comment",children:[e.jsxs("article",{className:s.comment,children:[e.jsxs("header",{children:[e.jsxs(O.Group,{className:s.meta,gap:"small",justify:"between",layout:"row",children:[e.jsx(A.Avatar,{accessibleLabel:_,color:h,imageUrl:j,name:_}),e.jsxs("sub",{children:[w&&e.jsx(L.Icon,{gap:"right",name:"LockKey",size:"small"}),e.jsx("time",{dateTime:m==null?void 0:m.toISOString(),children:v??(m==null?void 0:m.toLocaleString())})]})]}),b]}),e.jsxs("div",{className:s.body,children:[o&&e.jsx("p",{className:s.notice,children:o}),c?e.jsx(I,{...c}):e.jsx("div",{className:s.text,"data-content":"user-generated",children:y})]}),!c&&(i||C)&&e.jsxs("footer",{children:[i,C&&e.jsxs(N.Button,{"aria-controls":R,"aria-expanded":t,className:s.toggle,onClick:()=>{z(!t),D(!t&&n.length===0)},variant:"tertiary",children:[t?r:n.length?l:f,(t||n.length>0)&&e.jsx(L.Icon,{name:t?"CaretUp":"CaretDown",size:"small"})]})]})]}),t&&C&&e.jsxs("ul",{className:s.replies,id:R,children:[n.map(x=>e.jsx("li",{children:e.jsx(B,{...x,onPublished:g})},x.id)),u&&e.jsx("li",{"data-reply-composer":d,ref:q,children:e.jsx(I,{...u,autofocus:S,onPublished:g})})]})]})};exports.Comment=B;exports.CommentComposer=I;
|
|
@@ -3,7 +3,7 @@ import m from "classix";
|
|
|
3
3
|
import { useId as A, useState as T, useEffect as V } from "react";
|
|
4
4
|
import { i as D } from "./icons-DVeBguFb.js";
|
|
5
5
|
import { u as J, c as K } from "./use-touched-B999bBr8.js";
|
|
6
|
-
import './assets/
|
|
6
|
+
import './assets/index52.css';function O(n) {
|
|
7
7
|
return n && `${n[0].toLocaleUpperCase()}${n.slice(1)}`;
|
|
8
8
|
}
|
|
9
9
|
function Q(n) {
|
|
@@ -2,7 +2,7 @@ import { jsxs as m, jsx as p } from "react/jsx-runtime";
|
|
|
2
2
|
import v from "classix";
|
|
3
3
|
import { i as w } from "./icons-DVeBguFb.js";
|
|
4
4
|
import { u as C, c as S } from "./use-touched-B999bBr8.js";
|
|
5
|
-
import './assets/
|
|
5
|
+
import './assets/index57.css';const P = /* @__PURE__ */ new Set(["aria-activedescendant", "aria-autocomplete", "aria-busy", "aria-controls", "aria-describedby", "aria-details", "aria-disabled", "aria-errormessage", "aria-expanded", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-live", "aria-owns", "aria-required", "aria-roledescription", "autoComplete", "autoFocus", "className", "defaultValue", "dir", "disabled", "form", "id", "multiple", "name", "onBlur", "onChange", "onClick", "onFocus", "onInput", "onInvalid", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", "required", "role", "size", "style", "tabIndex", "title", "value"]);
|
|
6
6
|
function _(n) {
|
|
7
7
|
return Object.fromEntries(Object.entries(n).filter(([e]) => e.startsWith("data-") || e.startsWith("aria-") || P.has(e)));
|
|
8
8
|
}
|