@nice2dev/ui 1.2.2 → 1.3.1

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 (97) hide show
  1. package/CHANGELOG.md +474 -0
  2. package/dist/NiceButton-CnAIqCbd.js +101 -0
  3. package/dist/NiceButton-DzCqkG5a.cjs +1 -0
  4. package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
  5. package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
  6. package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
  7. package/dist/NiceColorPicker-CyY-4q89.js +552 -0
  8. package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
  9. package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
  10. package/dist/NiceDataGrid-Cs4vOOTE.js +2267 -0
  11. package/dist/NiceDataGrid-jZvzaCv3.cjs +10 -0
  12. package/dist/NiceForm-CfAPcXdX.cjs +1 -0
  13. package/dist/NiceForm-DYcrWaN1.js +5017 -0
  14. package/dist/NiceForm-DfKYNQti.js +5017 -0
  15. package/dist/NiceForm-ZzfYumoR.cjs +1 -0
  16. package/dist/NiceGantt-TEXbAELi.js +333 -0
  17. package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
  18. package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
  19. package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
  20. package/dist/NiceLoginForm-DRPldHXa.js +808 -0
  21. package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
  22. package/dist/NiceMention-CgDp0sl9.cjs +430 -0
  23. package/dist/NiceMention-DBvFvx71.js +11653 -0
  24. package/dist/NiceMention-VhH0Dllr.cjs +430 -0
  25. package/dist/NiceMention-cOqXnI0M.js +11653 -0
  26. package/dist/NiceMention.css +1 -1
  27. package/dist/NiceModal-BlYhFDhP.js +80 -0
  28. package/dist/NiceModal-DmWz2PDM.cjs +1 -0
  29. package/dist/NiceModuleLifecyclePanel-BWUYyWfY.cjs +1 -0
  30. package/dist/NiceModuleLifecyclePanel-BdcJATGF.js +7190 -0
  31. package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
  32. package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
  33. package/dist/NiceModuleLifecyclePanel.css +1 -1
  34. package/dist/NicePagination-BJS65foT.js +200 -0
  35. package/dist/NicePagination-D_3GfWp5.cjs +1 -0
  36. package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
  37. package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
  38. package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
  39. package/dist/NiceSavedQueryPanel-Cs_dypgU.js +5311 -0
  40. package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
  41. package/dist/NiceSavedQueryPanel-DTSOHW2v.cjs +586 -0
  42. package/dist/NiceScheduler-BmHcJLBe.cjs +5 -0
  43. package/dist/NiceScheduler-DI2sg3Rr.js +1710 -0
  44. package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
  45. package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
  46. package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
  47. package/dist/NiceSelect-fOelG_QB.js +495 -0
  48. package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
  49. package/dist/NiceWindow-DZLPhXbR.js +2223 -0
  50. package/dist/charts-BYQwl_GS.js +4789 -0
  51. package/dist/charts-C6iOu0H6.cjs +768 -0
  52. package/dist/charts.cjs +1 -1
  53. package/dist/charts.d.ts +1 -1
  54. package/dist/charts.mjs +1 -1
  55. package/dist/core-lazy-B_laOXNf.cjs +1 -0
  56. package/dist/core-lazy-BpbIO1EN.cjs +1 -0
  57. package/dist/core-lazy-L7MVTPp1.js +351 -0
  58. package/dist/core-lazy-VQEjdz0L.js +351 -0
  59. package/dist/data-branching-7rpktFJ-.cjs +1 -0
  60. package/dist/data-branching-BS0aFUMu.js +6428 -0
  61. package/dist/data-branching.cjs +1 -1
  62. package/dist/data-branching.mjs +1 -1
  63. package/dist/data.cjs +1 -1
  64. package/dist/data.mjs +3 -3
  65. package/dist/devops-CFytAJQr.cjs +18 -0
  66. package/dist/devops-CW8YY_zA.js +9122 -0
  67. package/dist/devops.cjs +1 -1
  68. package/dist/devops.css +1 -0
  69. package/dist/devops.mjs +5 -5
  70. package/dist/editors.cjs +1 -1
  71. package/dist/editors.mjs +8 -8
  72. package/dist/feedback.cjs +1 -1
  73. package/dist/feedback.d.ts +21 -16
  74. package/dist/feedback.mjs +3 -3
  75. package/dist/index.cjs +262 -257
  76. package/dist/index.css +1 -1
  77. package/dist/index.d.ts +402 -27
  78. package/dist/index.mjs +21437 -20148
  79. package/dist/lazy.cjs +1 -1
  80. package/dist/lazy.mjs +24 -24
  81. package/dist/navigation.cjs +1 -1
  82. package/dist/navigation.d.ts +50 -7
  83. package/dist/navigation.mjs +404 -354
  84. package/dist/no-code-BaAI_sJR.js +8318 -0
  85. package/dist/no-code-oQTeAtnW.cjs +331 -0
  86. package/dist/no-code.cjs +1 -1
  87. package/dist/no-code.mjs +1 -1
  88. package/dist/overlays.cjs +1 -1
  89. package/dist/overlays.d.ts +5 -0
  90. package/dist/overlays.mjs +1 -1
  91. package/dist/pickerCommons-BQi6IEAt.js +661 -0
  92. package/dist/pickerCommons-CUGHOWyc.cjs +1 -0
  93. package/dist/pickerCommons-D-dwdCBZ.js +659 -0
  94. package/dist/pickerCommons-DvQptSPX.cjs +1 -0
  95. package/dist/pickerCommons.css +1 -1
  96. package/dist/style.css +8 -5
  97. package/package.json +4 -3
