@inkeep/cxkit-primitives 0.5.47 → 0.5.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),k=require("react"),f=require("@radix-ui/primitive"),O=require("@radix-ui/react-compose-refs"),L=require("@radix-ui/react-context"),m=require("@radix-ui/react-id"),H=require("@radix-ui/react-use-controllable-state"),G=require("@radix-ui/react-dismissable-layer"),U=require("@radix-ui/react-focus-scope");require("@radix-ui/react-portal");const I=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),z=require("@radix-ui/react-focus-guards"),K=require("react-remove-scroll"),V=require("aria-hidden"),Y=require("@radix-ui/react-slot");function Z(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(s,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return s.default=e,Object.freeze(s)}const i=Z(k),P="Dialog",[j,B]=L.createContextScope(P),[J,l]=j(P),_=e=>{const{__scopeDialog:s,children:o,open:r,defaultOpen:n,onOpenChange:t,modal:u=!0}=e,a=i.useRef(null),p=i.useRef(null),[C=!1,R]=H.useControllableState({prop:r,defaultProp:n,onChange:t});return c.jsx(J,{scope:s,triggerRef:a,contentRef:p,contentId:m.useId(),titleId:m.useId(),descriptionId:m.useId(),open:C,onOpenChange:R,onOpenToggle:i.useCallback(()=>R(w=>!w),[R]),modal:u,children:o})};_.displayName=P;const h="DialogTrigger",T=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(h,o),t=O.useComposedRefs(s,n.triggerRef);return c.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":b(n.open),...r,ref:t,onClick:f.composeEventHandlers(e.onClick,n.onOpenToggle)})});T.displayName=h;const Q="DialogPortal",[se,N]=j(Q,{forceMount:void 0}),D="DialogOverlay",x=i.forwardRef((e,s)=>{const o=N(D,e.__scopeDialog),{forceMount:r=o.forceMount,...n}=e,t=l(D,e.__scopeDialog);return t.modal?c.jsx(I.Presence,{present:r||t.open,children:c.jsx(W,{...n,ref:s})}):null});x.displayName=D;const W=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(D,o);return c.jsx(K.RemoveScroll,{as:Y.Slot,allowPinchZoom:!0,shards:[n.contentRef],children:c.jsx(g.Primitive.div,{"data-state":b(n.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),d="DialogContent",v=i.forwardRef((e,s)=>{const o=N(d,e.__scopeDialog),{forceMount:r=o.forceMount,...n}=e,t=l(d,e.__scopeDialog);return c.jsx(I.Presence,{present:r||t.open,children:t.modal?c.jsx(X,{...n,ref:s}):c.jsx($,{...n,ref:s})})});v.displayName=d;const X=i.forwardRef((e,s)=>{const o=l(d,e.__scopeDialog),r=i.useRef(null),n=O.useComposedRefs(s,o.contentRef,r);return i.useEffect(()=>{const t=r.current;if(t)return V.hideOthers(t)},[]),c.jsx(A,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f.composeEventHandlers(e.onCloseAutoFocus,t=>{t.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:f.composeEventHandlers(e.onPointerDownOutside,t=>{const u=t.detail.originalEvent,a=u.button===0&&u.ctrlKey===!0;(u.button===2||a)&&t.preventDefault()}),onFocusOutside:f.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),$=i.forwardRef((e,s)=>{const o=l(d,e.__scopeDialog),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(A,{...e,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||o.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const u=t.target;o.triggerRef.current?.contains(u)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),A=i.forwardRef((e,s)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:t,...u}=e,a=l(d,o),p=i.useRef(null),C=O.useComposedRefs(s,p);return z.useFocusGuards(),c.jsx(c.Fragment,{children:c.jsx(U.FocusScope,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:t,children:c.jsx(G.DismissableLayer,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":b(a.open),...u,ref:C,onDismiss:()=>a.onOpenChange(!1)})})})}),F="DialogTitle",y=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(F,o);return c.jsx(g.Primitive.h2,{id:n.titleId,...r,ref:s})});y.displayName=F;const M="DialogDescription",S=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(M,o);return c.jsx(g.Primitive.p,{id:n.descriptionId,...r,ref:s})});S.displayName=M;const q="DialogClose",E=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(q,o);return c.jsx(g.Primitive.button,{type:"button",...r,ref:s,onClick:f.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});E.displayName=q;function b(e){return e?"open":"closed"}const ee=_,te=x,oe=v,ne=y,re=E;exports.Close=re;exports.Content=oe;exports.Dialog=_;exports.DialogClose=E;exports.DialogContent=v;exports.DialogDescription=S;exports.DialogOverlay=x;exports.DialogTitle=y;exports.DialogTrigger=T;exports.Overlay=te;exports.Root=ee;exports.Title=ne;exports.createDialogScope=B;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),p=require("@radix-ui/primitive"),P=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),m=require("@radix-ui/react-id"),z=require("@radix-ui/react-use-controllable-state"),K=require("@radix-ui/react-dismissable-layer"),U=require("@zag-js/focus-trap"),V=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),Y=require("@radix-ui/react-focus-guards"),Z=require("react-remove-scroll"),B=require("aria-hidden"),J=require("@radix-ui/react-slot");function Q(e){const n=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(n,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=Q(T),x="Dialog",[N,W]=H.createContextScope(x),[X,l]=N(x),O=e=>{const{__scopeDialog:n,children:t,open:s,defaultOpen:o,onOpenChange:r,modal:a=!0}=e,u=c.useRef(null),f=c.useRef(null),[R=!1,C]=z.useControllableState({prop:s,defaultProp:o,onChange:r});return i.jsx(X,{scope:n,triggerRef:u,contentRef:f,contentId:m.useId(),titleId:m.useId(),descriptionId:m.useId(),open:R,onOpenChange:C,onOpenToggle:c.useCallback(()=>C(G=>!G),[C]),modal:a,children:t})};O.displayName=x;const M="DialogTrigger",S=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(M,t),r=P.useComposedRefs(n,o.triggerRef);return i.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":j(o.open),...s,ref:r,onClick:p.composeEventHandlers(e.onClick,o.onOpenToggle)})});S.displayName=M;const v="DialogPortal",[$,q]=N(v,{forceMount:void 0}),y=e=>{const{__scopeDialog:n,forceMount:t,children:s,container:o}=e,r=l(v,n);return i.jsx($,{scope:n,forceMount:t,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:t||r.open,children:i.jsx(V.Portal,{asChild:!0,container:o,children:a})}))})};y.displayName=v;const D="DialogOverlay",E=c.forwardRef((e,n)=>{const t=q(D,e.__scopeDialog),{forceMount:s=t.forceMount,...o}=e,r=l(D,e.__scopeDialog);return r.modal?i.jsx(_.Presence,{present:s||r.open,children:i.jsx(ee,{...o,ref:n})}):null});E.displayName=D;const ee=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(D,t);return i.jsx(Z.RemoveScroll,{as:J.Slot,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(g.Primitive.div,{"data-state":j(o.open),...s,ref:n,style:{pointerEvents:"auto",...s.style}})})}),d="DialogContent",b=c.forwardRef((e,n)=>{const t=q(d,e.__scopeDialog),{forceMount:s=t.forceMount,...o}=e,r=l(d,e.__scopeDialog);return i.jsx(_.Presence,{present:s||r.open,children:r.modal?i.jsx(te,{...o,ref:n}):i.jsx(oe,{...o,ref:n})})});b.displayName=d;const te=c.forwardRef((e,n)=>{const t=l(d,e.__scopeDialog),s=c.useRef(null),o=P.useComposedRefs(n,t.contentRef,s);return c.useEffect(()=>{const r=s.current;if(r)return B.hideOthers(r)},[]),i.jsx(w,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onPointerDownOutside:p.composeEventHandlers(e.onPointerDownOutside,r=>{const a=r.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&r.preventDefault()}),onFocusOutside:p.composeEventHandlers(e.onFocusOutside,r=>r.preventDefault())})}),oe=c.forwardRef((e,n)=>{const t=l(d,e.__scopeDialog),s=c.useRef(!1),o=c.useRef(!1);return i.jsx(w,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:r=>{e.onInteractOutside?.(r),r.defaultPrevented||(s.current=!0,r.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=r.target;t.triggerRef.current?.contains(a)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&o.current&&r.preventDefault()}})}),w=c.forwardRef((e,n)=>{const{__scopeDialog:t,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:r,...a}=e,u=l(d,t),f=c.useRef(null),R=P.useComposedRefs(n,f);return Y.useFocusGuards(),T.useEffect(()=>{if(s)return U.trapFocus(f.current,{preventScroll:!0,onActivate:o,onDeactivate:r})},[]),i.jsx(K.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":j(u.open),...a,ref:R,onDismiss:()=>u.onOpenChange(!1)})}),A="DialogTitle",h=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(A,t);return i.jsx(g.Primitive.h2,{id:o.titleId,...s,ref:n})});h.displayName=A;const F="DialogDescription",k=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(F,t);return i.jsx(g.Primitive.p,{id:o.descriptionId,...s,ref:n})});k.displayName=F;const L="DialogClose",I=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(L,t);return i.jsx(g.Primitive.button,{type:"button",...s,ref:n,onClick:p.composeEventHandlers(e.onClick,()=>o.onOpenChange(!1))})});I.displayName=L;function j(e){return e?"open":"closed"}const ne=O,re=y,se=E,ce=b,ie=h,ae=I;exports.Close=ae;exports.Content=ce;exports.Dialog=O;exports.DialogClose=I;exports.DialogContent=b;exports.DialogDescription=k;exports.DialogOverlay=E;exports.DialogPortal=y;exports.DialogTitle=h;exports.DialogTrigger=S;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=W;
@@ -1,216 +1,215 @@
1
1
  "use client";
