@progress/kendo-react-diagram 16.2.0-develop.1 → 16.2.0-develop.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/cdn/js/kendo-react-diagram.js +1 -1
  2. package/hooks/useDiagramTooltip.js +1 -1
  3. package/hooks/useDiagramTooltip.mjs +37 -37
  4. package/index.d.mts +3 -2
  5. package/index.d.ts +3 -2
  6. package/index.js +1 -1
  7. package/index.mjs +52 -44
  8. package/messages/index.d.ts +437 -0
  9. package/messages/index.js +8 -0
  10. package/messages/index.mjs +182 -0
  11. package/package-metadata.js +1 -1
  12. package/package-metadata.mjs +2 -2
  13. package/package.json +10 -4
  14. package/rich-text-editing/ConnectionEditingToolbar.d.ts +17 -0
  15. package/rich-text-editing/ConnectionEditingToolbar.js +8 -0
  16. package/rich-text-editing/ConnectionEditingToolbar.mjs +126 -0
  17. package/rich-text-editing/DiagramEditor.d.ts +13 -0
  18. package/rich-text-editing/DiagramEditor.js +8 -0
  19. package/rich-text-editing/DiagramEditor.mjs +197 -0
  20. package/rich-text-editing/DiagramEditorContext.d.ts +34 -0
  21. package/rich-text-editing/DiagramEditorContext.js +8 -0
  22. package/rich-text-editing/DiagramEditorContext.mjs +117 -0
  23. package/rich-text-editing/FloatingToolbarPopup.d.ts +38 -0
  24. package/rich-text-editing/FloatingToolbarPopup.js +8 -0
  25. package/rich-text-editing/FloatingToolbarPopup.mjs +97 -0
  26. package/rich-text-editing/Icons-Dropdown.d.ts +31 -0
  27. package/rich-text-editing/Icons-Dropdown.js +8 -0
  28. package/rich-text-editing/Icons-Dropdown.mjs +160 -0
  29. package/rich-text-editing/MainToolbar.d.ts +21 -0
  30. package/rich-text-editing/MainToolbar.js +8 -0
  31. package/rich-text-editing/MainToolbar.mjs +143 -0
  32. package/rich-text-editing/ShapeEditingToolbar.d.ts +18 -0
  33. package/rich-text-editing/ShapeEditingToolbar.js +8 -0
  34. package/rich-text-editing/ShapeEditingToolbar.mjs +154 -0
  35. package/rich-text-editing/TextEditingToolbar.d.ts +25 -0
  36. package/rich-text-editing/TextEditingToolbar.js +8 -0
  37. package/rich-text-editing/TextEditingToolbar.mjs +212 -0
  38. package/rich-text-editing/border-style.d.ts +15 -0
  39. package/rich-text-editing/border-style.js +8 -0
  40. package/rich-text-editing/border-style.mjs +39 -0
  41. package/rich-text-editing/border-width.d.ts +19 -0
  42. package/rich-text-editing/border-width.js +8 -0
  43. package/rich-text-editing/border-width.mjs +112 -0
  44. package/rich-text-editing/cap-type.d.ts +25 -0
  45. package/rich-text-editing/cap-type.js +8 -0
  46. package/rich-text-editing/cap-type.mjs +40 -0
  47. package/rich-text-editing/connection-style.d.ts +15 -0
  48. package/rich-text-editing/connection-style.js +8 -0
  49. package/rich-text-editing/connection-style.mjs +39 -0
  50. package/rich-text-editing/connection-types.d.ts +15 -0
  51. package/rich-text-editing/connection-types.js +8 -0
  52. package/rich-text-editing/connection-types.mjs +33 -0
  53. package/rich-text-editing/default-toolbar-tools.d.ts +77 -0
  54. package/rich-text-editing/default-toolbar-tools.js +8 -0
  55. package/rich-text-editing/default-toolbar-tools.mjs +63 -0
  56. package/rich-text-editing/index.d.ts +10 -0
  57. package/rich-text-editing/shapes-dropdown.d.ts +23 -0
  58. package/rich-text-editing/shapes-dropdown.js +8 -0
  59. package/rich-text-editing/shapes-dropdown.mjs +66 -0
  60. package/rich-text-editing/types.d.ts +14 -0
  61. package/rich-text-editing/utils.d.ts +48 -0
  62. package/rich-text-editing/utils.js +8 -0
  63. package/rich-text-editing/utils.mjs +42 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as l from "react";