@@ -0,0 +1,333 @@
1
+ import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
+ import { useNiceTranslation as J, useNiceAccessMode as me, clickOnActivationKey as ue } from "@nice2dev/ui-core";
3
+ import { useState as K, useRef as A, useEffect as P, useMemo as T, useCallback as z } from "react";
4
+ const _e = [], b = (m, N) => {
5
+ const y = new Date(m);
6
+ return y.setDate(y.getDate() + N), y;
7
+ }, E = (m, N) => Math.ceil((N.getTime() - m.getTime()) / 864e5), fe = ({
8
+ tasks: m = _e,
9
+ columns: N,
10
+ scale: y = "day",
11
+ rowHeight: _ = 36,
12
+ dayWidth: q = 30,
13
+ onTaskClick: x,
14
+ onTaskUpdate: w,
15
+ showDependencies: G = !0,
16
+ dependencyStyle: V = "square",
17
+ draggable: M,
18
+ zoomControls: Z,
19
+ className: H,
20
+ style: k,
21
+ accessMode: U,
22
+ id: ee
23
+ }) => {
24
+ const { t: te } = J(), ne = me(U, ee) === "hidden", { t: ve } = J(), [o, B] = K(q), [f, j] = K(null), S = N || [
25
+ { field: "title", title: te("gantt.task", "Task"), width: 200 }
26
+ ], I = S.reduce((e, t) => e + (t.width || 120), 0), X = A(null), C = A(null), W = A(!1);
27
+ P(() => {
28
+ const e = X.current, t = C.current;
29
+ if (!e || !t)
30
+ return;
31
+ const a = (c, i) => () => {
32
+ W.current || (W.current = !0, i.scrollTop = c.scrollTop, requestAnimationFrame(() => {
33
+ W.current = !1;
34
+ }));
35
+ }, n = a(e, t), r = a(t, e);
36
+ return e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("scroll", r, { passive: !0 }), () => {
37
+ e.removeEventListener("scroll", n), t.removeEventListener("scroll", r);
38
+ };
39
+ }, []);
40
+ const d = T(() => {
41
+ const e = (t) => m.filter((n) => (n.parentId ?? null) === t).flatMap((n) => [n, ...e(n.id)]);
42
+ return e(null);
43
+ }, [m]), u = T(() => {
44
+ if (d.length === 0)
45
+ return { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date(), days: 30 };
46
+ let e = new Date(d[0].start), t = new Date(d[0].end);
47
+ return d.forEach((a) => {
48
+ new Date(a.start) < e && (e = new Date(a.start)), new Date(a.end) > t && (t = new Date(a.end));
49
+ }), e = b(e, -2), t = b(t, 2), { start: e, end: t, days: E(e, t) };
50
+ }, [d]), O = u.days * o;
51
+ P(() => {
52
+ if (!f || !w)
53
+ return;
54
+ const e = (a) => {
55
+ const n = a.clientX - f.startX, r = Math.round(n / o);
56
+ if (r === 0)
57
+ return;
58
+ const c = m.find((i) => i.id === f.taskId);
59
+ if (c)
60
+ if (f.mode === "move")
61
+ w({
62
+ ...c,
63
+ start: b(f.origStart, r),
64
+ end: b(f.origEnd, r)
65
+ });
66
+ else {
67
+ const i = b(f.origEnd, r);
68
+ i > f.origStart && w({ ...c, end: i });
69
+ }
70
+ }, t = () => j(null);
71
+ return document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), () => {
72
+ document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
73
+ };
74
+ }, [f, o, m, w]);
75
+ const Q = z(
76
+ (e, t, a) => {
77
+ if (!M || !w)
78
+ return;
79
+ a.stopPropagation();
80
+ const n = m.find((r) => r.id === e);
81
+ n && j({
82
+ taskId: e,
83
+ mode: t,
84
+ startX: a.clientX,
85
+ origStart: new Date(n.start),
86
+ origEnd: new Date(n.end)
87
+ });
88
+ },
89
+ [M, m, w]
90
+ ), ae = z(() => B((e) => Math.min(100, e + 5)), []), re = z(() => B((e) => Math.max(8, e - 5)), []), se = () => {
91
+ const e = [], t = [];
92
+ new Date(u.start);
93
+ const a = [
94
+ "Jan",
95
+ "Feb",
96
+ "Mar",
97
+ "Apr",
98
+ "May",
99
+ "Jun",
100
+ "Jul",
101
+ "Aug",
102
+ "Sep",
103
+ "Oct",
104
+ "Nov",
105
+ "Dec"
106
+ ];
107
+ if (y === "day") {
108
+ let n = -1, r = 0;
109
+ for (let c = 0; c < u.days; c++) {
110
+ const i = b(u.start, c);
111
+ i.getMonth() !== n && (n >= 0 && e.push(
112
+ /* @__PURE__ */ l(
113
+ "div",
114
+ {
115
+ className: "nice-gantt__header-cell",
116
+ style: { width: (c - r) * o },
117
+ children: [
118
+ a[n],
119
+ " ",
120
+ i.getFullYear()
121
+ ]
122
+ },
123
+ `m${n}-${r}`
124
+ )
125
+ ), n = i.getMonth(), r = c);
126
+ const h = i.getDay() === 0 || i.getDay() === 6;
127
+ t.push(
128
+ /* @__PURE__ */ s(
129
+ "div",
130
+ {
131
+ className: `nice-gantt__header-cell nice-gantt__header-cell--sub ${h ? "nice-gantt__header-cell--weekend" : ""}`,
132
+ style: { width: o },
133
+ children: i.getDate()
134
+ },
135
+ c
136
+ )
137
+ );
138
+ }
139
+ n >= 0 && e.push(
140
+ /* @__PURE__ */ s(
141
+ "div",
142
+ {
143
+ className: "nice-gantt__header-cell",
144
+ style: { width: (u.days - r) * o },
145
+ children: a[n]
146
+ },
147
+ `m${n}-last`
148
+ )
149
+ );
150
+ }
151
+ return /* @__PURE__ */ l("div", { className: "nice-gantt__chart-header", children: [
152
+ /* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: e }),
153
+ /* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: t })
154
+ ] });
155
+ }, ie = (e, t) => {
156
+ const a = E(u.start, new Date(e.start)) * o, n = Math.max(E(new Date(e.start), new Date(e.end)) * o, o), r = t * _ + 4, c = _ - 8, i = e.progress ?? 0;
157
+ return /* @__PURE__ */ l(
158
+ "div",
159
+ {
160
+ role: x ? "button" : void 0,
161
+ tabIndex: x ? 0 : void 0,
162
+ onKeyDown: x ? ue : void 0,
163
+ className: `nice-gantt__bar ${M ? "nice-gantt__bar--draggable" : ""}`,
164
+ title: `${e.title} (${Math.round(i)}%)`,
165
+ style: {
166
+ left: a,
167
+ top: r,
168
+ width: n,
169
+ height: c,
170
+ backgroundColor: e.color || "var(--nice-color-primary, #3b82f6)"
171
+ },
172
+ onClick: () => x?.(e),
173
+ onMouseDown: M ? (h) => Q(e.id, "move", h) : void 0,
174
+ children: [
175
+ i > 0 && /* @__PURE__ */ s("div", { className: "nice-gantt__bar-progress", style: { width: `${i}%` } }),
176
+ /* @__PURE__ */ s("span", { className: "nice-gantt__bar-label", children: e.title }),
177
+ M && /* @__PURE__ */ s(
178
+ "div",
179
+ {
180
+ className: "nice-gantt__bar-resize",
181
+ onMouseDown: (h) => Q(e.id, "resize", h)
182
+ }
183
+ )
184
+ ]
185
+ },
186
+ e.id
187
+ );
188
+ }, ce = (e, t, a, n, r) => {
189
+ const h = e + 10, L = a - 14, R = (t + n) / 2, D = n >= t ? 1 : -1, Y = Math.abs(n - t) < 1, F = L <= h + 4, p = Y ? t : R, g = F ? Math.max(h, e + 10) : h, v = F ? Math.min(L, a - 10) : L;
190
+ if (Y || !r)
191
+ return [
192
+ `M ${e} ${t}`,
193
+ `L ${g} ${t}`,
194
+ `L ${g} ${p}`,
195
+ `L ${v} ${p}`,
196
+ `L ${v} ${n}`,
197
+ `L ${a} ${n}`
198
+ ].join(" ");
199
+ const de = Math.max(0, v - g), le = Math.abs(n - t), he = Math.min(le / 2 || 10, de / 2 || 10), $ = Math.max(2, Math.min(10, he));
200
+ return [
201
+ `M ${e} ${t}`,
202
+ `L ${g - $} ${t}`,
203
+ `Q ${g} ${t} ${g} ${t + D * $}`,
204
+ `L ${g} ${p - D * $}`,
205
+ `Q ${g} ${p} ${g + $} ${p}`,
206
+ `L ${v - $} ${p}`,
207
+ `Q ${v} ${p} ${v} ${p + D * $}`,
208
+ `L ${v} ${n - D * $}`,
209
+ `Q ${v} ${n} ${v + $} ${n}`,
210
+ `L ${a} ${n}`
211
+ ].join(" ");
212
+ }, oe = () => {
213
+ if (!G)
214
+ return null;
215
+ const e = [], t = new Map(d.map((a, n) => [a.id, n]));
216
+ return d.forEach((a) => {
217
+ (a.dependencies || []).forEach((n) => {
218
+ const r = t.get(n), c = t.get(a.id);
219
+ if (r == null || c == null)
220
+ return;
221
+ const i = d[r], h = E(u.start, new Date(i.end)) * o, L = r * _ + _ / 2, R = E(u.start, new Date(a.start)) * o, D = c * _ + _ / 2;
222
+ e.push(
223
+ /* @__PURE__ */ s(
224
+ "path",
225
+ {
226
+ d: ce(h, L, R, D, V === "rounded"),
227
+ fill: "none",
228
+ stroke: "var(--nice-text-secondary, #6b7280)",
229
+ strokeWidth: 1.5,
230
+ strokeLinejoin: "round",
231
+ strokeLinecap: "round",
232
+ markerEnd: "url(#arrowhead)"
233
+ },
234
+ `${n}-${a.id}`
235
+ )
236
+ );
237
+ });
238
+ }), /* @__PURE__ */ l(
239
+ "svg",
240
+ {
241
+ className: "nice-gantt__deps",
242
+ width: O,
243
+ height: d.length * _,
244
+ style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" },
245
+ children: [
246
+ /* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("marker", { id: "arrowhead", markerWidth: "6", markerHeight: "4", refX: "5", refY: "2", orient: "auto", children: /* @__PURE__ */ s("polygon", { points: "0 0, 6 2, 0 4", fill: "var(--nice-text-secondary, #6b7280)" }) }) }),
247
+ e
248
+ ]
249
+ }
250
+ );
251
+ };
252
+ return ne ? null : /* @__PURE__ */ l("div", { className: `nice-gantt ${H || ""}`, style: k, children: [
253
+ Z && /* @__PURE__ */ l("div", { className: "nice-gantt__zoom-controls", children: [
254
+ /* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: re, children: "−" }),
255
+ /* @__PURE__ */ l("span", { className: "nice-gantt__zoom-label", children: [
256
+ o,
257
+ "px"
258
+ ] }),
259
+ /* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: ae, children: "+" })
260
+ ] }),
261
+ /* @__PURE__ */ l("div", { className: "nice-gantt__container", children: [
262
+ /* @__PURE__ */ l("div", { className: "nice-gantt__table", style: { width: I, minWidth: I }, children: [
263
+ /* @__PURE__ */ l("div", { className: "nice-gantt__table-header", children: [
264
+ /* @__PURE__ */ s(
265
+ "div",
266
+ {
267
+ className: "nice-gantt__table-header-row nice-gantt__table-header-row--main",
268
+ "aria-hidden": "true",
269
+ children: " "
270
+ }
271
+ ),
272
+ /* @__PURE__ */ s("div", { className: "nice-gantt__table-header-row nice-gantt__table-header-row--sub", children: S.map((e, t) => /* @__PURE__ */ s(
273
+ "div",
274
+ {
275
+ className: "nice-gantt__table-header-cell",
276
+ style: { width: e.width || 120 },
277
+ children: e.title
278
+ },
279
+ t
280
+ )) })
281
+ ] }),
282
+ /* @__PURE__ */ s("div", { className: "nice-gantt__table-body", ref: X, children: d.map((e, t) => /* @__PURE__ */ s("div", { className: "nice-gantt__table-row", style: { height: _ }, children: S.map((a, n) => /* @__PURE__ */ s(
283
+ "div",
284
+ {
285
+ className: "nice-gantt__table-cell",
286
+ style: { width: a.width || 120 },
287
+ children: e[a.field]
288
+ },
289
+ n
290
+ )) }, e.id)) })
291
+ ] }),
292
+ /* @__PURE__ */ s("div", { className: "nice-gantt__chart", children: /* @__PURE__ */ l("div", { className: "nice-gantt__chart-body-wrap", ref: C, children: [
293
+ se(),
294
+ /* @__PURE__ */ l(
295
+ "div",
296
+ {
297
+ className: "nice-gantt__chart-body",
298
+ style: {
299
+ width: O,
300
+ height: d.length * _,
301
+ position: "relative"
302
+ },
303
+ children: [
304
+ Array.from({ length: u.days }, (e, t) => {
305
+ const a = b(u.start, t), n = a.getDay() === 0 || a.getDay() === 6;
306
+ return /* @__PURE__ */ s(
307
+ "div",
308
+ {
309
+ className: `nice-gantt__gridline ${n ? "nice-gantt__gridline--weekend" : ""}`,
310
+ style: {
311
+ left: t * o,
312
+ width: o,
313
+ height: "100%",
314
+ position: "absolute",
315
+ top: 0
316
+ }
317
+ },
318
+ t
319
+ );
320
+ }),
321
+ d.map((e, t) => ie(e, t)),
322
+ oe()
323
+ ]
324
+ }
325
+ )
326
+ ] }) })
327
+ ] })
328
+ ] });
329
+ };
330
+ process.env.NODE_ENV !== "production" && (fe.displayName = "NiceGantt");
331
+ export {
332
+ fe as NiceGantt
333
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),E=require("@nice2dev/ui-core"),l=require("react"),oe=[],p=(u,N)=>{const j=new Date(u);return j.setDate(j.getDate()+N),j},M=(u,N)=>Math.ceil((N.getTime()-u.getTime())/864e5),P=({tasks:u=oe,columns:N,scale:j="day",rowHeight:_=36,dayWidth:Q=30,onTaskClick:L,onTaskUpdate:x,showDependencies:Y=!0,dependencyStyle:F="square",draggable:D,zoomControls:G,className:J,style:K,accessMode:V,id:Z})=>{const{t:k}=E.useNiceTranslation(),H=E.useNiceAccessMode(V,Z)==="hidden",{t:le}=E.useNiceTranslation(),[o,A]=l.useState(Q),[f,z]=l.useState(null),S=N||[{field:"title",title:k("gantt.task","Task"),width:200}],C=S.reduce((e,t)=>e+(t.width||120),0),B=l.useRef(null),q=l.useRef(null),R=l.useRef(!1);l.useEffect(()=>{const e=B.current,t=q.current;if(!e||!t)return;const s=(c,i)=>()=>{R.current||(R.current=!0,i.scrollTop=c.scrollTop,requestAnimationFrame(()=>{R.current=!1}))},n=s(e,t),r=s(t,e);return e.addEventListener("scroll",n,{passive:!0}),t.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",n),t.removeEventListener("scroll",r)}},[]);const d=l.useMemo(()=>{const e=t=>u.filter(n=>(n.parentId??null)===t).flatMap(n=>[n,...e(n.id)]);return e(null)},[u]),m=l.useMemo(()=>{if(d.length===0)return{start:new Date,end:new Date,days:30};let e=new Date(d[0].start),t=new Date(d[0].end);return d.forEach(s=>{new Date(s.start)<e&&(e=new Date(s.start)),new Date(s.end)>t&&(t=new Date(s.end))}),e=p(e,-2),t=p(t,2),{start:e,end:t,days:M(e,t)}},[d]),I=m.days*o;l.useEffect(()=>{if(!f||!x)return;const e=s=>{const n=s.clientX-f.startX,r=Math.round(n/o);if(r===0)return;const c=u.find(i=>i.id===f.taskId);if(c)if(f.mode==="move")x({...c,start:p(f.origStart,r),end:p(f.origEnd,r)});else{const i=p(f.origEnd,r);i>f.origStart&&x({...c,end:i})}},t=()=>z(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[f,o,u,x]);const O=l.useCallback((e,t,s)=>{if(!D||!x)return;s.stopPropagation();const n=u.find(r=>r.id===e);n&&z({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[D,u,x]),U=l.useCallback(()=>A(e=>Math.min(100,e+5)),[]),ee=l.useCallback(()=>A(e=>Math.max(8,e-5)),[]),te=()=>{const e=[],t=[];new Date(m.start);const s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(j==="day"){let n=-1,r=0;for(let c=0;c<m.days;c++){const i=p(m.start,c);i.getMonth()!==n&&(n>=0&&e.push(a.jsxs("div",{className:"nice-gantt__header-cell",style:{width:(c-r)*o},children:[s[n]," ",i.getFullYear()]},`m${n}-${r}`)),n=i.getMonth(),r=c);const h=i.getDay()===0||i.getDay()===6;t.push(a.jsx("div",{className:`nice-gantt__header-cell nice-gantt__header-cell--sub ${h?"nice-gantt__header-cell--weekend":""}`,style:{width:o},children:i.getDate()},c))}n>=0&&e.push(a.jsx("div",{className:"nice-gantt__header-cell",style:{width:(m.days-r)*o},children:s[n]},`m${n}-last`))}return a.jsxs("div",{className:"nice-gantt__chart-header",children:[a.jsx("div",{className:"nice-gantt__header-row",children:e}),a.jsx("div",{className:"nice-gantt__header-row",children:t})]})},ne=(e,t)=>{const s=M(m.start,new Date(e.start))*o,n=Math.max(M(new Date(e.start),new Date(e.end))*o,o),r=t*_+4,c=_-8,i=e.progress??0;return a.jsxs("div",{role:L?"button":void 0,tabIndex:L?0:void 0,onKeyDown:L?E.clickOnActivationKey:void 0,className:`nice-gantt__bar ${D?"nice-gantt__bar--draggable":""}`,title:`${e.title} (${Math.round(i)}%)`,style:{left:s,top:r,width:n,height:c,backgroundColor:e.color||"var(--nice-color-primary, #3b82f6)"},onClick:()=>L?.(e),onMouseDown:D?h=>O(e.id,"move",h):void 0,children:[i>0&&a.jsx("div",{className:"nice-gantt__bar-progress",style:{width:`${i}%`}}),a.jsx("span",{className:"nice-gantt__bar-label",children:e.title}),D&&a.jsx("div",{className:"nice-gantt__bar-resize",onMouseDown:h=>O(e.id,"resize",h)})]},e.id)},se=(e,t,s,n,r)=>{const h=e+10,y=s-14,W=(t+n)/2,w=n>=t?1:-1,T=Math.abs(n-t)<1,X=y<=h+4,b=T?t:W,g=X?Math.max(h,e+10):h,v=X?Math.min(y,s-10):y;if(T||!r)return[`M ${e} ${t}`,`L ${g} ${t}`,`L ${g} ${b}`,`L ${v} ${b}`,`L ${v} ${n}`,`L ${s} ${n}`].join(" ");const re=Math.max(0,v-g),ie=Math.abs(n-t),ce=Math.min(ie/2||10,re/2||10),$=Math.max(2,Math.min(10,ce));return[`M ${e} ${t}`,`L ${g-$} ${t}`,`Q ${g} ${t} ${g} ${t+w*$}`,`L ${g} ${b-w*$}`,`Q ${g} ${b} ${g+$} ${b}`,`L ${v-$} ${b}`,`Q ${v} ${b} ${v} ${b+w*$}`,`L ${v} ${n-w*$}`,`Q ${v} ${n} ${v+$} ${n}`,`L ${s} ${n}`].join(" ")},ae=()=>{if(!Y)return null;const e=[],t=new Map(d.map((s,n)=>[s.id,n]));return d.forEach(s=>{(s.dependencies||[]).forEach(n=>{const r=t.get(n),c=t.get(s.id);if(r==null||c==null)return;const i=d[r],h=M(m.start,new Date(i.end))*o,y=r*_+_/2,W=M(m.start,new Date(s.start))*o,w=c*_+_/2;e.push(a.jsx("path",{d:se(h,y,W,w,F==="rounded"),fill:"none",stroke:"var(--nice-text-secondary, #6b7280)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",markerEnd:"url(#arrowhead)"},`${n}-${s.id}`))})}),a.jsxs("svg",{className:"nice-gantt__deps",width:I,height:d.length*_,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"arrowhead",markerWidth:"6",markerHeight:"4",refX:"5",refY:"2",orient:"auto",children:a.jsx("polygon",{points:"0 0, 6 2, 0 4",fill:"var(--nice-text-secondary, #6b7280)"})})}),e]})};return H?null:a.jsxs("div",{className:`nice-gantt ${J||""}`,style:K,children:[G&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ee,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[o,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:U,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:C,minWidth:C},children:[a.jsxs("div",{className:"nice-gantt__table-header",children:[a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--main","aria-hidden":"true",children:" "}),a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--sub",children:S.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-header-cell",style:{width:e.width||120},children:e.title},t))})]}),a.jsx("div",{className:"nice-gantt__table-body",ref:B,children:d.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:_},children:S.map((s,n)=>a.jsx("div",{className:"nice-gantt__table-cell",style:{width:s.width||120},children:e[s.field]},n))},e.id))})]}),a.jsx("div",{className:"nice-gantt__chart",children:a.jsxs("div",{className:"nice-gantt__chart-body-wrap",ref:q,children:[te(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:I,height:d.length*_,position:"relative"},children:[Array.from({length:m.days},(e,t)=>{const s=p(m.start,t),n=s.getDay()===0||s.getDay()===6;return a.jsx("div",{className:`nice-gantt__gridline ${n?"nice-gantt__gridline--weekend":""}`,style:{left:t*o,width:o,height:"100%",position:"absolute",top:0}},t)}),d.map((e,t)=>ne(e,t)),ae()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(P.displayName="NiceGantt");exports.NiceGantt=P;
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@nice2dev/ui-core"),l=require("react"),v=require("./NiceButton-DzCqkG5a.cjs"),lt=require("./devops-CFytAJQr.cjs"),at=require("./NiceSelect-CdUHd8rj.cjs"),ve=require("./NiceColorPicker-BV3olE3M.cjs");function je(m){const t=m.trim().toLowerCase();return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")?!0:!(t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:text"))}function we(m){const t=typeof window<"u"?window.getSelection():null;if(!t||t.rangeCount===0)return null;const _=t.getRangeAt(0);return m.contains(_.commonAncestorContainer)?_.cloneRange():null}function Se(m){const t=typeof window<"u"?window.getSelection():null;!t||!m||(t.removeAllRanges(),t.addRange(m))}const st=[{target:".nice-htmleditor",titleKey:"tutorial.htmlEditor.intro.title",title:"Rich text editor",contentKey:"tutorial.htmlEditor.intro.content",content:"Format text with the toolbar, insert links, images and tables, and switch to HTML or Markdown source when you need it.",placement:"auto"}],ct=["bold","italic","underline","strikethrough","h1","h2","h3","ul","ol","blockquote","hr","link","unlink","image","table","code","alignLeft","alignCenter","alignRight","fontSize","fontColor","undo","redo","clear","findReplace","emoji","source","fullscreen","markdown"],s=m=>r.jsx(u.NiceIcon,{name:m,size:16}),dt={bold:r.jsx("strong",{style:{fontFamily:"serif"},children:"B"}),italic:r.jsx("em",{style:{fontFamily:"serif"},children:"I"}),underline:r.jsx("span",{style:{textDecoration:"underline"},children:"U"}),strikethrough:r.jsx("span",{style:{textDecoration:"line-through"},children:"S"}),h1:"H1",h2:"H2",h3:"H3",ul:s("list"),ol:s("list-ordered"),link:s("link"),unlink:s("unlink"),undo:s("reply"),redo:s("forward"),clear:s("trash"),table:s("table"),image:s("image"),code:s("code"),markdown:"MD",blockquote:s("quote"),hr:s("minus"),subscript:"X₂",superscript:"X²",indent:s("indent"),outdent:s("outdent"),alignLeft:s("align-left"),alignCenter:s("align-center"),alignRight:s("align-right"),alignJustify:s("align-justify"),fullscreen:s("expand"),removeFormat:s("eraser"),print:s("printer"),source:s("terminal"),emoji:s("smile"),findReplace:s("search"),fontSize:s("type"),fontColor:s("palette")},ut=[{value:"1",label:"8pt"},{value:"2",label:"10pt"},{value:"3",label:"12pt"},{value:"4",label:"14pt"},{value:"5",label:"18pt"},{value:"6",label:"24pt"},{value:"7",label:"36pt"}],mt=[{label:"Faces",emojis:["😀","😂","😊","😍","🤔","😢","😎","🥳","😤","🤯","🥰","😴"]},{label:"Hands",emojis:["👍","👎","👏","🤝","✌️","🤞","💪","🙌","👋","🤙"]},{label:"Symbols",emojis:["❤️","⭐","🔥","✅","❌","⚡","💡","📌","🎯","🏆","🎉","💬"]},{label:"Arrows",emojis:["➡️","⬅️","⬆️","⬇️","↩️","🔄","▶️","⏸️","⏹️","⏩"]}];function ft(m){let t=m;return t=t.replace(/<h1[^>]*>(.*?)<\/h1>/gi,`# $1
2
+ `),t=t.replace(/<h2[^>]*>(.*?)<\/h2>/gi,`## $1
3
+ `),t=t.replace(/<h3[^>]*>(.*?)<\/h3>/gi,`### $1
4
+ `),t=t.replace(/<strong[^>]*>(.*?)<\/strong>/gi,"**$1**"),t=t.replace(/<b[^>]*>(.*?)<\/b>/gi,"**$1**"),t=t.replace(/<em[^>]*>(.*?)<\/em>/gi,"*$1*"),t=t.replace(/<i[^>]*>(.*?)<\/i>/gi,"*$1*"),t=t.replace(/<code[^>]*>(.*?)<\/code>/gi,"`$1`"),t=t.replace(/<pre[^>]*>(.*?)<\/pre>/gis,"```\n$1\n```\n"),t=t.replace(/<br\s*\/?>/gi,`
5
+ `),t=t.replace(/<li[^>]*>(.*?)<\/li>/gi,`- $1
6
+ `),t=t.replace(/<\/?(?:ul|ol|p|div)[^>]*>/gi,`
7
+ `),t=t.replace(/<[^>]+>/g,""),t=t.replace(/\n{3,}/g,`
8
+
9
+ `),t.trim()}function pt(m){let t=m;return t=t.replace(/^### (.+)$/gm,"<h3>$1</h3>"),t=t.replace(/^## (.+)$/gm,"<h2>$1</h2>"),t=t.replace(/^# (.+)$/gm,"<h1>$1</h1>"),t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*(.+?)\*/g,"<em>$1</em>"),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/```\n?([\s\S]*?)\n?```/g,"<pre>$1</pre>"),t=t.replace(/^- (.+)$/gm,"<li>$1</li>"),t=t.replace(/(<li>.*<\/li>)/gs,"<ul>$1</ul>"),t=t.replace(/\n/g,"<br>"),t}const ht=({value:m,defaultValue:t,onChange:_,placeholder:Te,height:I=200,toolbar:He=ct,readOnly:g,onImageUpload:M,mentionTrigger:C,mentionSuggestions:oe,onMentionSearch:ie,onFileDrop:N,pasteCleanup:le=!0,maxLength:j=0,showWordCount:ae=!1,templates:O,label:se,error:L,helperText:ce,required:Me,disabled:b,size:Ne="md",id:de,className:Re,style:Ee,accessMode:_e,tutorial:Le})=>{const{t:d}=u.useNiceTranslation(),{prompt:F,element:ze}=lt.useNiceDialogs(),B=u.useNiceAccessMode(_e,de),De=B==="hidden";B==="disabled"&&(b=!0),B==="readOnly"&&(g=!0);const ue=u.useControlId(de),[p,c]=u.useControllableState({value:m,defaultValue:t,fallbackValue:"",onChange:_,componentName:"NiceHtmlEditor"}),f=l.useRef(null),[$e]=l.useState(()=>({__html:p})),K=l.useRef(p);K.current=p;const Ie=l.useCallback(e=>{f.current=e,e&&e.innerHTML!==K.current&&(e.innerHTML=K.current)},[]);l.useLayoutEffect(()=>{const e=f.current;e&&e.innerHTML!==p&&(e.innerHTML=p)},[p]);const me=l.useRef(null),Oe=l.useRef(null),[w,W]=l.useState(!1),[A,fe]=l.useState(""),[S,q]=l.useState(!1),[P,pe]=l.useState(""),[U,z]=l.useState(!1),[he,Fe]=l.useState(""),[Q,X]=l.useState(0),[J,Be]=l.useState(!1),[xe,Ke]=l.useState("#000000"),[ge,We]=l.useState("#ffff00"),[be,D]=l.useState(0),[Ae,qe]=l.useState(0),[V,G]=l.useState(!1),[h,Pe]=l.useState(""),[R,Ue]=l.useState(""),[Y,Ce]=l.useState(!1),[Z,ee]=l.useState(!1),te=l.useRef(null);u.useRovingFocus(te,{orientation:"vertical",wrap:!0}),u.useOverlayFocus(te,{open:Z,modal:!1,onClose:()=>ee(!1)});const x=l.useCallback((e,n)=>{if(g||b)return;if(e==="markdown"){w?(c(pt(A)),W(!1)):(fe(ft(p)),W(!0),q(!1));return}if(e==="source"){S?(c(P),q(!1)):(pe(p),q(!0),W(!1));return}const i=f.current;if(i){if(e==="fullscreen"){Be(o=>!o);return}if(e==="emoji"){Ce(o=>!o);return}if(e==="findReplace"){G(o=>!o);return}if(e==="image"){if(M)me.current?.click();else{const o=we(i);F({title:d("htmlEditor.imageUrlPrompt","Image URL"),inputType:"url",placeholder:"https://"}).then(a=>{a&&je(a)&&(i.focus(),Se(o),document.execCommand("insertImage",!1,a),c(u.sanitizeHtml(i.innerHTML)))})}return}switch(i.focus(),e){case"bold":document.execCommand("bold");break;case"italic":document.execCommand("italic");break;case"underline":document.execCommand("underline");break;case"strikethrough":document.execCommand("strikeThrough");break;case"h1":document.execCommand("formatBlock",!1,"h1");break;case"h2":document.execCommand("formatBlock",!1,"h2");break;case"h3":document.execCommand("formatBlock",!1,"h3");break;case"ul":document.execCommand("insertUnorderedList");break;case"ol":document.execCommand("insertOrderedList");break;case"blockquote":document.execCommand("formatBlock",!1,"blockquote");break;case"hr":document.execCommand("insertHorizontalRule");break;case"subscript":document.execCommand("subscript");break;case"superscript":document.execCommand("superscript");break;case"indent":document.execCommand("indent");break;case"outdent":document.execCommand("outdent");break;case"alignLeft":document.execCommand("justifyLeft");break;case"alignCenter":document.execCommand("justifyCenter");break;case"alignRight":document.execCommand("justifyRight");break;case"alignJustify":document.execCommand("justifyFull");break;case"removeFormat":document.execCommand("removeFormat");break;case"print":window.print();return;case"link":{const o=we(i);F({title:d("htmlEditor.linkUrlPrompt","Link URL"),inputType:"url",placeholder:"https://"}).then(a=>{a&&je(a)&&(i.focus(),Se(o),document.execCommand("createLink",!1,a),c(u.sanitizeHtml(i.innerHTML)),D(i.textContent?.length??0))});return}case"unlink":document.execCommand("unlink");break;case"undo":document.execCommand("undo");break;case"redo":document.execCommand("redo");break;case"clear":document.execCommand("removeFormat");break;case"fontSize":{n&&document.execCommand("fontSize",!1,n);break}case"fontColor":{n&&document.execCommand("foreColor",!1,n);break}case"bgColor":{n&&document.execCommand("hiliteColor",!1,n);break}case"table":{document.execCommand("insertHTML",!1,'<table class="nice-htmleditor__table"><thead><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th></tr></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table><p>&nbsp;</p>');break}case"code":{const a=window.getSelection()?.toString()||"";a.includes(`
10
+ `)||a.length>60?document.execCommand("insertHTML",!1,`<pre class="nice-htmleditor__code-block">${a||"// code"}</pre>`):document.execCommand("insertHTML",!1,`<code>${a||"code"}</code>`);break}}c(u.sanitizeHtml(i.innerHTML)),D(i.textContent?.length??0)}},[c,g,b,w,A,p,M,S,P,F,d]),Qe=l.useCallback(async e=>{const n=e.target.files?.[0];if(!n||!M)return;const i=await M(n),o=f.current;o&&i&&(o.focus(),document.execCommand("insertImage",!1,i),c(o.innerHTML)),e.target.value=""},[M,c]),Xe=l.useCallback(()=>{const e=f.current;if(!e)return;const n=e.textContent?.length??0;if(j>0&&n>j&&(e.textContent=(e.textContent??"").slice(0,j)),D(n),qe((e.textContent??"").trim().split(/\s+/).filter(Boolean).length),c(e.innerHTML),C){const i=window.getSelection();if(i&&i.rangeCount>0){const o=i.getRangeAt(0),a=o.startContainer;if(a.nodeType===Node.TEXT_NODE){const k=a.textContent||"",H=o.startOffset,$=k.slice(0,H),y=$.lastIndexOf(C);if(y>=0&&(y===0||/\s/.test($[y-1]))){const E=$.slice(y+C.length);if(!/\s/.test(E)){z(!0),Fe(E),X(0),ie?.(E);return}}}}z(!1)}},[j,c,C,ie]),T=l.useMemo(()=>oe?.filter(e=>e.label.toLowerCase().includes(he.toLowerCase())).slice(0,8)??[],[oe,he]),ne=l.useCallback(e=>{const n=f.current;if(!n)return;const i=window.getSelection();if(!i||i.rangeCount===0)return;const o=i.getRangeAt(0),a=o.startContainer;if(a.nodeType===Node.TEXT_NODE&&C){const k=a.textContent||"",H=o.startOffset,y=k.slice(0,H).lastIndexOf(C);if(y>=0){const E=k.slice(0,y),rt=k.slice(H),ot=`<span class="nice-htmleditor__mention" data-mention="${e.key}" contenteditable="false">${C}${e.label}</span>&nbsp;`;a.textContent=E;const re=document.createRange();re.setStartAfter(a),re.collapse(!0);const it=re.createContextualFragment(ot+rt);a.parentNode?.insertBefore(it,a.nextSibling),i.collapseToEnd(),c(n.innerHTML)}}z(!1)},[C,c]),Je=l.useCallback(e=>{if(U&&T.length>0){e.key==="ArrowDown"?(e.preventDefault(),X(n=>Math.min(n+1,T.length-1))):e.key==="ArrowUp"?(e.preventDefault(),X(n=>Math.max(n-1,0))):e.key==="Enter"?(e.preventDefault(),ne(T[Q])):e.key==="Escape"&&z(!1);return}(e.ctrlKey||e.metaKey)&&e.key==="b"?(e.preventDefault(),x("bold")):(e.ctrlKey||e.metaKey)&&e.key==="i"?(e.preventDefault(),x("italic")):(e.ctrlKey||e.metaKey)&&e.key==="u"?(e.preventDefault(),x("underline")):(e.ctrlKey||e.metaKey)&&e.key==="f"?(e.preventDefault(),G(n=>!n)):(e.ctrlKey||e.metaKey)&&e.key==="z"&&!e.shiftKey?(e.preventDefault(),x("undo")):(e.ctrlKey||e.metaKey)&&(e.key==="y"||e.key==="z"&&e.shiftKey)&&(e.preventDefault(),x("redo"))},[U,T,Q,ne,x]),Ve=l.useCallback(e=>{if(!le)return;e.preventDefault();const n=e.clipboardData.getData("text/html"),i=e.clipboardData.getData("text/plain");if(n){const a=n.replace(/<style[\s\S]*?<\/style>/gi,"").replace(/<script[\s\S]*?<\/script>/gi,"").replace(/class="[^"]*"/gi,"").replace(/style="[^"]*"/gi,"").replace(/<o:[^>]*>[\s\S]*?<\/o:[^>]*>/gi,"").replace(/<!--[\s\S]*?-->/g,"").replace(/<\/?(?:xml|meta|link|font|span)[^>]*>/gi,"");document.execCommand("insertHTML",!1,a)}else i&&document.execCommand("insertText",!1,i);const o=f.current;o&&(c(o.innerHTML),D(o.textContent?.length??0))},[le,c]),Ge=l.useCallback(async e=>{if(!N)return;e.preventDefault();const n=Array.from(e.dataTransfer.files);if(n.length===0)return;const i=await N(n),o=f.current;if(o){o.focus();for(const a of i)if(/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i.test(a)||a.startsWith("data:image/"))document.execCommand("insertImage",!1,a);else{const H=`<a href="${a}">${a.split("/").pop()??a}</a>`;document.execCommand("insertHTML",!1,H)}c(o.innerHTML)}},[N,c]),Ye=l.useCallback(e=>{N&&e.preventDefault()},[N]),ke=l.useCallback(e=>{const n=f.current;if(!n||!h)return;const i=n.textContent??"",o=h.toLowerCase(),a=i.toLowerCase();(e===1?a.indexOf(o):a.lastIndexOf(o))!==-1&&(n.focus(),window.find?.(h))},[h]),Ze=l.useCallback(()=>{const e=f.current;!e||!h||(e.innerHTML=e.innerHTML.split(h).join(R),c(e.innerHTML))},[h,R,c]),et=l.useCallback(()=>{if(!h)return;const e=p.split(h).join(R);c(e);const n=f.current;n&&(n.innerHTML=e)},[h,R,p,c]),tt=l.useCallback(e=>{const n=f.current;n&&(n.focus(),document.execCommand("insertText",!1,e),c(n.innerHTML),Ce(!1))},[c]),ye=l.useCallback(e=>{const n=f.current;n&&(n.focus(),document.execCommand("insertHTML",!1,e),c(n.innerHTML),ee(!1))},[c]),nt=l.useCallback(e=>{const n=b||g;if(e==="fontSize")return r.jsx(at.NiceSelect,{size:"sm",value:"",onChange:o=>x("fontSize",String(o)),disabled:n,placeholder:d("htmlEditor.size","Size"),options:ut.map(o=>({value:o.value,label:o.label})),style:{minWidth:70,maxWidth:80}},e);if(e==="fontColor")return r.jsx(ve.NiceColorPicker,{value:xe,onChange:o=>{Ke(o),x("fontColor",o)},disabled:n,size:"sm",label:"",title:d("htmlEditor.textColor","Text color")},e);if(e==="bgColor")return r.jsx(ve.NiceColorPicker,{value:ge,onChange:o=>{We(o),x("bgColor",o)},disabled:n,size:"sm",label:"",title:d("htmlEditor.highlightColor","Highlight color")},e);const i=e==="markdown"&&w||e==="fullscreen"&&J||e==="source"&&S||e==="findReplace"&&V||e==="emoji"&&Y;return r.jsx(v.NiceButton,{size:"sm",variant:i?"primary":"ghost",onClick:()=>x(e),title:e,disabled:n,children:dt[e]||e},e)},[b,g,x,w,J,xe,ge,S,V,Y,d]);return De?null:r.jsxs("div",{className:`nice-field nice-field--${Ne} ${L?"nice-field--error":""} ${Re||""}`,style:Ee,children:[ze,se&&r.jsxs("label",{className:"nice-field__label",htmlFor:ue,children:[se,Me&&r.jsx("span",{className:"nice-field__required",children:"*"})]}),r.jsxs("div",{ref:Oe,className:`nice-htmleditor${J?" nice-htmleditor--fullscreen":""}`,style:{position:"relative"},children:[r.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:r.jsx(u.NiceTutorialButton,{steps:u.resolveTutorial(Le,st)})}),r.jsxs("div",{className:"nice-htmleditor__toolbar",style:{display:"flex",flexWrap:"wrap",gap:2,alignItems:"center"},children:[He.map(nt),O&&O.length>0&&r.jsxs("div",{style:{position:"relative"},children:[r.jsx(v.NiceButton,{size:"sm",variant:Z?"primary":"ghost",onClick:()=>ee(e=>!e),title:d("htmlEditor.insertTemplate","Insert template"),children:r.jsx(u.NiceIcon,{name:"clipboard",size:16})}),Z&&r.jsx("ul",{ref:te,role:"menu","aria-label":d("htmlEditor.insertTemplate","Insert template"),style:{position:"absolute",top:"100%",right:0,zIndex:200,background:"var(--nice-bg-primary, #fff)",border:"1px solid var(--nice-border-color, #ddd)",borderRadius:6,boxShadow:"0 4px 16px var(--nice-overlay-12, rgba(0, 0, 0, 0.12))",listStyle:"none",margin:0,padding:4,minWidth:160,maxHeight:200,overflow:"auto"},children:O.map((e,n)=>r.jsx("li",{role:"menuitem",tabIndex:-1,style:{padding:"6px 10px",cursor:"pointer",borderRadius:4},onMouseDown:i=>{i.preventDefault(),ye(e.html)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),ye(e.html))},children:e.label},n))})]})]}),V&&r.jsxs("div",{className:"nice-htmleditor__find-bar",style:{display:"flex",gap:4,alignItems:"center",padding:"4px 8px",background:"var(--nice-bg-secondary, #f8f9fa)",borderBottom:"1px solid var(--nice-border-color, #ddd)",fontSize:"0.875em"},children:[r.jsx("input",{type:"text",placeholder:d("htmlEditor.find","Find..."),value:h,onChange:e=>Pe(e.target.value),style:{flex:1,maxWidth:180,padding:"2px 6px",border:"1px solid var(--nice-border-color, #ccc)",borderRadius:4,background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #1f2937)"}}),r.jsx("input",{type:"text",placeholder:d("htmlEditor.replace","Replace..."),value:R,onChange:e=>Ue(e.target.value),style:{flex:1,maxWidth:180,padding:"2px 6px",border:"1px solid var(--nice-border-color, #ccc)",borderRadius:4,background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #1f2937)"}}),r.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:()=>ke(1),title:d("htmlEditor.findNext","Find next"),children:r.jsx(u.NiceIcon,{name:"chevron-right",size:14})}),r.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:()=>ke(-1),title:d("htmlEditor.findPrevious","Find previous"),children:r.jsx(u.NiceIcon,{name:"chevron-left",size:14})}),r.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:Ze,disabled:b||g,children:d("htmlEditor.replace2","Replace")}),r.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:et,disabled:b||g,children:d("htmlEditor.all","All")}),r.jsx(v.NiceButton,{size:"sm",variant:"ghost",onClick:()=>G(!1),children:r.jsx(u.NiceIcon,{name:"close",size:14,title:d("htmlEditor.close","Close")})})]}),Y&&r.jsx("div",{className:"nice-htmleditor__emoji-picker",style:{padding:8,background:"var(--nice-bg-primary, #fff)",borderBottom:"1px solid var(--nice-border-color, #ddd)",maxHeight:180,overflowY:"auto"},children:mt.map(e=>r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:"0.7em",fontWeight:600,color:"var(--nice-text-muted, #999)",padding:"4px 0"},children:e.label}),r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:2},children:e.emojis.map(n=>r.jsx("span",{role:"button",tabIndex:0,onKeyDown:u.clickOnActivationKey,style:{cursor:"pointer",fontSize:"1.2em",padding:2,borderRadius:4},onClick:()=>tt(n),title:n,children:n},n))})]},e.label))}),r.jsx("input",{ref:me,type:"file",accept:"image/*",style:{display:"none"},onChange:Qe}),S?r.jsx("textarea",{className:"nice-htmleditor__source",value:P,onChange:e=>pe(e.target.value),style:{minHeight:I,width:"100%",fontFamily:"monospace",resize:"vertical",whiteSpace:"pre",fontSize:"0.85em",background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #1f2937)",border:"none",padding:12,boxSizing:"border-box",outline:"none"},disabled:b||g}):w?r.jsx("textarea",{className:"nice-htmleditor__markdown",value:A,onChange:e=>fe(e.target.value),style:{minHeight:I,width:"100%",fontFamily:"monospace",resize:"vertical",background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #1f2937)",border:"none",padding:12,boxSizing:"border-box",outline:"none"},disabled:b||g}):r.jsxs("div",{style:{position:"relative"},children:[r.jsx("div",{ref:Ie,id:ue,className:"nice-htmleditor__content",contentEditable:!b&&!g,dangerouslySetInnerHTML:$e,onInput:Xe,onKeyDown:Je,onPaste:Ve,onDrop:Ge,onDragOver:Ye,style:{minHeight:I},"data-placeholder":Te,role:"textbox","aria-multiline":"true",suppressContentEditableWarning:!0}),U&&T.length>0&&r.jsx("ul",{className:"nice-htmleditor__mention-list",children:T.map((e,n)=>r.jsx("li",{role:"presentation",className:`nice-htmleditor__mention-item ${n===Q?"nice-htmleditor__mention-item--active":""}`,onMouseDown:i=>{i.preventDefault(),ne(e)},children:e.label},e.key))})]}),r.jsxs("div",{className:"nice-htmleditor__statusbar",style:{display:"flex",gap:12,padding:"2px 8px",fontSize:"0.75em",color:"var(--nice-text-muted, #666)",borderTop:"1px solid var(--nice-border-color, #eee)"},children:[j>0&&r.jsxs("span",{children:[be," / ",j]}),ae&&r.jsx("span",{children:d("htmlEditor.words","{wordCount} words").replace("{wordCount}",String(Ae))}),ae&&r.jsx("span",{children:d("htmlEditor.chars","{charCount} chars").replace("{charCount}",String(be))}),S&&r.jsx("span",{style:{fontWeight:600},children:d("htmlEditor.htmlSource","HTML Source")}),w&&r.jsx("span",{style:{fontWeight:600},children:d("htmlEditor.markdown","Markdown")})]})]}),L&&r.jsx("div",{className:"nice-field__error",children:L}),ce&&!L&&r.jsx("div",{className:"nice-field__hint",children:ce})]})};exports.NiceHtmlEditor=ht;