@inkeep/cxkit-primitives 0.5.6 → 0.5.9
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/atoms/api/analytics/events.cjs +1 -1
- package/dist/atoms/api/analytics/events.js +2 -2
- package/dist/components/embedded-chat/use-chat-action.cjs +1 -1
- package/dist/components/embedded-chat/use-chat-action.js +14 -16
- package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
- package/dist/components/embedded-chat/use-inkeep-chat.js +117 -123
- package/dist/components/embedded-chat.cjs +5 -5
- package/dist/components/embedded-chat.d.cts +9 -8
- package/dist/components/embedded-chat.d.ts +9 -8
- package/dist/components/embedded-chat.js +952 -963
- package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
- package/dist/components/embedded-search/use-inkeep-search.js +10 -10
- package/dist/components/embedded-search.d.cts +2 -2
- package/dist/components/embedded-search.d.ts +2 -2
- package/dist/components/embedded-search.js +79 -79
- package/dist/components/intelligent-form/intelligent-form-provider.cjs +1 -1
- package/dist/components/intelligent-form/intelligent-form-provider.d.cts +3 -3
- package/dist/components/intelligent-form/intelligent-form-provider.d.ts +3 -3
- package/dist/components/intelligent-form/intelligent-form-provider.js +2 -2
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.cjs +1 -1
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.cts +5 -5
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.ts +5 -5
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.js +88 -109
- package/dist/components/intelligent-form.cjs +1 -1
- package/dist/components/intelligent-form.d.cts +4 -3
- package/dist/components/intelligent-form.d.ts +4 -3
- package/dist/components/intelligent-form.js +191 -188
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.cts +1 -1
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/modal.js +26 -26
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/providers/chat-events-provider.cjs +1 -1
- package/dist/providers/chat-events-provider.d.cts +9 -1
- package/dist/providers/chat-events-provider.d.ts +9 -1
- package/dist/providers/chat-events-provider.js +54 -57
- package/dist/providers/chat-form-provider.cjs +1 -1
- package/dist/providers/chat-form-provider.d.cts +3 -3
- package/dist/providers/chat-form-provider.d.ts +3 -3
- package/dist/providers/chat-form-provider.js +17 -17
- package/dist/providers/feedback-provider.cjs +1 -1
- package/dist/providers/feedback-provider.js +23 -23
- package/dist/utils/default-settings.cjs +1 -1
- package/dist/utils/default-settings.d.cts +1 -0
- package/dist/utils/default-settings.d.ts +1 -0
- package/dist/utils/default-settings.js +10 -8
- package/dist/utils/misc.cjs +1 -1
- package/dist/utils/misc.d.cts +2 -2
- package/dist/utils/misc.d.ts +2 -2
- package/dist/utils/misc.js +15 -13
- package/package.json +5 -4
- package/dist/atoms/dialog.cjs +0 -1
- package/dist/atoms/dialog.js +0 -185
package/dist/utils/misc.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const o = (t) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
if (typeof t == "string")
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(t);
|
|
6
|
+
} catch {
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
8
10
|
}, c = (
|
|
9
11
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
10
12
|
(...t) => (...n) => {
|
|
11
13
|
for (const e of t)
|
|
12
14
|
e?.(...n);
|
|
13
15
|
}
|
|
14
|
-
),
|
|
15
|
-
function
|
|
16
|
+
), s = (t) => typeof t == "string";
|
|
17
|
+
function a(t) {
|
|
16
18
|
return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/__/g, "__").toLowerCase();
|
|
17
19
|
}
|
|
18
20
|
const f = (t) => t ? "" : void 0;
|
|
@@ -20,17 +22,17 @@ function i(t) {
|
|
|
20
22
|
const n = t.split(" "), e = n[0] ?? "", r = n.length > 1 ? n[n.length - 1] : "";
|
|
21
23
|
return e && r ? `${e.charAt(0)}${r.charAt(0)}` : e.charAt(0);
|
|
22
24
|
}
|
|
23
|
-
function
|
|
25
|
+
function p(t, n) {
|
|
24
26
|
return typeof t == "function" ? t(n) : t;
|
|
25
27
|
}
|
|
26
|
-
const
|
|
28
|
+
const g = (t) => typeof t.content == "string" ? t.content : t.content[0].text;
|
|
27
29
|
export {
|
|
28
30
|
c as callAll,
|
|
29
31
|
f as dataAttr,
|
|
30
32
|
i as getInitials,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
g as getMessageContent,
|
|
34
|
+
s as isString,
|
|
35
|
+
p as maybeRender,
|
|
34
36
|
o as parseIfJson,
|
|
35
|
-
|
|
37
|
+
a as toKebabCase
|
|
36
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@radix-ui/react-dismissable-layer": "^1.1.5",
|
|
28
28
|
"@radix-ui/react-focus-guards": "^1.1.1",
|
|
29
29
|
"@radix-ui/react-focus-scope": "^1.1.2",
|
|
30
|
+
"@radix-ui/react-hover-card": "^1.1.6",
|
|
30
31
|
"@radix-ui/react-id": "^1.1.0",
|
|
31
32
|
"@radix-ui/react-popover": "1.1.4",
|
|
32
33
|
"@radix-ui/react-presence": "^1.1.2",
|
|
@@ -53,9 +54,9 @@
|
|
|
53
54
|
"react-textarea-autosize": "8.5.7",
|
|
54
55
|
"rehype-raw": "7.0.0",
|
|
55
56
|
"unist-util-visit": "^5.0.0",
|
|
56
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
57
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
58
|
-
"@inkeep/cxkit-types": "0.5.
|
|
57
|
+
"@inkeep/cxkit-color-mode": "0.5.9",
|
|
58
|
+
"@inkeep/cxkit-theme": "0.5.9",
|
|
59
|
+
"@inkeep/cxkit-types": "0.5.9"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@biomejs/biome": "1.9.4",
|
package/dist/atoms/dialog.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("react"),w=require("@radix-ui/react-context"),m=require("@radix-ui/react-id"),M=require("@radix-ui/react-use-controllable-state"),k=require("@radix-ui/react-dismissable-layer"),H=require("@radix-ui/react-focus-scope"),b=require("@radix-ui/react-presence"),p=require("@radix-ui/react-primitive"),L=require("@radix-ui/react-focus-guards"),G=require("react-remove-scroll"),U=require("aria-hidden"),z=require("@radix-ui/react-slot"),C=require("../utils/compose-refs.cjs"),d=require("../utils/compose-event-handlers.cjs");function K(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const i=K(F),R="Dialog",[V,Y]=w.createContextScope(R),[Z,u]=V(R),O=e=>{const{__scopeDialog:o,children:t,open:s,defaultOpen:n,onOpenChange:c,modal:l=!0}=e,a=i.useRef(null),g=i.useRef(null),[f=!1,D]=M.useControllableState({prop:s,defaultProp:n,onChange:c});return r.jsx(Z,{scope:o,triggerRef:a,contentRef:g,contentId:m.useId(),titleId:m.useId(),descriptionId:m.useId(),open:f,onOpenChange:D,onOpenToggle:i.useCallback(()=>D(A=>!A),[D]),modal:l,children:t})};O.displayName=R;const E="DialogTrigger",j=i.forwardRef((e,o)=>{const{__scopeDialog:t,...s}=e,n=u(E,t),c=C.useComposedRefs(o,n.triggerRef);return r.jsx(p.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":_(n.open),...s,ref:c,onClick:d.composeEventHandlers(e.onClick,n.onOpenToggle)})});j.displayName=E;const h="DialogOverlay",I=i.forwardRef((e,o)=>r.jsx(b.Presence,{present:!0,children:r.jsx(B,{...e,ref:o})}));I.displayName=h;const B=i.forwardRef((e,o)=>{const{__scopeDialog:t,...s}=e,n=u(h,t);return r.jsx(G.RemoveScroll,{as:z.Slot,allowPinchZoom:!0,shards:[n.contentRef],enabled:n.open,children:r.jsx(p.Primitive.div,{"data-state":_(n.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),v="DialogContent",x=i.forwardRef((e,o)=>r.jsx(b.Presence,{present:!0,children:r.jsx(J,{...e,ref:o})}));x.displayName=v;const J=i.forwardRef((e,o)=>{const t=u(v,e.__scopeDialog),s=i.useRef(null),n=C.useComposedRefs(o,t.contentRef,s);return i.useEffect(()=>{const c=s.current;if(c)return U.hideOthers(c)},[]),r.jsx(Q,{...e,ref:n,trapFocus:t.open,disableOutsidePointerEvents:!1,onCloseAutoFocus:d.composeEventHandlers(e.onCloseAutoFocus,c=>{c.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:d.composeEventHandlers(e.onPointerDownOutside,c=>{if(!t.open)return;const l=c.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&c.preventDefault()}),onFocusOutside:d.composeEventHandlers(e.onFocusOutside,c=>{c.preventDefault()})})}),Q=i.forwardRef((e,o)=>{const{__scopeDialog:t,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:c,...l}=e,a=u(v,t),g=i.useRef(null),f=C.useComposedRefs(o,g);return L.useFocusGuards(),r.jsx(r.Fragment,{children:r.jsx(H.FocusScope,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:c,children:r.jsx(k.DismissableLayer,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":_(a.open),...l,ref:f,onDismiss:()=>a.onOpenChange(!1)})})})}),T="DialogTitle",y=i.forwardRef((e,o)=>{const{__scopeDialog:t,...s}=e,n=u(T,t);return r.jsx(p.Primitive.h2,{id:n.titleId,...s,ref:o})});y.displayName=T;const N="DialogDescription",S=i.forwardRef((e,o)=>{const{__scopeDialog:t,...s}=e,n=u(N,t);return r.jsx(p.Primitive.p,{id:n.descriptionId,...s,ref:o})});S.displayName=N;const q="DialogClose",P=i.forwardRef((e,o)=>{const{__scopeDialog:t,...s}=e,n=u(q,t);return r.jsx(p.Primitive.button,{type:"button",...s,ref:o,onClick:d.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});P.displayName=q;function _(e){return e?"open":"closed"}const W=O,X=I,$=x,ee=y,oe=P;exports.Close=oe;exports.Content=$;exports.Dialog=O;exports.DialogClose=P;exports.DialogContent=x;exports.DialogDescription=S;exports.DialogTitle=y;exports.DialogTrigger=j;exports.Overlay=X;exports.Root=W;exports.Title=ee;exports.createDialogScope=Y;
|
package/dist/atoms/dialog.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as i, Fragment as w } from "react/jsx-runtime";
|
|
3
|
-
import * as c from "react";
|
|
4
|
-
import { createContextScope as M } from "@radix-ui/react-context";
|
|
5
|
-
import { useId as D } from "@radix-ui/react-id";
|
|
6
|
-
import { useControllableState as S } from "@radix-ui/react-use-controllable-state";
|
|
7
|
-
import { DismissableLayer as k } from "@radix-ui/react-dismissable-layer";
|
|
8
|
-
import { FocusScope as L } from "@radix-ui/react-focus-scope";
|
|
9
|
-
import { Presence as h } from "@radix-ui/react-presence";
|
|
10
|
-
import { Primitive as f } from "@radix-ui/react-primitive";
|
|
11
|
-
import { useFocusGuards as G } from "@radix-ui/react-focus-guards";
|
|
12
|
-
import { RemoveScroll as j } from "react-remove-scroll";
|
|
13
|
-
import { hideOthers as H } from "aria-hidden";
|
|
14
|
-
import { Slot as K } from "@radix-ui/react-slot";
|
|
15
|
-
import { useComposedRefs as R } from "../utils/compose-refs.js";
|
|
16
|
-
import { composeEventHandlers as u } from "../utils/compose-event-handlers.js";
|
|
17
|
-
const C = "Dialog", [U, lo] = M(C), [V, p] = U(C), y = (o) => {
|
|
18
|
-
const { __scopeDialog: t, children: n, open: r, defaultOpen: e, onOpenChange: s, modal: l = !0 } = o, a = c.useRef(null), d = c.useRef(null), [g = !1, m] = S({
|
|
19
|
-
prop: r,
|
|
20
|
-
defaultProp: e,
|
|
21
|
-
onChange: s
|
|
22
|
-
});
|
|
23
|
-
return /* @__PURE__ */ i(
|
|
24
|
-
V,
|
|
25
|
-
{
|
|
26
|
-
scope: t,
|
|
27
|
-
triggerRef: a,
|
|
28
|
-
contentRef: d,
|
|
29
|
-
contentId: D(),
|
|
30
|
-
titleId: D(),
|
|
31
|
-
descriptionId: D(),
|
|
32
|
-
open: g,
|
|
33
|
-
onOpenChange: m,
|
|
34
|
-
onOpenToggle: c.useCallback(() => m((F) => !F), [m]),
|
|
35
|
-
modal: l,
|
|
36
|
-
children: n
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
y.displayName = C;
|
|
41
|
-
const E = "DialogTrigger", Y = c.forwardRef(
|
|
42
|
-
(o, t) => {
|
|
43
|
-
const { __scopeDialog: n, ...r } = o, e = p(E, n), s = R(t, e.triggerRef);
|
|
44
|
-
return /* @__PURE__ */ i(
|
|
45
|
-
f.button,
|
|
46
|
-
{
|
|
47
|
-
type: "button",
|
|
48
|
-
"aria-haspopup": "dialog",
|
|
49
|
-
"aria-expanded": e.open,
|
|
50
|
-
"aria-controls": e.contentId,
|
|
51
|
-
"data-state": _(e.open),
|
|
52
|
-
...r,
|
|
53
|
-
ref: s,
|
|
54
|
-
onClick: u(o.onClick, e.onOpenToggle)
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
Y.displayName = E;
|
|
60
|
-
const I = "DialogOverlay", N = c.forwardRef(
|
|
61
|
-
(o, t) => /* @__PURE__ */ i(h, { present: !0, children: /* @__PURE__ */ i(Z, { ...o, ref: t }) })
|
|
62
|
-
);
|
|
63
|
-
N.displayName = I;
|
|
64
|
-
const Z = c.forwardRef(
|
|
65
|
-
(o, t) => {
|
|
66
|
-
const { __scopeDialog: n, ...r } = o, e = p(I, n);
|
|
67
|
-
return (
|
|
68
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
69
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
70
|
-
/* @__PURE__ */ i(j, { as: K, allowPinchZoom: !0, shards: [e.contentRef], enabled: e.open, children: /* @__PURE__ */ i(
|
|
71
|
-
f.div,
|
|
72
|
-
{
|
|
73
|
-
"data-state": _(e.open),
|
|
74
|
-
...r,
|
|
75
|
-
ref: t,
|
|
76
|
-
style: { pointerEvents: "auto", ...r.style }
|
|
77
|
-
}
|
|
78
|
-
) })
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
), O = "DialogContent", v = c.forwardRef(
|
|
82
|
-
(o, t) => /* @__PURE__ */ i(h, { present: !0, children: /* @__PURE__ */ i(q, { ...o, ref: t }) })
|
|
83
|
-
);
|
|
84
|
-
v.displayName = O;
|
|
85
|
-
const q = c.forwardRef(
|
|
86
|
-
(o, t) => {
|
|
87
|
-
const n = p(O, o.__scopeDialog), r = c.useRef(null), e = R(t, n.contentRef, r);
|
|
88
|
-
return c.useEffect(() => {
|
|
89
|
-
const s = r.current;
|
|
90
|
-
if (s) return H(s);
|
|
91
|
-
}, []), /* @__PURE__ */ i(
|
|
92
|
-
z,
|
|
93
|
-
{
|
|
94
|
-
...o,
|
|
95
|
-
ref: e,
|
|
96
|
-
trapFocus: n.open,
|
|
97
|
-
disableOutsidePointerEvents: !1,
|
|
98
|
-
onCloseAutoFocus: u(o.onCloseAutoFocus, (s) => {
|
|
99
|
-
s.preventDefault(), n.triggerRef.current?.focus();
|
|
100
|
-
}),
|
|
101
|
-
onPointerDownOutside: u(o.onPointerDownOutside, (s) => {
|
|
102
|
-
if (!n.open) return;
|
|
103
|
-
const l = s.detail.originalEvent, a = l.button === 0 && l.ctrlKey === !0;
|
|
104
|
-
(l.button === 2 || a) && s.preventDefault();
|
|
105
|
-
}),
|
|
106
|
-
onFocusOutside: u(o.onFocusOutside, (s) => {
|
|
107
|
-
s.preventDefault();
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
), z = c.forwardRef(
|
|
113
|
-
(o, t) => {
|
|
114
|
-
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: e, onCloseAutoFocus: s, ...l } = o, a = p(O, n), d = c.useRef(null), g = R(t, d);
|
|
115
|
-
return G(), /* @__PURE__ */ i(w, { children: /* @__PURE__ */ i(
|
|
116
|
-
L,
|
|
117
|
-
{
|
|
118
|
-
asChild: !0,
|
|
119
|
-
loop: !0,
|
|
120
|
-
trapped: r,
|
|
121
|
-
onMountAutoFocus: e,
|
|
122
|
-
onUnmountAutoFocus: s,
|
|
123
|
-
children: /* @__PURE__ */ i(
|
|
124
|
-
k,
|
|
125
|
-
{
|
|
126
|
-
role: "dialog",
|
|
127
|
-
id: a.contentId,
|
|
128
|
-
"aria-describedby": a.descriptionId,
|
|
129
|
-
"aria-labelledby": a.titleId,
|
|
130
|
-
"data-state": _(a.open),
|
|
131
|
-
...l,
|
|
132
|
-
ref: g,
|
|
133
|
-
onDismiss: () => a.onOpenChange(!1)
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
) });
|
|
138
|
-
}
|
|
139
|
-
), P = "DialogTitle", b = c.forwardRef(
|
|
140
|
-
(o, t) => {
|
|
141
|
-
const { __scopeDialog: n, ...r } = o, e = p(P, n);
|
|
142
|
-
return /* @__PURE__ */ i(f.h2, { id: e.titleId, ...r, ref: t });
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
b.displayName = P;
|
|
146
|
-
const A = "DialogDescription", B = c.forwardRef(
|
|
147
|
-
(o, t) => {
|
|
148
|
-
const { __scopeDialog: n, ...r } = o, e = p(A, n);
|
|
149
|
-
return /* @__PURE__ */ i(f.p, { id: e.descriptionId, ...r, ref: t });
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
B.displayName = A;
|
|
153
|
-
const T = "DialogClose", x = c.forwardRef(
|
|
154
|
-
(o, t) => {
|
|
155
|
-
const { __scopeDialog: n, ...r } = o, e = p(T, n);
|
|
156
|
-
return /* @__PURE__ */ i(
|
|
157
|
-
f.button,
|
|
158
|
-
{
|
|
159
|
-
type: "button",
|
|
160
|
-
...r,
|
|
161
|
-
ref: t,
|
|
162
|
-
onClick: u(o.onClick, () => e.onOpenChange(!1))
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
x.displayName = T;
|
|
168
|
-
function _(o) {
|
|
169
|
-
return o ? "open" : "closed";
|
|
170
|
-
}
|
|
171
|
-
const po = y, uo = N, fo = v, go = b, mo = x;
|
|
172
|
-
export {
|
|
173
|
-
mo as Close,
|
|
174
|
-
fo as Content,
|
|
175
|
-
y as Dialog,
|
|
176
|
-
x as DialogClose,
|
|
177
|
-
v as DialogContent,
|
|
178
|
-
B as DialogDescription,
|
|
179
|
-
b as DialogTitle,
|
|
180
|
-
Y as DialogTrigger,
|
|
181
|
-
uo as Overlay,
|
|
182
|
-
po as Root,
|
|
183
|
-
go as Title,
|
|
184
|
-
lo as createDialogScope
|
|
185
|
-
};
|