2
- import { jsx as i, Fragment as k } from "react/jsx-runtime";
2
+ import { jsx as i } from "react/jsx-runtime";
3
3
  import * as c from "react";
4
- import { composeEventHandlers as d } from "@radix-ui/primitive";
4
+ import { useEffect as G } from "react";
5
+ import { composeEventHandlers as g } from "@radix-ui/primitive";
5
6
  import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
6
- import { createContextScope as L } from "@radix-ui/react-context";
7
+ import { createContextScope as $ } from "@radix-ui/react-context";
7
8
  import { useId as C } from "@radix-ui/react-id";
8
- import { useControllableState as G } from "@radix-ui/react-use-controllable-state";
9
- import { DismissableLayer as j } from "@radix-ui/react-dismissable-layer";
10
- import { FocusScope as H } from "@radix-ui/react-focus-scope";
11
- import "@radix-ui/react-portal";
12
- import { Presence as y } from "@radix-ui/react-presence";
13
- import { Primitive as p } from "@radix-ui/react-primitive";
14
- import { useFocusGuards as K } from "@radix-ui/react-focus-guards";
15
- import { RemoveScroll as U } from "react-remove-scroll";
16
- import { hideOthers as V } from "aria-hidden";
17
- import { Slot as Y } from "@radix-ui/react-slot";
18
- const O = "Dialog", [E, go] = L(O), [Z, l] = E(O), h = (o) => {
19
- const { __scopeDialog: s, children: r, open: n, defaultOpen: t, onOpenChange: e, modal: u = !0 } = o, a = c.useRef(null), g = c.useRef(null), [D = !1, R] = G({
20
- prop: n,
9
+ import { useControllableState as j } from "@radix-ui/react-use-controllable-state";
10
+ import { DismissableLayer as H } from "@radix-ui/react-dismissable-layer";
11
+ import { trapFocus as K } from "@zag-js/focus-trap";
12
+ import { Portal as V } from "@radix-ui/react-portal";
13
+ import { Presence as O } from "@radix-ui/react-presence";
14
+ import { Primitive as d } from "@radix-ui/react-primitive";
15
+ import { useFocusGuards as Y } from "@radix-ui/react-focus-guards";
16
+ import { RemoveScroll as Z } from "react-remove-scroll";
17
+ import { hideOthers as q } from "aria-hidden";
18
+ import { Slot as z } from "@radix-ui/react-slot";
19
+ const P = "Dialog", [E, Co] = $(P), [B, l] = E(P), I = (o) => {
20
+ const { __scopeDialog: n, children: r, open: s, defaultOpen: t, onOpenChange: e, modal: a = !0 } = o, f = c.useRef(null), p = c.useRef(null), [D = !1, R] = j({
21
+ prop: s,
21
22
  defaultProp: t,
22
23
  onChange: e
23
24
  });
24
25
  return /* @__PURE__ */ i(
25
- Z,
26
+ B,
26
27
  {
27
- scope: s,
28
- triggerRef: a,
29
- contentRef: g,
28
+ scope: n,
29
+ triggerRef: f,
30
+ contentRef: p,
30
31
  contentId: C(),
31
32
  titleId: C(),
32
33
  descriptionId: C(),
33
34
  open: D,
34
35
  onOpenChange: R,
35
- onOpenToggle: c.useCallback(() => R((S) => !S), [R]),
36
- modal: u,
36
+ onOpenToggle: c.useCallback(() => R((L) => !L), [R]),
37
+ modal: a,
37
38
  children: r
38
39
  }
39
40
  );
40
41
  };
41
- h.displayName = O;
42
- const I = "DialogTrigger", q = c.forwardRef(
43
- (o, s) => {
44
- const { __scopeDialog: r, ...n } = o, t = l(I, r), e = _(s, t.triggerRef);
42
+ I.displayName = P;
43
+ const v = "DialogTrigger", J = c.forwardRef(
44
+ (o, n) => {
45
+ const { __scopeDialog: r, ...s } = o, t = l(v, r), e = _(n, t.triggerRef);
45
46
  return /* @__PURE__ */ i(
46
- p.button,
47
+ d.button,
47
48
  {
48
49
  type: "button",
49
50
  "aria-haspopup": "dialog",
50
51
  "aria-expanded": t.open,
51
52
  "aria-controls": t.contentId,
52
- "data-state": P(t.open),
53
- ...n,
53
+ "data-state": y(t.open),
54
+ ...s,
54
55
  ref: e,
55
- onClick: d(o.onClick, t.onOpenToggle)
56
+ onClick: g(o.onClick, t.onOpenToggle)
56
57
  }
57
58
  );
58
59
  }
59
60
  );
60
- q.displayName = I;
61
- const z = "DialogPortal", [mo, v] = E(z, {
61
+ J.displayName = v;
62
+ const h = "DialogPortal", [Q, x] = E(h, {
62
63
  forceMount: void 0
63
- }), m = "DialogOverlay", x = c.forwardRef(
64
- (o, s) => {
65
- const r = v(m, o.__scopeDialog), { forceMount: n = r.forceMount, ...t } = o, e = l(m, o.__scopeDialog);
66
- return e.modal ? /* @__PURE__ */ i(y, { present: n || e.open, children: /* @__PURE__ */ i(B, { ...t, ref: s }) }) : null;
64
+ }), N = (o) => {
65
+ const { __scopeDialog: n, forceMount: r, children: s, container: t } = o, e = l(h, n);
66
+ return /* @__PURE__ */ i(Q, { scope: n, forceMount: r, children: c.Children.map(s, (a) => /* @__PURE__ */ i(O, { present: r || e.open, children: /* @__PURE__ */ i(V, { asChild: !0, container: t, children: a }) })) });
67
+ };
68
+ N.displayName = h;
69
+ const m = "DialogOverlay", T = c.forwardRef(
70
+ (o, n) => {
71
+ const r = x(m, o.__scopeDialog), { forceMount: s = r.forceMount, ...t } = o, e = l(m, o.__scopeDialog);
72
+ return e.modal ? /* @__PURE__ */ i(O, { present: s || e.open, children: /* @__PURE__ */ i(U, { ...t, ref: n }) }) : null;
67
73
  }
68
74
  );
69
- x.displayName = m;
70
- const B = c.forwardRef(
71
- (o, s) => {
72
- const { __scopeDialog: r, ...n } = o, t = l(m, r);
75
+ T.displayName = m;
76
+ const U = c.forwardRef(
77
+ (o, n) => {
78
+ const { __scopeDialog: r, ...s } = o, t = l(m, r);
73
79
  return (
74
80
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
75
81
  // ie. when `Overlay` and `Content` are siblings
76
- /* @__PURE__ */ i(U, { as: Y, allowPinchZoom: !0, shards: [t.contentRef], children: /* @__PURE__ */ i(
77
- p.div,
82
+ /* @__PURE__ */ i(Z, { as: z, allowPinchZoom: !0, shards: [t.contentRef], children: /* @__PURE__ */ i(
83
+ d.div,
78
84
  {
79
- "data-state": P(t.open),
80
- ...n,
81
- ref: s,
82
- style: { pointerEvents: "auto", ...n.style }
85
+ "data-state": y(t.open),
86
+ ...s,
87
+ ref: n,
88
+ style: { pointerEvents: "auto", ...s.style }
83
89
  }
84
90
  ) })
85
91
  );
86
92
  }
87
- ), f = "DialogContent", A = c.forwardRef(
88
- (o, s) => {
89
- const r = v(f, o.__scopeDialog), { forceMount: n = r.forceMount, ...t } = o, e = l(f, o.__scopeDialog);
90
- return /* @__PURE__ */ i(y, { present: n || e.open, children: e.modal ? /* @__PURE__ */ i(J, { ...t, ref: s }) : /* @__PURE__ */ i(Q, { ...t, ref: s }) });
93
+ ), u = "DialogContent", M = c.forwardRef(
94
+ (o, n) => {
95
+ const r = x(u, o.__scopeDialog), { forceMount: s = r.forceMount, ...t } = o, e = l(u, o.__scopeDialog);
96
+ return /* @__PURE__ */ i(O, { present: s || e.open, children: e.modal ? /* @__PURE__ */ i(W, { ...t, ref: n }) : /* @__PURE__ */ i(X, { ...t, ref: n }) });
91
97
  }
92
98
  );
93
- A.displayName = f;
94
- const J = c.forwardRef(
95
- (o, s) => {
96
- const r = l(f, o.__scopeDialog), n = c.useRef(null), t = _(s, r.contentRef, n);
99
+ M.displayName = u;
100
+ const W = c.forwardRef(
101
+ (o, n) => {
102
+ const r = l(u, o.__scopeDialog), s = c.useRef(null), t = _(n, r.contentRef, s);
97
103
  return c.useEffect(() => {
98
- const e = n.current;
99
- if (e) return V(e);
104
+ const e = s.current;
105
+ if (e) return q(e);
100
106
  }, []), /* @__PURE__ */ i(
101
- N,
107
+ b,
102
108
  {
103
109
  ...o,
104
110
  ref: t,
105
111
  trapFocus: r.open,
106
112
  disableOutsidePointerEvents: !0,
107
- onCloseAutoFocus: d(o.onCloseAutoFocus, (e) => {
108
- e.preventDefault(), r.triggerRef.current?.focus();
109
- }),
110
- onPointerDownOutside: d(o.onPointerDownOutside, (e) => {
111
- const u = e.detail.originalEvent, a = u.button === 0 && u.ctrlKey === !0;
112
- (u.button === 2 || a) && e.preventDefault();
113
+ onPointerDownOutside: g(o.onPointerDownOutside, (e) => {
114
+ const a = e.detail.originalEvent, f = a.button === 0 && a.ctrlKey === !0;
115
+ (a.button === 2 || f) && e.preventDefault();
113
116
  }),
114
- onFocusOutside: d(
117
+ onFocusOutside: g(
115
118
  o.onFocusOutside,
116
119
  (e) => e.preventDefault()
117
120
  )
118
121
  }
119
122
  );
120
123
  }
121
- ), Q = c.forwardRef(
122
- (o, s) => {
123
- const r = l(f, o.__scopeDialog), n = c.useRef(!1), t = c.useRef(!1);
124
+ ), X = c.forwardRef(
125
+ (o, n) => {
126
+ const r = l(u, o.__scopeDialog), s = c.useRef(!1), t = c.useRef(!1);
124
127
  return /* @__PURE__ */ i(
125
- N,
128
+ b,
126
129
  {
127
130
  ...o,
128
- ref: s,
131
+ ref: n,
129
132
  trapFocus: !1,
130
133
  disableOutsidePointerEvents: !1,
131
- onCloseAutoFocus: (e) => {
132
- o.onCloseAutoFocus?.(e), e.defaultPrevented || (n.current || r.triggerRef.current?.focus(), e.preventDefault()), n.current = !1, t.current = !1;
133
- },
134
134
  onInteractOutside: (e) => {
135
- o.onInteractOutside?.(e), e.defaultPrevented || (n.current = !0, e.detail.originalEvent.type === "pointerdown" && (t.current = !0));
136
- const u = e.target;
137
- r.triggerRef.current?.contains(u) && e.preventDefault(), e.detail.originalEvent.type === "focusin" && t.current && e.preventDefault();
135
+ o.onInteractOutside?.(e), e.defaultPrevented || (s.current = !0, e.detail.originalEvent.type === "pointerdown" && (t.current = !0));
136
+ const a = e.target;
137
+ r.triggerRef.current?.contains(a) && e.preventDefault(), e.detail.originalEvent.type === "focusin" && t.current && e.preventDefault();
138
138
  }
139
139
  }
140
140
  );
141
141
  }
142
- ), N = c.forwardRef(
143
- (o, s) => {
144
- const { __scopeDialog: r, trapFocus: n, onOpenAutoFocus: t, onCloseAutoFocus: e, ...u } = o, a = l(f, r), g = c.useRef(null), D = _(s, g);
145
- return K(), /* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(
142
+ ), b = c.forwardRef(
143
+ (o, n) => {
144
+ const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: t, onCloseAutoFocus: e, ...a } = o, f = l(u, r), p = c.useRef(null), D = _(n, p);
145
+ return Y(), G(() => {
146
+ if (s)
147
+ return K(p.current, {
148
+ preventScroll: !0,
149
+ onActivate: t,
150
+ onDeactivate: e
151
+ });
152
+ }, []), /* @__PURE__ */ i(
146
153
  H,
147
154
  {
148
- asChild: !0,
149
- loop: !0,
150
- trapped: n,
151
- onMountAutoFocus: t,
152
- onUnmountAutoFocus: e,
153
- children: /* @__PURE__ */ i(
154
- j,
155
- {
156
- role: "dialog",
157
- id: a.contentId,
158
- "aria-describedby": a.descriptionId,
159
- "aria-labelledby": a.titleId,
160
- "data-state": P(a.open),
161
- ...u,
162
- ref: D,
163
- onDismiss: () => a.onOpenChange(!1)
164
- }
165
- )
155
+ role: "dialog",
156
+ id: f.contentId,
157
+ "aria-describedby": f.descriptionId,
158
+ "aria-labelledby": f.titleId,
159
+ "data-state": y(f.open),
160
+ ...a,
161
+ ref: D,
162
+ onDismiss: () => f.onOpenChange(!1)
166
163
  }
167
- ) });
164
+ );
168
165
  }
169
- ), T = "DialogTitle", F = c.forwardRef(
170
- (o, s) => {
171
- const { __scopeDialog: r, ...n } = o, t = l(T, r);
172
- return /* @__PURE__ */ i(p.h2, { id: t.titleId, ...n, ref: s });
166
+ ), w = "DialogTitle", A = c.forwardRef(
167
+ (o, n) => {
168
+ const { __scopeDialog: r, ...s } = o, t = l(w, r);
169
+ return /* @__PURE__ */ i(d.h2, { id: t.titleId, ...s, ref: n });
173
170
  }
174
171
  );
175
- F.displayName = T;
176
- const M = "DialogDescription", W = c.forwardRef(
177
- (o, s) => {
178
- const { __scopeDialog: r, ...n } = o, t = l(M, r);
179
- return /* @__PURE__ */ i(p.p, { id: t.descriptionId, ...n, ref: s });
172
+ A.displayName = w;
173
+ const F = "DialogDescription", oo = c.forwardRef(
174
+ (o, n) => {
175
+ const { __scopeDialog: r, ...s } = o, t = l(F, r);
176
+ return /* @__PURE__ */ i(d.p, { id: t.descriptionId, ...s, ref: n });
180
177
  }
181
178
  );
182
- W.displayName = M;
183
- const b = "DialogClose", w = c.forwardRef(
184
- (o, s) => {
185
- const { __scopeDialog: r, ...n } = o, t = l(b, r);
179
+ oo.displayName = F;
180
+ const S = "DialogClose", k = c.forwardRef(
181
+ (o, n) => {
182
+ const { __scopeDialog: r, ...s } = o, t = l(S, r);
186
183
  return /* @__PURE__ */ i(
187
- p.button,
184
+ d.button,
188
185
  {
189
186
  type: "button",
190
- ...n,
191
- ref: s,
192
- onClick: d(o.onClick, () => t.onOpenChange(!1))
187
+ ...s,
188
+ ref: n,
189
+ onClick: g(o.onClick, () => t.onOpenChange(!1))
193
190
  }
194
191
  );
195
192
  }
196
193
  );
197
- w.displayName = b;
198
- function P(o) {
194
+ k.displayName = S;
195
+ function y(o) {
199
196
  return o ? "open" : "closed";
200
197
  }
201
- const Do = h, Ro = x, Co = A, _o = F, Oo = w;
198
+ const _o = I, Oo = N, Po = T, ho = M, yo = A, Eo = k;
202
199
  export {
203
- Oo as Close,
204
- Co as Content,
205
- h as Dialog,
206
- w as DialogClose,
207
- A as DialogContent,
208
- W as DialogDescription,
209
- x as DialogOverlay,
210
- F as DialogTitle,
211
- q as DialogTrigger,
212
- Ro as Overlay,
213
- Do as Root,
214
- _o as Title,
215
- go as createDialogScope
200
+ Eo as Close,
201
+ ho as Content,
202
+ I as Dialog,
203
+ k as DialogClose,
204
+ M as DialogContent,
205
+ oo as DialogDescription,
206
+ T as DialogOverlay,
207
+ N as DialogPortal,
208
+ A as DialogTitle,
209
+ J as DialogTrigger,
210
+ Po as Overlay,
211
+ Oo as Portal,
212
+ _o as Root,
213
+ yo as Title,
214
+ Co as createDialogScope
216
215
  };
package/dist/index.d.cts CHANGED
@@ -22,7 +22,6 @@ import { FeebackReason } from '@inkeep/cxkit-types';
22
22
  import { FeedbackItemType } from '@inkeep/cxkit-types';
23
23
  import { FeedbackType } from '@inkeep/cxkit-types';
24
24
  import { FieldErrors } from 'react-hook-form';
25
- import { FocusScope } from '@radix-ui/react-focus-scope';
26
25
  import { FormField } from '@inkeep/cxkit-types';
27
26
  import { FormHTMLAttributes } from 'react';
28
27
  import { ForwardRefExoticComponent } from 'react';
@@ -54,7 +53,6 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
54
53
  import { Portal as Portal_2 } from '@radix-ui/react-portal';
55
54
  import { Primitive } from '@radix-ui/react-primitive';
56
55
  import { PropsWithChildren } from 'react';
57
- import * as RadixDialog from '@radix-ui/react-dialog';
58
56
  import * as React_2 from 'react';
59
57
  import { ReactElement } from 'react';
60
58
  import { ReactNode } from 'react';
@@ -74,6 +72,7 @@ import { ToolCallAction } from '@inkeep/cxkit-types';
74
72
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
75
73
  import { TopLevelHeading } from '@inkeep/cxkit-types';
76
74
  import { TransformedSource } from '@inkeep/cxkit-types';
75
+ import { TrapFocusOptions } from '@zag-js/focus-trap';
77
76
  import { UrlQueryParam } from '@inkeep/cxkit-types';
78
77
  import { UserProperties as UserProperties_2 } from '@inkeep/cxkit-types';
79
78
  import { Workflow } from '@inkeep/cxkit-types';
@@ -548,7 +547,7 @@ export declare const Command: React_2.ForwardRefExoticComponent<Children & Omit<
548
547
  /** Whether this separator should always be rendered. Useful if you disable automatic filtering. */
549
548
  alwaysRender?: boolean;
550
549
  } & React_2.RefAttributes<HTMLDivElement>>;
551
- Dialog: React_2.ForwardRefExoticComponent<RadixDialog.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
550
+ Dialog: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
552
551
  asChild?: boolean;
553
552
  }, "ref"> & {
554
553
  /**
@@ -620,7 +619,7 @@ export declare const Command: React_2.ForwardRefExoticComponent<Children & Omit<
620
619
  /**
621
620
  * Renders the command menu in a Radix Dialog.
622
621
  */
623
- export declare const CommandDialog: React_2.ForwardRefExoticComponent<RadixDialog.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
622
+ export declare const CommandDialog: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
624
623
  asChild?: boolean;
625
624
  }, "ref"> & {
626
625
  /**
@@ -1443,17 +1442,17 @@ declare interface DialogContentImplProps extends Omit<DismissableLayerProps, 'on
1443
1442
  * pointer, or a programmatic focus.
1444
1443
  * @defaultValue false
1445
1444
  */
1446
- trapFocus?: FocusScopeProps['trapped'];
1445
+ trapFocus?: boolean;
1447
1446
  /**
1448
1447
  * Event handler called when auto-focusing on open.
1449
1448
  * Can be prevented.
1450
1449
  */
1451
- onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
1450
+ onOpenAutoFocus?: TrapFocusOptions['onActivate'];
1452
1451
  /**
1453
1452
  * Event handler called when auto-focusing on close.
1454
1453
  * Can be prevented.
1455
1454
  */
1456
- onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
1455
+ onCloseAutoFocus?: TrapFocusOptions['onDeactivate'];
1457
1456
  }
1458
1457
 
1459
1458
  declare interface DialogContentProps extends DialogContentTypeProps {
@@ -2717,8 +2716,6 @@ export declare const FeedbackProvider: React.FC<{
2717
2716
  children: React.ReactNode;
2718
2717
  }>;
2719
2718
 
2720
- declare type FocusScopeProps = React_2.ComponentPropsWithoutRef<typeof FocusScope>;
2721
-
2722
2719
  declare type FormErrors = Record<'title' | 'content', string | undefined>;
2723
2720
 
2724
2721
  export declare interface FormFieldContextValue extends FormFieldCtx {
package/dist/index.d.ts CHANGED
@@ -22,7 +22,6 @@ import { FeebackReason } from '@inkeep/cxkit-types';
22
22
  import { FeedbackItemType } from '@inkeep/cxkit-types';
23
23
  import { FeedbackType } from '@inkeep/cxkit-types';
24
24
  import { FieldErrors } from 'react-hook-form';
25
- import { FocusScope } from '@radix-ui/react-focus-scope';
26
25
  import { FormField } from '@inkeep/cxkit-types';
27
26
  import { FormHTMLAttributes } from 'react';
28
27
  import { ForwardRefExoticComponent } from 'react';
@@ -54,7 +53,6 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
54
53
  import { Portal as Portal_2 } from '@radix-ui/react-portal';
55
54
  import { Primitive } from '@radix-ui/react-primitive';
56
55
  import { PropsWithChildren } from 'react';
57
- import * as RadixDialog from '@radix-ui/react-dialog';
58
56
  import * as React_2 from 'react';
59
57
  import { ReactElement } from 'react';
60
58
  import { ReactNode } from 'react';
@@ -74,6 +72,7 @@ import { ToolCallAction } from '@inkeep/cxkit-types';
74
72
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
75
73
  import { TopLevelHeading } from '@inkeep/cxkit-types';
76
74
  import { TransformedSource } from '@inkeep/cxkit-types';
75
+ import { TrapFocusOptions } from '@zag-js/focus-trap';
77
76
  import { UrlQueryParam } from '@inkeep/cxkit-types';
78
77
  import { UserProperties as UserProperties_2 } from '@inkeep/cxkit-types';
79
78
  import { Workflow } from '@inkeep/cxkit-types';
@@ -548,7 +547,7 @@ export declare const Command: React_2.ForwardRefExoticComponent<Children & Omit<
548
547
  /** Whether this separator should always be rendered. Useful if you disable automatic filtering. */
549
548
  alwaysRender?: boolean;
550
549
  } & React_2.RefAttributes<HTMLDivElement>>;
551
- Dialog: React_2.ForwardRefExoticComponent<RadixDialog.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
550
+ Dialog: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
552
551
  asChild?: boolean;
553
552
  }, "ref"> & {
554
553
  /**
@@ -620,7 +619,7 @@ export declare const Command: React_2.ForwardRefExoticComponent<Children & Omit<
620
619
  /**
621
620
  * Renders the command menu in a Radix Dialog.
622
621
  */
623
- export declare const CommandDialog: React_2.ForwardRefExoticComponent<RadixDialog.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
622
+ export declare const CommandDialog: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogProps & Children & Omit<React_2.ClassAttributes<HTMLDivElement> & React_2.HTMLAttributes<HTMLDivElement> & {
624
623
  asChild?: boolean;
625
624
  }, "ref"> & {
626
625
  /**
@@ -1443,17 +1442,17 @@ declare interface DialogContentImplProps extends Omit<DismissableLayerProps, 'on
1443
1442
  * pointer, or a programmatic focus.
1444
1443
  * @defaultValue false
1445
1444
  */
1446
- trapFocus?: FocusScopeProps['trapped'];
1445
+ trapFocus?: boolean;
1447
1446
  /**
1448
1447
  * Event handler called when auto-focusing on open.
1449
1448
  * Can be prevented.
1450
1449
  */
1451
- onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
1450
+ onOpenAutoFocus?: TrapFocusOptions['onActivate'];
1452
1451
  /**
1453
1452
  * Event handler called when auto-focusing on close.
1454
1453
  * Can be prevented.
1455
1454
  */
1456
- onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
1455
+ onCloseAutoFocus?: TrapFocusOptions['onDeactivate'];
1457
1456
  }
1458
1457
 
1459
1458
  declare interface DialogContentProps extends DialogContentTypeProps {
@@ -2717,8 +2716,6 @@ export declare const FeedbackProvider: React.FC<{
2717
2716
  children: React.ReactNode;
2718
2717
  }>;
2719
2718
 
2720
- declare type FocusScopeProps = React_2.ComponentPropsWithoutRef<typeof FocusScope>;
2721
-
2722
2719
  declare type FormErrors = Record<'title' | 'content', string | undefined>;
2723
2720
 
2724
2721
  export declare interface FormFieldContextValue extends FormFieldCtx {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.47",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.49",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
7
7
  const u = x(void 0), U = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.47",
10
+ widgetLibraryVersion: "0.5.49",
11
11
  componentType: n,
12
12
  tags: i
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.47",
3
+ "version": "0.5.49",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -25,25 +25,25 @@
25
25
  "@radix-ui/react-checkbox": "1.1.3",
26
26
  "@radix-ui/react-compose-refs": "^1.1.1",
27
27
  "@radix-ui/react-context": "^1.1.1",
28
- "@radix-ui/react-dialog": "1.1.4",
29
28
  "@radix-ui/react-dismissable-layer": "^1.1.5",
30
29
  "@radix-ui/react-focus-guards": "^1.1.1",
31
30
  "@radix-ui/react-focus-scope": "^1.1.2",
32
31
  "@radix-ui/react-hover-card": "^1.1.6",
33
32
  "@radix-ui/react-id": "^1.1.0",
34
- "@radix-ui/react-popover": "1.1.4",
33
+ "@radix-ui/react-popover": "1.1.6",
35
34
  "@radix-ui/react-portal": "^1.1.4",
36
35
  "@radix-ui/react-presence": "^1.1.2",
37
36
  "@radix-ui/react-primitive": "^2.0.2",
38
37
  "@radix-ui/react-scroll-area": "1.2.2",
39
- "@radix-ui/react-select": "2.1.4",
38
+ "@radix-ui/react-select": "2.1.6",
40
39
  "@radix-ui/react-slot": "^1.1.2",
41
40
  "@radix-ui/react-tabs": "1.1.2",
42
41
  "@radix-ui/react-tooltip": "1.1.6",
42
+ "@radix-ui/react-use-callback-ref": "^1.1.0",
43
43
  "@radix-ui/react-use-controllable-state": "^1.1.0",
44
+ "@zag-js/focus-trap": "^1.7.0",
44
45
  "altcha-lib": "^1.2.0",
45
46
  "aria-hidden": "^1.2.4",
46
- "cmdk": "^1.0.4",
47
47
  "dequal": "^2.0.3",
48
48
  "humps": "2.0.1",
49
49
  "merge-anything": "5.1.7",
@@ -59,9 +59,9 @@
59
59
  "remark-gfm": "^4.0.1",
60
60
  "unist-util-visit": "^5.0.0",
61
61
  "use-sync-external-store": "^1.4.0",
62
- "@inkeep/cxkit-color-mode": "0.5.47",
63
- "@inkeep/cxkit-theme": "0.5.47",
64
- "@inkeep/cxkit-types": "0.5.47"
62
+ "@inkeep/cxkit-color-mode": "0.5.49",
63
+ "@inkeep/cxkit-theme": "0.5.49",
64
+ "@inkeep/cxkit-types": "0.5.49"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "1.9.4",