9
+ import { Popup as D } from "@progress/kendo-react-popup";
10
+ import { EditingUtils as V, resolveFloatingToolbarPlacement as W } from "@progress/kendo-diagram-common";
11
+ const { floatingToolbarStyle: M } = V.Data, Y = {
12
+ horizontal: "center",
13
+ vertical: "center"
14
+ }, E = {
15
+ horizontal: "center",
16
+ vertical: "bottom"
17
+ }, j = {
18
+ horizontal: "center",
19
+ vertical: "top"
20
+ }, k = {
21
+ above: E,
22
+ below: j
23
+ }, P = {
24
+ left: 0,
25
+ top: 0
26
+ }, h = {
27
+ offset: P,
28
+ placement: "above",
29
+ visible: !1
30
+ }, z = (e, t) => ({
31
+ left: e.left + (t ? t.left : 0),
32
+ top: e.top + (t ? t.top : 0)
33
+ }), A = (e, t, s) => ({
34
+ offset: e || P,
35
+ placement: t,
36
+ visible: s
37
+ }), q = (e) => (e == null ? void 0 : e.vertical) === "top" ? "below" : "above", w = (e, t) => e.visible === t.visible && e.offset.left === t.offset.left && e.offset.top === t.offset.top && e.placement === t.placement, I = ({
38
+ show: e,
39
+ baseAnchor: t,
40
+ fallbackAnchor: s = null,
41
+ boundaryElement: p,
42
+ anchorAlign: O = Y,
43
+ popupAlign: T = E,
44
+ offset: f = P,
45
+ children: x
46
+ }) => {
47
+ const y = l.useRef(null), i = l.useRef(0), m = q(T), c = l.useMemo(() => t ? z(t, f) : null, [t, f]), v = l.useMemo(() => s ? z(s, f) : null, [s, f]), [u, b] = l.useState(() => c ? A(c, m, !0) : h), C = l.useCallback((o) => {
48
+ var a;
49
+ const r = (a = o == null ? void 0 : o.element) == null ? void 0 : a.querySelector(".k-popup");
50
+ y.current = r instanceof HTMLElement ? r : null, r instanceof HTMLElement && Object.keys(M).forEach((g) => {
51
+ const d = M[g];
52
+ r.style[g] = d;
53
+ });
54
+ }, []), R = e && !!t;
55
+ l.useLayoutEffect(() => {
56
+ var B, H;
57
+ if (!R || !c) {
58
+ b((n) => w(n, h) ? n : h);
59
+ return;
60
+ }
61
+ let o;
62
+ if (!p || !v) {
63
+ o = A(c, m, !0), b((n) => w(n, o) ? n : o);
64
+ return;
65
+ }
66
+ const r = ((B = y.current) == null ? void 0 : B.getBoundingClientRect().height) || i.current;
67
+ if (r > 0 && (i.current = r), i.current <= 0) {
68
+ o = A(c, m, !0), b((n) => w(n, o) ? n : o);
69
+ return;
70
+ }
71
+ const a = p.getBoundingClientRect(), d = (((H = p.ownerDocument) == null ? void 0 : H.defaultView) || window).scrollY;
72
+ o = W({
73
+ baseAnchor: c,
74
+ fallbackAnchor: v,
75
+ popupHeight: i.current,
76
+ boundaryTop: a.top + d,
77
+ boundaryBottom: a.bottom + d
78
+ }), b((n) => w(n, o) ? n : o);
79
+ }, [p, m, R, c, v]);
80
+ const F = R && (u.visible || i.current <= 0 || !p || !v), L = u.visible ? u.offset : c || P, S = u.visible ? k[u.placement] : T;
81
+ return /* @__PURE__ */ l.createElement(
82
+ D,
83
+ {
84
+ show: F,
85
+ anchorAlign: O,
86
+ popupAlign: S,
87
+ offset: L,
88
+ positionMode: "fixed",
89
+ ref: C,
90
+ animate: !1
91
+ },
92
+ x
93
+ );
94
+ };
95
+ export {
96
+ I as FloatingToolbarPopup
97
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { ButtonHandle } from '@progress/kendo-react-buttons';
9
+ import { SVGIcon } from '@progress/kendo-react-common';
10
+ import { DiagramEditorOverlayOwner } from '@progress/kendo-diagram-common';
11
+ import * as React from 'react';
12
+ interface IconsData {
13
+ label: string;
14
+ icon: SVGIcon;
15
+ value: string;
16
+ }
17
+ interface IconsDropdownProps {
18
+ value: any;
19
+ onSelect: (value: any) => void;
20
+ onOpenChange?: (open: boolean) => void;
21
+ data: IconsData[];
22
+ buttonIcon: SVGIcon;
23
+ buttonTitle: string;
24
+ columns: number;
25
+ active?: boolean;
26
+ popupClass?: string;
27
+ overlayOwner: DiagramEditorOverlayOwner;
28
+ }
29
+ /** @hidden */
30
+ export declare const IconsDropdown: React.ForwardRefExoticComponent<IconsDropdownProps & React.RefAttributes<ButtonHandle>>;
31
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),q=require("@progress/kendo-react-buttons"),P=require("@progress/kendo-react-common"),z=require("@progress/kendo-react-popup"),H=require("@progress/kendo-svg-icons"),S=require("./DiagramEditorContext.js"),K=require("./utils.js");function L(r){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const g=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(m,a,g.get?g:{enumerable:!0,get:()=>r[a]})}}return m.default=r,Object.freeze(m)}const t=L(F),_=t.forwardRef((r,m)=>{var C;const a=t.useRef(null),g=t.useRef(null),b=t.useRef(null),w=t.useRef(null),i=t.useRef(null),p=t.useRef(!1),{controller:I}=S.useDiagramEditorContext(),{open:f,setOpen:O}=S.useControlledDiagramOverlay(r.overlayOwner),{columns:v}=r,y=t.useRef(r);y.current=r,t.useImperativeHandle(m,()=>a.current,[]);const d=t.useCallback(e=>{var c,u;const n=typeof e=="function"?e(f):e;n!==f&&((u=(c=y.current).onOpenChange)==null||u.call(c,n),O(n))},[O,f]),M=t.useCallback(()=>{d(e=>(e&&(p.current=!0),!e))},[d]),N=t.useCallback(()=>{var R,E,T;let e=[];const n=(o,s)=>{var k;const D=e.indexOf(o)+s;(k=e.at(D%e.length))==null||k.focus()},c=(o,s)=>{var k;const D=e.indexOf(o)-s;(k=e.at((D+e.length)%e.length))==null||k.focus()};b.current=new P.Navigation({root:g,selectors:["button"],keyboardEvents:{keydown:{ArrowRight:(o,s,l)=>{l.preventDefault(),s.focusNext(o)},ArrowLeft:(o,s,l)=>{l.preventDefault(),s.focusPrevious(o)},ArrowDown:(o,s,l)=>{l.preventDefault(),n(o,v)},ArrowUp:(o,s,l)=>{l.preventDefault(),c(o,v)},Escape:(o,s,l)=>{l.preventDefault(),p.current=!0,d(!1)}}},tabIndex:0}),e=(R=b.current)==null?void 0:R.elements;const u=y.current.data.findIndex(o=>o.value===y.current.value);u>=0?(E=e[u])==null||E.focus():(T=b.current.first)==null||T.focus()},[v,d]),x=t.useCallback(()=>{var e,n;b.current=null,p.current&&((n=(e=a.current)==null?void 0:e.element)==null||n.focus(),p.current=!1)},[]),j=t.useCallback(e=>{var c,u;(c=i.current)==null||c.call(i);const n=(u=e==null?void 0:e.element)==null?void 0:u.querySelector(".k-popup");if(f&&n instanceof HTMLElement){w.current=n,i.current=I.registerSurface(n);return}w.current=null,i.current=null},[I,f]);t.useEffect(()=>{f||x()},[x,f]);const B=t.useMemo(()=>v!==4?{gridTemplateColumns:`repeat(${v}, max-content)`}:{},[v]),A=t.useCallback(e=>{var n;(n=b.current)==null||n.triggerKeyboardEvent(e)},[]),h=t.useCallback(e=>{var n,c,u,R;!((c=(n=a.current)==null?void 0:n.element)!=null&&c.contains(e.relatedTarget))&&!((u=g.current)!=null&&u.contains(e.relatedTarget))&&!((R=w.current)!=null&&R.contains(e.relatedTarget))&&d(!1)},[d]);return t.useEffect(()=>()=>{var e;(e=i.current)==null||e.call(i),i.current=null},[]),t.createElement(t.Fragment,null,t.createElement(q.Button,{svgIcon:r.buttonIcon,endIcon:t.createElement(P.SvgIcon,{icon:H.chevronDownIcon}),onClick:M,ref:a,type:"button",fillMode:"flat",togglable:r.active!==void 0,selected:r.active===!0,title:r.buttonTitle,"aria-label":r.buttonTitle}),t.createElement(z.Popup,{anchor:(C=a.current)==null?void 0:C.element,show:f,popupClass:r.popupClass,onOpen:N,ref:j},t.createElement("div",{className:"k-diagram-shapes-container",style:B,onKeyDown:A,ref:g,onBlur:h},r.data.map(({label:e,icon:n,value:c},u)=>t.createElement(q.Button,{key:e+u,fillMode:"flat",title:e,"aria-label":e,onClick:()=>{p.current=!0,d(!1),r.onSelect(c)},togglable:!0,selected:r.value===c,type:"button",svgIcon:n,iconSize:"large",...K.preventFocusSteal})))))});_.displayName="IconsDropdown";exports.IconsDropdown=_;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as t from "react";
9
+ import { Button as T } from "@progress/kendo-react-buttons";
10
+ import { Navigation as F, SvgIcon as H } from "@progress/kendo-react-common";
11
+ import { Popup as K } from "@progress/kendo-react-popup";
12
+ import { chevronDownIcon as L } from "@progress/kendo-svg-icons";
13
+ import { useDiagramEditorContext as S, useControlledDiagramOverlay as q } from "./DiagramEditorContext.mjs";
14
+ import { preventFocusSteal as z } from "./utils.mjs";
15
+ const U = t.forwardRef((o, N) => {
16
+ var C;
17
+ const d = t.useRef(null), x = t.useRef(null), v = t.useRef(null), k = t.useRef(null), s = t.useRef(null), g = t.useRef(!1), { controller: y } = S(), { open: f, setOpen: E } = q(o.overlayOwner), { columns: m } = o, R = t.useRef(o);
18
+ R.current = o, t.useImperativeHandle(N, () => d.current, []);
19
+ const i = t.useCallback(
20
+ (e) => {
21
+ var c, l;
22
+ const n = typeof e == "function" ? e(f) : e;
23
+ n !== f && ((l = (c = R.current).onOpenChange) == null || l.call(c, n), E(n));
24
+ },
25
+ [E, f]
26
+ ), A = t.useCallback(() => {
27
+ i((e) => (e && (g.current = !0), !e));
28
+ }, [i]), M = t.useCallback(() => {
29
+ var p, D, O;
30
+ let e = [];
31
+ const n = (r, a) => {
32
+ var b;
33
+ const w = e.indexOf(r) + a;
34
+ (b = e.at(w % e.length)) == null || b.focus();
35
+ }, c = (r, a) => {
36
+ var b;
37
+ const w = e.indexOf(r) - a;
38
+ (b = e.at((w + e.length) % e.length)) == null || b.focus();
39
+ };
40
+ v.current = new F({
41
+ root: x,
42
+ selectors: ["button"],
43
+ keyboardEvents: {
44
+ keydown: {
45
+ ArrowRight: (r, a, u) => {
46
+ u.preventDefault(), a.focusNext(r);
47
+ },
48
+ ArrowLeft: (r, a, u) => {
49
+ u.preventDefault(), a.focusPrevious(r);
50
+ },
51
+ ArrowDown: (r, a, u) => {
52
+ u.preventDefault(), n(r, m);
53
+ },
54
+ ArrowUp: (r, a, u) => {
55
+ u.preventDefault(), c(r, m);
56
+ },
57
+ Escape: (r, a, u) => {
58
+ u.preventDefault(), g.current = !0, i(!1);
59
+ }
60
+ }
61
+ },
62
+ tabIndex: 0
63
+ }), e = (p = v.current) == null ? void 0 : p.elements;
64
+ const l = R.current.data.findIndex((r) => r.value === R.current.value);
65
+ l >= 0 ? (D = e[l]) == null || D.focus() : (O = v.current.first) == null || O.focus();
66
+ }, [m, i]), I = t.useCallback(() => {
67
+ var e, n;
68
+ v.current = null, g.current && ((n = (e = d.current) == null ? void 0 : e.element) == null || n.focus(), g.current = !1);
69
+ }, []), P = t.useCallback(
70
+ (e) => {
71
+ var c, l;
72
+ (c = s.current) == null || c.call(s);
73
+ const n = (l = e == null ? void 0 : e.element) == null ? void 0 : l.querySelector(".k-popup");
74
+ if (f && n instanceof HTMLElement) {
75
+ k.current = n, s.current = y.registerSurface(n);
76
+ return;
77
+ }
78
+ k.current = null, s.current = null;
79
+ },
80
+ [y, f]
81
+ );
82
+ t.useEffect(() => {
83
+ f || I();
84
+ }, [I, f]);
85
+ const _ = t.useMemo(
86
+ () => m !== 4 ? {
87
+ // 4 columns is the default from the theme, so we don't need to set a style for that case
88
+ gridTemplateColumns: `repeat(${m}, max-content)`
89
+ } : {},
90
+ [m]
91
+ ), h = t.useCallback((e) => {
92
+ var n;
93
+ (n = v.current) == null || n.triggerKeyboardEvent(e);
94
+ }, []), B = t.useCallback(
95
+ (e) => {
96
+ var n, c, l, p;
97
+ !((c = (n = d.current) == null ? void 0 : n.element) != null && c.contains(e.relatedTarget)) && !((l = x.current) != null && l.contains(e.relatedTarget)) && !((p = k.current) != null && p.contains(e.relatedTarget)) && i(!1);
98
+ },
99
+ [i]
100
+ );
101
+ return t.useEffect(() => () => {
102
+ var e;
103
+ (e = s.current) == null || e.call(s), s.current = null;
104
+ }, []), /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
105
+ T,
106
+ {
107
+ svgIcon: o.buttonIcon,
108
+ endIcon: /* @__PURE__ */ t.createElement(H, { icon: L }),
109
+ onClick: A,
110
+ ref: d,
111
+ type: "button",
112
+ fillMode: "flat",
113
+ togglable: o.active !== void 0,
114
+ selected: o.active === !0,
115
+ title: o.buttonTitle,
116
+ "aria-label": o.buttonTitle
117
+ }
118
+ ), /* @__PURE__ */ t.createElement(
119
+ K,
120
+ {
121
+ anchor: (C = d.current) == null ? void 0 : C.element,
122
+ show: f,
123
+ popupClass: o.popupClass,
124
+ onOpen: M,
125
+ ref: P
126
+ },
127
+ /* @__PURE__ */ t.createElement(
128
+ "div",
129
+ {
130
+ className: "k-diagram-shapes-container",
131
+ style: _,
132
+ onKeyDown: h,
133
+ ref: x,
134
+ onBlur: B
135
+ },
136
+ o.data.map(({ label: e, icon: n, value: c }, l) => /* @__PURE__ */ t.createElement(
137
+ T,
138
+ {
139
+ key: e + l,
140
+ fillMode: "flat",
141
+ title: e,
142
+ "aria-label": e,
143
+ onClick: () => {
144
+ g.current = !0, i(!1), o.onSelect(c);
145
+ },
146
+ togglable: !0,
147
+ selected: o.value === c,
148
+ type: "button",
149
+ svgIcon: n,
150
+ iconSize: "large",
151
+ ...z
152
+ }
153
+ ))
154
+ )
155
+ ));
156
+ });
157
+ U.displayName = "IconsDropdown";
158
+ export {
159
+ U as IconsDropdown
160
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Diagram } from '@progress/kendo-diagram-common';
9
+ import { MainToolbarOptions } from './types';
10
+ import * as React from 'react';
11
+ /** @hidden */
12
+ export type MainToolbarMode = 'select' | 'hand' | 'text' | 'shape';
13
+ /** @hidden */
14
+ export type MainToolbarPosition = 'top' | 'bottom';
15
+ interface MainToolbarProps extends MainToolbarOptions {
16
+ diagram: Diagram | null;
17
+ visible?: boolean;
18
+ }
19
+ /** @hidden */
20
+ export declare const MainToolbar: (props: MainToolbarProps) => React.ReactPortal | null;
21
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react"),B=require("react-dom"),a=require("@progress/kendo-react-buttons"),L=require("@progress/kendo-react-popup"),w=require("@progress/kendo-diagram-common"),u=require("@progress/kendo-svg-icons"),O=require("@progress/kendo-react-intl"),e=require("../messages/index.js"),j=require("./shapes-dropdown.js"),m=require("./utils.js"),f=require("./DiagramEditorContext.js");function U(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const p=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,p.get?p:{enumerable:!0,get:()=>n[s]})}}return t.default=n,Object.freeze(t)}const c=U(D),{floatingToolbarStyle:v}=w.EditingUtils.Data,S=2,z=10,N=n=>{const{diagram:t,tools:s,position:p="top",shapes:h,visible:d=!0}=n,{controller:i,snapshot:T}=f.useDiagramEditorContext(),P=f.useRegisteredSurfaceRef(i),k=f.useDiagramEditorPopupProps("main-toolbar"),r=T.activeTool,x=!!(t&&t.canUndo()),C=!!(t&&t.canRedo()),l=O.useLocalization();c.useEffect(()=>{if(!t)return;const{element:o}=t,y=o.ownerDocument.defaultView;if(!y||y.getComputedStyle(o).position!=="static")return;const M=o.style.position;return o.style.position="relative",()=>{o.style.position=M}},[t]);const g=c.useCallback(o=>{i.dispatch({type:"setActiveTool",tool:o})},[i]),I=o=>{g({type:"insert-shape",shape:o})},E={undo:{component:a.Button,props:{svgIcon:u.undoIcon,fillMode:"flat",onClick:()=>i.execute({type:"undo"}),disabled:!x,title:l.toLanguageString(e.editingUndo,e.messages[e.editingUndo])}},redo:{component:a.Button,props:{svgIcon:u.redoIcon,fillMode:"flat",onClick:()=>i.execute({type:"redo"}),disabled:!C,title:l.toLanguageString(e.editingRedo,e.messages[e.editingRedo])}},select:{component:a.Button,props:{svgIcon:u.pointerIcon,fillMode:"flat",onClick:()=>g({type:"select"}),togglable:!0,selected:r.type==="select",title:l.toLanguageString(e.editingSelect,e.messages[e.editingSelect])}},pan:{component:a.Button,props:{svgIcon:u.handIcon,fillMode:"flat",onClick:()=>g({type:"pan"}),togglable:!0,selected:r.type==="pan",title:l.toLanguageString(e.editingPan,e.messages[e.editingPan])}},text:{component:a.Button,props:{svgIcon:u.freeTextIcon,fillMode:"flat",onClick:()=>g({type:"insert-text"}),togglable:!0,selected:r.type==="insert-text",title:l.toLanguageString(e.editingText,e.messages[e.editingText])}},shape:{component:j.ShapeSelector,props:{onSelect:I,value:r.type==="insert-shape"?r.shape:null,active:r.type==="insert-shape",buttonTitle:l.toLanguageString(e.editingShape,e.messages[e.editingShape]),shapes:h,popupClass:m.mainToolbarPopupClass,overlayOwner:"main-toolbar"}},separator:{component:a.ToolbarSeparator,props:{}}},b=m.mapTools(s,E);if(!t||b.length===0)return null;const R={position:"absolute",left:0,right:0,top:p==="top"?S:void 0,bottom:p==="bottom"?S+z:void 0,display:"flex",justifyContent:"center",pointerEvents:"none",zIndex:1},q={opacity:d?1:0,visibility:d?"visible":"hidden",pointerEvents:d?"auto":"none",transition:d?"opacity 140ms ease":"opacity 140ms ease, visibility 0s linear 140ms",...v};return B.createPortal(c.createElement("div",{style:R,className:"k-animation-container k-animation-container-shown"},c.createElement("div",{ref:P,className:"k-popup k-diagram-top-toolbar-container",style:q,onPointerEnter:()=>i.handlePointerEnter(),onPointerLeave:()=>i.handlePointerLeave()},c.createElement(L.PopupPropsContext.Provider,{value:k},c.createElement(a.Toolbar,{fillMode:"flat",style:v,buttons:m.floatingToolbarButtons},b)))),t.element)};exports.MainToolbar=N;
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as a from "react";
9
+ import { createPortal as U } from "react-dom";
10
+ import { Toolbar as z, ToolbarSeparator as A, Button as l } from "@progress/kendo-react-buttons";
11
+ import { PopupPropsContext as N } from "@progress/kendo-react-popup";
12
+ import { EditingUtils as O } from "@progress/kendo-diagram-common";
13
+ import { freeTextIcon as W, handIcon as j, pointerIcon as V, redoIcon as q, undoIcon as F } from "@progress/kendo-svg-icons";
14
+ import { useLocalization as G } from "@progress/kendo-react-intl";
15
+ import { editingShape as u, messages as r, editingText as g, editingPan as f, editingSelect as y, editingRedo as b, editingUndo as v } from "../messages/index.mjs";
16
+ import { ShapeSelector as H } from "./shapes-dropdown.mjs";
17
+ import { mapTools as J, floatingToolbarButtons as K, mainToolbarPopupClass as Q } from "./utils.mjs";
18
+ import { useDiagramEditorContext as X, useRegisteredSurfaceRef as Y, useDiagramEditorPopupProps as Z } from "./DiagramEditorContext.mjs";
19
+ const { floatingToolbarStyle: h } = O.Data, S = 2, _ = 10, pt = (T) => {
20
+ const { diagram: t, tools: P, position: c = "top", shapes: x, visible: s = !0 } = T, { controller: e, snapshot: C } = X(), E = Y(e), I = Z("main-toolbar"), n = C.activeTool, k = !!(t && t.canUndo()), L = !!(t && t.canRedo()), i = G();
21
+ a.useEffect(() => {
22
+ if (!t)
23
+ return;
24
+ const { element: o } = t, d = o.ownerDocument.defaultView;
25
+ if (!d || d.getComputedStyle(o).position !== "static")
26
+ return;
27
+ const D = o.style.position;
28
+ return o.style.position = "relative", () => {
29
+ o.style.position = D;
30
+ };
31
+ }, [t]);
32
+ const p = a.useCallback(
33
+ (o) => {
34
+ e.dispatch({ type: "setActiveTool", tool: o });
35
+ },
36
+ [e]
37
+ ), M = (o) => {
38
+ p({ type: "insert-shape", shape: o });
39
+ }, R = {
40
+ undo: {
41
+ component: l,
42
+ props: {
43
+ svgIcon: F,
44
+ fillMode: "flat",
45
+ onClick: () => e.execute({ type: "undo" }),
46
+ disabled: !k,
47
+ title: i.toLanguageString(v, r[v])
48
+ }
49
+ },
50
+ redo: {
51
+ component: l,
52
+ props: {
53
+ svgIcon: q,
54
+ fillMode: "flat",
55
+ onClick: () => e.execute({ type: "redo" }),
56
+ disabled: !L,
57
+ title: i.toLanguageString(b, r[b])
58
+ }
59
+ },
60
+ select: {
61
+ component: l,
62
+ props: {
63
+ svgIcon: V,
64
+ fillMode: "flat",
65
+ onClick: () => p({ type: "select" }),
66
+ togglable: !0,
67
+ selected: n.type === "select",
68
+ title: i.toLanguageString(y, r[y])
69
+ }
70
+ },
71
+ pan: {
72
+ component: l,
73
+ props: {
74
+ svgIcon: j,
75
+ fillMode: "flat",
76
+ onClick: () => p({ type: "pan" }),
77
+ togglable: !0,
78
+ selected: n.type === "pan",
79
+ title: i.toLanguageString(f, r[f])
80
+ }
81
+ },
82
+ text: {
83
+ component: l,
84
+ props: {
85
+ svgIcon: W,
86
+ fillMode: "flat",
87
+ onClick: () => p({ type: "insert-text" }),
88
+ togglable: !0,
89
+ selected: n.type === "insert-text",
90
+ title: i.toLanguageString(g, r[g])
91
+ }
92
+ },
93
+ shape: {
94
+ component: H,
95
+ props: {
96
+ onSelect: M,
97
+ value: n.type === "insert-shape" ? n.shape : null,
98
+ active: n.type === "insert-shape",
99
+ buttonTitle: i.toLanguageString(u, r[u]),
100
+ shapes: x,
101
+ popupClass: Q,
102
+ overlayOwner: "main-toolbar"
103
+ }
104
+ },
105
+ separator: { component: A, props: {} }
106
+ }, m = J(P, R);
107
+ if (!t || m.length === 0)
108
+ return null;
109
+ const w = {
110
+ position: "absolute",
111
+ left: 0,
112
+ right: 0,
113
+ top: c === "top" ? S : void 0,
114
+ bottom: c === "bottom" ? S + _ : void 0,
115
+ display: "flex",
116
+ justifyContent: "center",
117
+ pointerEvents: "none",
118
+ zIndex: 1
119
+ }, B = {
120
+ opacity: s ? 1 : 0,
121
+ visibility: s ? "visible" : "hidden",
122
+ pointerEvents: s ? "auto" : "none",
123
+ transition: s ? "opacity 140ms ease" : "opacity 140ms ease, visibility 0s linear 140ms",
124
+ ...h
125
+ };
126
+ return U(
127
+ /* @__PURE__ */ a.createElement("div", { style: w, className: "k-animation-container k-animation-container-shown" }, /* @__PURE__ */ a.createElement(
128
+ "div",
129
+ {
130
+ ref: E,
131
+ className: "k-popup k-diagram-top-toolbar-container",
132
+ style: B,
133
+ onPointerEnter: () => e.handlePointerEnter(),
134
+ onPointerLeave: () => e.handlePointerLeave()
135
+ },
136
+ /* @__PURE__ */ a.createElement(N.Provider, { value: I }, /* @__PURE__ */ a.createElement(z, { fillMode: "flat", style: h, buttons: K }, m))
137
+ )),
138
+ t.element
139
+ );
140
+ };
141
+ export {
142
+ pt as MainToolbar
143
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Shape, FlowchartShapeType } from '@progress/kendo-diagram-common';
9
+ import { ToolbarTools } from './types';
10
+ import * as React from 'react';
11
+ interface ShapeEditingToolbarProps {
12
+ shape: Shape | null;
13
+ tools: ToolbarTools;
14
+ shapes?: FlowchartShapeType[];
15
+ }
16
+ /** @hidden */
17
+ export declare const ShapeEditingToolbar: (props: ShapeEditingToolbarProps) => React.JSX.Element | null;
18
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),a=require("@progress/kendo-react-buttons"),y=require("@progress/kendo-react-inputs"),z=require("@progress/kendo-react-popup"),_=require("@progress/kendo-diagram-common"),N=require("@progress/kendo-react-intl"),e=require("../messages/index.js"),U=require("./shapes-dropdown.js"),l=require("@progress/kendo-svg-icons"),V=require("./border-width.js"),A=require("./border-style.js"),u=require("./utils.js"),m=require("./DiagramEditorContext.js");function G(i){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const s in i)if(s!=="default"){const c=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(r,s,c.get?c:{enumerable:!0,get:()=>i[s]})}}return r.default=i,Object.freeze(r)}const k=G(j),{Data:H}=_.EditingUtils,J=H.floatingToolbarStyle,K=i=>{var f,S,h;const{shape:r,tools:s,shapes:c}=i,{controller:o}=m.useDiagramEditorContext(),b=m.useDiagramEditorPopupProps("shape-toolbar"),n=N.useLocalization();if(!r)return null;const p=r.options,C=p.type||"rectangle",T=typeof p.fill=="string"?p.fill:((f=p.fill)==null?void 0:f.color)||"#ffffff",g=((h=(S=r.shapeVisual)==null?void 0:S.options)==null?void 0:h.stroke)||{},v=g.color||"",B=g.width||1,R=g.dashType||"solid",D=t=>{t!==C&&o.execute({type:"setShapeType",value:t})},I=t=>{o.execute({type:"setShapeFillColor",value:t})},L=t=>{o.execute({type:"setShapeStrokeColor",value:t})},x=t=>{o.execute({type:"setShapeStrokeWidth",value:t})},q=t=>{o.execute({type:"setShapeStrokeDashType",value:t})},P=()=>{o.execute({type:"shapeToFront"})},M=()=>{o.execute({type:"shapeToBack"})},F=()=>{o.execute({type:"rotateShapeLeft"})},O=()=>{o.execute({type:"rotateShapeRight"})},E=()=>{o.execute({type:"duplicateSelection"})},W=()=>{o.execute({type:"deleteSelection"})},w={type:{component:U.ShapeSelector,props:{onSelect:D,value:r.options.type,buttonTitle:n.toLanguageString(e.editingShapeType,e.messages[e.editingShapeType]),shapes:c,popupClass:u.dropdownPopupClass,overlayOwner:"shape-toolbar"}},backColor:{component:y.ColorPicker,props:{value:T,gradientSettings:{opacity:!1},fillMode:"flat",onChange:t=>I(t.value),title:n.toLanguageString(e.editingFillColor,e.messages[e.editingFillColor])}},separator:{component:a.ToolbarSeparator,props:{}},borderWidth:{component:V.BorderWidth,props:{value:B,onSelect:x,label:n.toLanguageString(e.editingBorderWidth,e.messages[e.editingBorderWidth]),overlayOwner:"shape-toolbar"}},borderColor:{component:y.ColorPicker,props:{value:v,svgIcon:l.borderColorIcon,gradientSettings:{opacity:!1},fillMode:"flat",onChange:t=>L(t.value),title:n.toLanguageString(e.editingBorderColor,e.messages[e.editingBorderColor])}},borderStyle:{component:A.BorderStyle,props:{value:R,onSelect:q,overlayOwner:"shape-toolbar"}},toFront:{component:a.Button,props:{fillMode:"flat",onClick:P,svgIcon:l.bringToFrontIcon,title:n.toLanguageString(e.editingToFront,e.messages[e.editingToFront])}},toBack:{component:a.Button,props:{fillMode:"flat",onClick:M,svgIcon:l.bringToBackIcon,title:n.toLanguageString(e.editingToBack,e.messages[e.editingToBack])}},rotateLeft:{component:a.Button,props:{fillMode:"flat",onClick:F,svgIcon:l.rotateLeftIcon,title:n.toLanguageString(e.editingRotateLeft,e.messages[e.editingRotateLeft])}},rotateRight:{component:a.Button,props:{fillMode:"flat",onClick:O,svgIcon:l.rotateRightIcon,title:n.toLanguageString(e.editingRotateRight,e.messages[e.editingRotateRight])}},duplicate:{component:a.Button,props:{fillMode:"flat",onClick:E,svgIcon:l.copyIcon,title:n.toLanguageString(e.editingDuplicate,e.messages[e.editingDuplicate])}},delete:{component:a.Button,props:{fillMode:"flat",onClick:W,svgIcon:l.trashIcon,title:n.toLanguageString(e.editingDelete,e.messages[e.editingDelete])}}},d=u.mapTools(s,w);return d.length===0?null:k.createElement(z.PopupPropsContext.Provider,{value:b},k.createElement(a.Toolbar,{fillMode:"flat",style:{...J},buttons:u.floatingToolbarButtons},d))};exports.ShapeEditingToolbar=K;
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as u from "react";
9
+ import { Toolbar as J, Button as r, ToolbarSeparator as K } from "@progress/kendo-react-buttons";
10
+ import { ColorPicker as f } from "@progress/kendo-react-inputs";
11
+ import { PopupPropsContext as N } from "@progress/kendo-react-popup";
12
+ import { EditingUtils as Q } from "@progress/kendo-diagram-common";
13
+ import { useLocalization as X } from "@progress/kendo-react-intl";
14
+ import { editingDelete as d, messages as n, editingDuplicate as m, editingRotateRight as h, editingRotateLeft as S, editingToBack as y, editingToFront as k, editingBorderColor as v, editingBorderWidth as C, editingFillColor as T, editingShapeType as b } from "../messages/index.mjs";
15
+ import { ShapeSelector as Y } from "./shapes-dropdown.mjs";
16
+ import { trashIcon as Z, copyIcon as _, rotateRightIcon as $, rotateLeftIcon as oo, bringToBackIcon as to, bringToFrontIcon as eo, borderColorIcon as no } from "@progress/kendo-svg-icons";
17
+ import { BorderWidth as ro } from "./border-width.mjs";
18
+ import { BorderStyle as lo } from "./border-style.mjs";
19
+ import { mapTools as ao, floatingToolbarButtons as io, dropdownPopupClass as po } from "./utils.mjs";
20
+ import { useDiagramEditorContext as so, useDiagramEditorPopupProps as co } from "./DiagramEditorContext.mjs";
21
+ const { Data: go } = Q, uo = go.floatingToolbarStyle, Io = (L) => {
22
+ var s, c, g;
23
+ const { shape: l, tools: x, shapes: I } = L, { controller: t } = so(), B = co("shape-toolbar"), e = X();
24
+ if (!l)
25
+ return null;
26
+ const a = l.options, D = a.type || "rectangle", M = typeof a.fill == "string" ? a.fill : ((s = a.fill) == null ? void 0 : s.color) || "#ffffff", i = ((g = (c = l.shapeVisual) == null ? void 0 : c.options) == null ? void 0 : g.stroke) || {}, R = i.color || "", F = i.width || 1, P = i.dashType || "solid", E = (o) => {
27
+ o !== D && t.execute({ type: "setShapeType", value: o });
28
+ }, W = (o) => {
29
+ t.execute({ type: "setShapeFillColor", value: o });
30
+ }, w = (o) => {
31
+ t.execute({ type: "setShapeStrokeColor", value: o });
32
+ }, O = (o) => {
33
+ t.execute({ type: "setShapeStrokeWidth", value: o });
34
+ }, z = (o) => {
35
+ t.execute({ type: "setShapeStrokeDashType", value: o });
36
+ }, U = () => {
37
+ t.execute({ type: "shapeToFront" });
38
+ }, V = () => {
39
+ t.execute({ type: "shapeToBack" });
40
+ }, j = () => {
41
+ t.execute({ type: "rotateShapeLeft" });
42
+ }, q = () => {
43
+ t.execute({ type: "rotateShapeRight" });
44
+ }, A = () => {
45
+ t.execute({ type: "duplicateSelection" });
46
+ }, G = () => {
47
+ t.execute({ type: "deleteSelection" });
48
+ }, H = {
49
+ type: {
50
+ component: Y,
51
+ props: {
52
+ onSelect: E,
53
+ value: l.options.type,
54
+ buttonTitle: e.toLanguageString(b, n[b]),
55
+ shapes: I,
56
+ popupClass: po,
57
+ overlayOwner: "shape-toolbar"
58
+ }
59
+ },
60
+ backColor: {
61
+ component: f,
62
+ props: {
63
+ value: M,
64
+ gradientSettings: { opacity: !1 },
65
+ fillMode: "flat",
66
+ onChange: (o) => W(o.value),
67
+ title: e.toLanguageString(T, n[T])
68
+ }
69
+ },
70
+ separator: { component: K, props: {} },
71
+ borderWidth: {
72
+ component: ro,
73
+ props: {
74
+ value: F,
75
+ onSelect: O,
76
+ label: e.toLanguageString(C, n[C]),
77
+ overlayOwner: "shape-toolbar"
78
+ }
79
+ },
80
+ borderColor: {
81
+ component: f,
82
+ props: {
83
+ value: R,
84
+ svgIcon: no,
85
+ gradientSettings: { opacity: !1 },
86
+ fillMode: "flat",
87
+ onChange: (o) => w(o.value),
88
+ title: e.toLanguageString(v, n[v])
89
+ }
90
+ },
91
+ borderStyle: {
92
+ component: lo,
93
+ props: { value: P, onSelect: z, overlayOwner: "shape-toolbar" }
94
+ },
95
+ toFront: {
96
+ component: r,
97
+ props: {
98
+ fillMode: "flat",
99
+ onClick: U,
100
+ svgIcon: eo,
101
+ title: e.toLanguageString(k, n[k])
102
+ }
103
+ },
104
+ toBack: {
105
+ component: r,
106
+ props: {
107
+ fillMode: "flat",
108
+ onClick: V,
109
+ svgIcon: to,
110
+ title: e.toLanguageString(y, n[y])
111
+ }
112
+ },
113
+ rotateLeft: {
114
+ component: r,
115
+ props: {
116
+ fillMode: "flat",
117
+ onClick: j,
118
+ svgIcon: oo,
119
+ title: e.toLanguageString(S, n[S])
120
+ }
121
+ },
122
+ rotateRight: {
123
+ component: r,
124
+ props: {
125
+ fillMode: "flat",
126
+ onClick: q,
127
+ svgIcon: $,
128
+ title: e.toLanguageString(h, n[h])
129
+ }
130
+ },
131
+ duplicate: {
132
+ component: r,
133
+ props: {
134
+ fillMode: "flat",
135
+ onClick: A,
136
+ svgIcon: _,
137
+ title: e.toLanguageString(m, n[m])
138
+ }
139
+ },
140
+ delete: {
141
+ component: r,
142
+ props: {
143
+ fillMode: "flat",
144
+ onClick: G,
145
+ svgIcon: Z,
146
+ title: e.toLanguageString(d, n[d])
147
+ }
148
+ }
149
+ }, p = ao(x, H);
150
+ return p.length === 0 ? null : /* @__PURE__ */ u.createElement(N.Provider, { value: B }, /* @__PURE__ */ u.createElement(J, { fillMode: "flat", style: { ...uo }, buttons: io }, p));
151
+ };
152
+ export {
153
+ Io as ShapeEditingToolbar
154
+ };