@stll/folio-react 0.6.0 → 0.8.0

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 (30) hide show
  1. package/dist/{CommentsSidebar-_utmEkA9.js → CommentsSidebar-Byn5lyrt.js} +127 -130
  2. package/dist/{FindReplaceDialog-DLdBekSR.js → FindReplaceDialog-CqKK82nE.js} +23 -18
  3. package/dist/FootnotePropertiesDialog-CixRdIiT.js +822 -0
  4. package/dist/ImagePositionDialog-DNodkoI2.js +1065 -0
  5. package/dist/ImagePropertiesDialog-CLsDIUWb.js +613 -0
  6. package/dist/InsertSymbolDialog-DCFLmfzn.js +376 -0
  7. package/dist/PageSetupDialog-COkgeOQn.js +820 -0
  8. package/dist/TablePropertiesDialog-B_AGrPR8.js +434 -0
  9. package/dist/{TextContextMenu-CG0V37wi.js → TextContextMenu-Ci7-M4oU.js} +199 -79
  10. package/dist/compat/eigenpal.d.ts +1 -1
  11. package/dist/compat/eigenpal.js +89 -17
  12. package/dist/dialogChrome-BoGYPgeu.js +26 -0
  13. package/dist/{dialogs-CzvXYJyG.js → dialogs-Bj2PdycR.js} +608 -352
  14. package/dist/{dialogs-j7qyw17x.d.ts → dialogs-DK8OVUT_.d.ts} +13 -1
  15. package/dist/dialogs.d.ts +2 -2
  16. package/dist/dialogs.js +9 -8
  17. package/dist/editor.css +1 -1
  18. package/dist/folio-ui-BgDDRsUX.js +1013 -0
  19. package/dist/index.d.ts +5 -4
  20. package/dist/index.js +12 -11
  21. package/dist/{renderAsync-B7UJsZye.d.ts → renderAsync-BmxQE7iO.d.ts} +12 -3
  22. package/dist/{renderAsync-CwHTsxBN.js → renderAsync-BtWYvQMT.js} +5717 -3275
  23. package/dist/standalone.css +1 -1
  24. package/package.json +8 -6
  25. package/dist/FootnotePropertiesDialog-CUjq9c6H.js +0 -267
  26. package/dist/ImagePositionDialog-BMuO9rLT.js +0 -395
  27. package/dist/ImagePropertiesDialog-C8iEgdmN.js +0 -198
  28. package/dist/PageSetupDialog-BKsSMCGb.js +0 -312
  29. package/dist/TablePropertiesDialog-Dw8gvL78.js +0 -159
  30. package/dist/useFindReplace-BPBpMWS9.js +0 -842
@@ -1,20 +1,14 @@
1
- import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
1
+ import { r as useFolioUI } from "./folio-ui-BgDDRsUX.js";
2
+ import { a as DIALOG_LABEL_CLASS, c as DIALOG_SECONDARY_BUTTON_CLASS, i as DIALOG_INPUT_CLASS, l as DIALOG_TITLE_CLASS, n as DIALOG_BODY_CLASS, o as DIALOG_POPUP_CLASS, r as DIALOG_FOOTER_CLASS, s as DIALOG_PRIMARY_BUTTON_CLASS, t as DIALOG_BACKDROP_CLASS, u as useCloseOnDialogOpenChange } from "./dialogChrome-BoGYPgeu.js";
3
+ import { c } from "react-compiler-runtime";
2
4
  import { useEffect, useId, useState } from "react";
5
+ import { useTranslations } from "use-intl";
3
6
  import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/components/dialogs/dialogChrome.ts
5
- const DIALOG_BACKDROP_CLASS = "fixed inset-0 z-[10000] bg-black/50";
6
- const DIALOG_POPUP_CLASS = "bg-popover fixed start-1/2 top-1/2 z-[10001] w-full max-w-[520px] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border shadow-xl";
7
- const DIALOG_TITLE_CLASS = "border-b px-5 py-3 text-base font-semibold";
8
- const DIALOG_BODY_CLASS = "flex flex-col gap-4 px-5 py-4";
9
- const DIALOG_FOOTER_CLASS = "flex justify-end gap-2 border-t px-5 py-3";
10
- const DIALOG_LABEL_CLASS = "text-muted-foreground text-[13px]";
11
- const DIALOG_INPUT_CLASS = "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none";
12
- const DIALOG_SECONDARY_BUTTON_CLASS = "border-input rounded border px-4 py-1.5 text-[13px]";
13
- const DIALOG_PRIMARY_BUTTON_CLASS = "bg-primary text-primary-foreground rounded px-4 py-1.5 text-[13px] font-medium disabled:cursor-not-allowed disabled:opacity-50";
14
- //#endregion
15
7
  //#region src/components/dialogs/HyperlinkDialog.tsx
16
8
  function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, selectedText, bookmarks = [] }) {
17
9
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
10
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
11
+ const t = useTranslations("folio");
18
12
  const id = useId();
19
13
  const [targetType, setTargetType] = useState("url");
20
14
  const [url, setUrl] = useState("");
@@ -57,10 +51,10 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
57
51
  const handleSubmit = () => {
58
52
  setTouched(true);
59
53
  if (!canSubmit) return;
60
- const href = targetType === "bookmark" ? `#${bookmark.trim()}` : normalizeUrl(url);
54
+ const href_0 = targetType === "bookmark" ? `#${bookmark.trim()}` : normalizeUrl(url);
61
55
  onSubmit({
62
- href,
63
- displayText: displayText.trim() || href,
56
+ href: href_0,
57
+ displayText: displayText.trim() || href_0,
64
58
  ...tooltip.trim() ? { tooltip: tooltip.trim() } : {}
65
59
  });
66
60
  onClose();
@@ -71,9 +65,7 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
71
65
  };
72
66
  return /* @__PURE__ */ jsx(Dialog, {
73
67
  open: isOpen,
74
- onOpenChange: (open) => {
75
- if (!open) onClose();
76
- },
68
+ onOpenChange: handleOpenChange,
77
69
  children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
78
70
  className: DIALOG_POPUP_CLASS,
79
71
  children: [
@@ -89,7 +81,7 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
89
81
  htmlFor: fieldIds.targetType,
90
82
  children: [/* @__PURE__ */ jsx("span", {
91
83
  className: "text-muted-foreground text-[13px]",
92
- children: "Link to"
84
+ children: t("dialogs.hyperlink.linkTo")
93
85
  }), /* @__PURE__ */ jsxs("select", {
94
86
  className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
95
87
  id: fieldIds.targetType,
@@ -97,10 +89,10 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
97
89
  value: targetType,
98
90
  children: [/* @__PURE__ */ jsx("option", {
99
91
  value: "url",
100
- children: "Web address"
92
+ children: t("dialogs.hyperlink.tabWebAddress")
101
93
  }), /* @__PURE__ */ jsx("option", {
102
94
  value: "bookmark",
103
- children: "Bookmark"
95
+ children: t("dialogs.hyperlink.tabBookmark")
104
96
  })]
105
97
  })]
106
98
  }),
@@ -110,14 +102,14 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
110
102
  children: [
111
103
  /* @__PURE__ */ jsx("span", {
112
104
  className: "text-muted-foreground text-[13px]",
113
- children: "Address"
105
+ children: t("dialogs.hyperlink.addressLabel")
114
106
  }),
115
107
  /* @__PURE__ */ jsx("input", {
116
108
  "aria-invalid": touched && urlError.length > 0,
117
109
  className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
118
110
  id: fieldIds.url,
119
111
  onBlur: () => setTouched(true),
120
- onChange: (e) => setUrl(e.target.value),
112
+ onChange: (e_0) => setUrl(e_0.target.value),
121
113
  placeholder: "https://example.com",
122
114
  value: url
123
115
  }),
@@ -132,15 +124,15 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
132
124
  htmlFor: fieldIds.bookmark,
133
125
  children: [/* @__PURE__ */ jsx("span", {
134
126
  className: "text-muted-foreground text-[13px]",
135
- children: "Bookmark"
127
+ children: t("dialogs.hyperlink.bookmarkLabel")
136
128
  }), /* @__PURE__ */ jsxs("select", {
137
129
  className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
138
130
  id: fieldIds.bookmark,
139
- onChange: (e) => setBookmark(e.target.value),
131
+ onChange: (e_1) => setBookmark(e_1.target.value),
140
132
  value: bookmark,
141
133
  children: [/* @__PURE__ */ jsx("option", {
142
134
  value: "",
143
- children: "Select a bookmark"
135
+ children: t("dialogs.hyperlink.bookmarkPlaceholder")
144
136
  }), bookmarks.map((option) => /* @__PURE__ */ jsx("option", {
145
137
  value: option.name,
146
138
  children: option.label ?? option.name
@@ -152,11 +144,11 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
152
144
  htmlFor: fieldIds.displayText,
153
145
  children: [/* @__PURE__ */ jsx("span", {
154
146
  className: DIALOG_LABEL_CLASS,
155
- children: "Text to display"
147
+ children: t("dialogs.hyperlink.displayTextPlaceholder")
156
148
  }), /* @__PURE__ */ jsx("input", {
157
149
  className: DIALOG_INPUT_CLASS,
158
150
  id: fieldIds.displayText,
159
- onChange: (e) => setDisplayText(e.target.value),
151
+ onChange: (e_2) => setDisplayText(e_2.target.value),
160
152
  value: displayText
161
153
  })]
162
154
  }),
@@ -165,11 +157,11 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
165
157
  htmlFor: fieldIds.tooltip,
166
158
  children: [/* @__PURE__ */ jsx("span", {
167
159
  className: DIALOG_LABEL_CLASS,
168
- children: "Screen tip"
160
+ children: t("dialogs.hyperlink.screenTipLabel")
169
161
  }), /* @__PURE__ */ jsx("input", {
170
162
  className: DIALOG_INPUT_CLASS,
171
163
  id: fieldIds.tooltip,
172
- onChange: (e) => setTooltip(e.target.value),
164
+ onChange: (e_3) => setTooltip(e_3.target.value),
173
165
  value: tooltip
174
166
  })]
175
167
  })
@@ -182,18 +174,18 @@ function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, sel
182
174
  className: "text-destructive me-auto rounded px-4 py-1.5 text-[13px]",
183
175
  onClick: handleRemove,
184
176
  type: "button",
185
- children: "Remove"
177
+ children: t("common.remove")
186
178
  }),
187
179
  /* @__PURE__ */ jsx(DialogClose, {
188
180
  className: DIALOG_SECONDARY_BUTTON_CLASS,
189
- children: "Cancel"
181
+ children: t("common.cancel")
190
182
  }),
191
183
  /* @__PURE__ */ jsx("button", {
192
184
  className: DIALOG_PRIMARY_BUTTON_CLASS,
193
185
  disabled: !canSubmit,
194
186
  onClick: handleSubmit,
195
187
  type: "button",
196
- children: isEditing ? "Update" : "Insert"
188
+ children: isEditing ? t("common.update") : t("common.insert")
197
189
  })
198
190
  ]
199
191
  })
@@ -225,6 +217,8 @@ function normalizeUrl(value) {
225
217
  //#region src/components/dialogs/InsertImageDialog.tsx
226
218
  function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,image/jpeg,image/gif,image/webp" }) {
227
219
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
220
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
221
+ const t = useTranslations("folio");
228
222
  const id = useId();
229
223
  const [file, setFile] = useState(null);
230
224
  const [alt, setAlt] = useState("");
@@ -257,15 +251,13 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
257
251
  };
258
252
  return /* @__PURE__ */ jsx(Dialog, {
259
253
  open: isOpen,
260
- onOpenChange: (open) => {
261
- if (!open) onClose();
262
- },
254
+ onOpenChange: handleOpenChange,
263
255
  children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
264
256
  className: DIALOG_POPUP_CLASS,
265
257
  children: [
266
258
  /* @__PURE__ */ jsx(DialogTitle, {
267
259
  className: DIALOG_TITLE_CLASS,
268
- children: "Insert Image"
260
+ children: t("dialogs.insertImage.title")
269
261
  }),
270
262
  /* @__PURE__ */ jsxs("div", {
271
263
  className: DIALOG_BODY_CLASS,
@@ -275,7 +267,7 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
275
267
  htmlFor: fieldIds.file,
276
268
  children: [/* @__PURE__ */ jsx("span", {
277
269
  className: DIALOG_LABEL_CLASS,
278
- children: "Image file"
270
+ children: t("dialogs.insertImage.imageFile")
279
271
  }), /* @__PURE__ */ jsx("input", {
280
272
  accept,
281
273
  className: DIALOG_INPUT_CLASS,
@@ -289,11 +281,11 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
289
281
  htmlFor: fieldIds.alt,
290
282
  children: [/* @__PURE__ */ jsx("span", {
291
283
  className: DIALOG_LABEL_CLASS,
292
- children: "Alt text"
284
+ children: t("dialogs.insertImage.altText")
293
285
  }), /* @__PURE__ */ jsx("input", {
294
286
  className: DIALOG_INPUT_CLASS,
295
287
  id: fieldIds.alt,
296
- onChange: (e) => setAlt(e.target.value),
288
+ onChange: (e_0) => setAlt(e_0.target.value),
297
289
  placeholder: file?.name ?? "",
298
290
  value: alt
299
291
  })]
@@ -305,12 +297,12 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
305
297
  htmlFor: fieldIds.width,
306
298
  children: [/* @__PURE__ */ jsx("span", {
307
299
  className: DIALOG_LABEL_CLASS,
308
- children: "Width"
300
+ children: t("dialogs.imageProperties.widthLabel")
309
301
  }), /* @__PURE__ */ jsx("input", {
310
302
  className: DIALOG_INPUT_CLASS,
311
303
  id: fieldIds.width,
312
304
  min: 1,
313
- onChange: (e) => setWidth(e.target.value),
305
+ onChange: (e_1) => setWidth(e_1.target.value),
314
306
  placeholder: "Auto",
315
307
  type: "number",
316
308
  value: width
@@ -320,12 +312,12 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
320
312
  htmlFor: fieldIds.height,
321
313
  children: [/* @__PURE__ */ jsx("span", {
322
314
  className: DIALOG_LABEL_CLASS,
323
- children: "Height"
315
+ children: t("dialogs.imageProperties.heightLabel")
324
316
  }), /* @__PURE__ */ jsx("input", {
325
317
  className: DIALOG_INPUT_CLASS,
326
318
  id: fieldIds.height,
327
319
  min: 1,
328
- onChange: (e) => setHeight(e.target.value),
320
+ onChange: (e_2) => setHeight(e_2.target.value),
329
321
  placeholder: "Auto",
330
322
  type: "number",
331
323
  value: height
@@ -338,13 +330,13 @@ function InsertImageDialog({ isOpen, onClose, onInsert, accept = "image/png,imag
338
330
  className: DIALOG_FOOTER_CLASS,
339
331
  children: [/* @__PURE__ */ jsx(DialogClose, {
340
332
  className: DIALOG_SECONDARY_BUTTON_CLASS,
341
- children: "Cancel"
333
+ children: t("common.cancel")
342
334
  }), /* @__PURE__ */ jsx("button", {
343
335
  className: DIALOG_PRIMARY_BUTTON_CLASS,
344
336
  disabled: !file,
345
337
  onClick: handleInsert,
346
338
  type: "button",
347
- children: "Insert"
339
+ children: t("common.insert")
348
340
  })]
349
341
  })
350
342
  ]
@@ -379,6 +371,8 @@ const DEFAULT_STYLE_OPTIONS = [
379
371
  ];
380
372
  function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, defaultColumns = 3, styleOptions = DEFAULT_STYLE_OPTIONS }) {
381
373
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
374
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
375
+ const t = useTranslations("folio");
382
376
  const id = useId();
383
377
  const [rows, setRows] = useState(defaultRows);
384
378
  const [columns, setColumns] = useState(defaultColumns);
@@ -420,15 +414,13 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
420
414
  };
421
415
  return /* @__PURE__ */ jsx(Dialog, {
422
416
  open: isOpen,
423
- onOpenChange: (open) => {
424
- if (!open) onClose();
425
- },
417
+ onOpenChange: handleOpenChange,
426
418
  children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
427
419
  className: DIALOG_POPUP_CLASS,
428
420
  children: [
429
421
  /* @__PURE__ */ jsx(DialogTitle, {
430
422
  className: DIALOG_TITLE_CLASS,
431
- children: "Insert Table"
423
+ children: t("dialogs.insertTable.title")
432
424
  }),
433
425
  /* @__PURE__ */ jsxs("div", {
434
426
  className: DIALOG_BODY_CLASS,
@@ -469,7 +461,7 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
469
461
  htmlFor: fieldIds.rows,
470
462
  children: [/* @__PURE__ */ jsx("span", {
471
463
  className: DIALOG_LABEL_CLASS,
472
- children: "Rows"
464
+ children: t("dialogs.insertTable.rowsLabel")
473
465
  }), /* @__PURE__ */ jsx("input", {
474
466
  className: DIALOG_INPUT_CLASS,
475
467
  id: fieldIds.rows,
@@ -484,13 +476,13 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
484
476
  htmlFor: fieldIds.columns,
485
477
  children: [/* @__PURE__ */ jsx("span", {
486
478
  className: DIALOG_LABEL_CLASS,
487
- children: "Columns"
479
+ children: t("dialogs.insertTable.columnsLabel")
488
480
  }), /* @__PURE__ */ jsx("input", {
489
481
  className: DIALOG_INPUT_CLASS,
490
482
  id: fieldIds.columns,
491
483
  max: MAX_COLUMNS,
492
484
  min: MIN_COLUMNS,
493
- onChange: (e) => setColumns(Number(e.target.value) || MIN_COLUMNS),
485
+ onChange: (e_0) => setColumns(Number(e_0.target.value) || MIN_COLUMNS),
494
486
  type: "number",
495
487
  value: columns
496
488
  })]
@@ -502,11 +494,11 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
502
494
  children: [/* @__PURE__ */ jsx("input", {
503
495
  checked: autofit,
504
496
  id: fieldIds.autofit,
505
- onChange: (e) => setAutofit(e.target.checked),
497
+ onChange: (e_1) => setAutofit(e_1.target.checked),
506
498
  type: "checkbox"
507
499
  }), /* @__PURE__ */ jsx("span", {
508
500
  className: DIALOG_LABEL_CLASS,
509
- children: "Autofit to contents"
501
+ children: t("dialogs.insertTable.autofit")
510
502
  })]
511
503
  }),
512
504
  styleOptions.length > 0 && /* @__PURE__ */ jsxs("label", {
@@ -514,15 +506,15 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
514
506
  htmlFor: fieldIds.style,
515
507
  children: [/* @__PURE__ */ jsx("span", {
516
508
  className: "text-muted-foreground text-[13px]",
517
- children: "Style"
509
+ children: t("dialogs.insertTable.style")
518
510
  }), /* @__PURE__ */ jsxs("select", {
519
511
  className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
520
512
  id: fieldIds.style,
521
- onChange: (e) => setStyleId(e.target.value),
513
+ onChange: (e_2) => setStyleId(e_2.target.value),
522
514
  value: styleId,
523
515
  children: [/* @__PURE__ */ jsx("option", {
524
516
  value: "",
525
- children: "Plain table"
517
+ children: t("dialogs.insertTable.plainTable")
526
518
  }), styleOptions.map((style) => /* @__PURE__ */ jsx("option", {
527
519
  value: style.id,
528
520
  children: style.name
@@ -535,13 +527,13 @@ function InsertTableDialog({ isOpen, onClose, onInsert, defaultRows = 3, default
535
527
  className: DIALOG_FOOTER_CLASS,
536
528
  children: [/* @__PURE__ */ jsx(DialogClose, {
537
529
  className: DIALOG_SECONDARY_BUTTON_CLASS,
538
- children: "Cancel"
530
+ children: t("common.cancel")
539
531
  }), /* @__PURE__ */ jsx("button", {
540
532
  className: DIALOG_PRIMARY_BUTTON_CLASS,
541
533
  disabled: !canInsert,
542
534
  onClick: handleInsert,
543
535
  type: "button",
544
- children: "Insert"
536
+ children: t("common.insert")
545
537
  })]
546
538
  })
547
539
  ]
@@ -572,6 +564,8 @@ const PASTE_MODES = [
572
564
  ];
573
565
  function PasteSpecialDialog({ isOpen, onClose, onPaste, defaultMode = "plainText" }) {
574
566
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
567
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
568
+ const t = useTranslations("folio");
575
569
  const id = useId();
576
570
  const [mode, setMode] = useState(defaultMode);
577
571
  useEffect(() => {
@@ -583,15 +577,13 @@ function PasteSpecialDialog({ isOpen, onClose, onPaste, defaultMode = "plainText
583
577
  };
584
578
  return /* @__PURE__ */ jsx(Dialog, {
585
579
  open: isOpen,
586
- onOpenChange: (open) => {
587
- if (!open) onClose();
588
- },
580
+ onOpenChange: handleOpenChange,
589
581
  children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
590
582
  className: DIALOG_POPUP_CLASS,
591
583
  children: [
592
584
  /* @__PURE__ */ jsx(DialogTitle, {
593
585
  className: DIALOG_TITLE_CLASS,
594
- children: "Paste Special"
586
+ children: t("dialogs.pasteSpecial.title")
595
587
  }),
596
588
  /* @__PURE__ */ jsx("div", {
597
589
  className: DIALOG_BODY_CLASS,
@@ -599,7 +591,7 @@ function PasteSpecialDialog({ isOpen, onClose, onPaste, defaultMode = "plainText
599
591
  className: "flex flex-col gap-3",
600
592
  children: [/* @__PURE__ */ jsx("legend", {
601
593
  className: DIALOG_LABEL_CLASS,
602
- children: "Paste mode"
594
+ children: t("dialogs.pasteSpecial.pasteMode")
603
595
  }), PASTE_MODES.map((option) => {
604
596
  const optionId = `${id}-paste-special-${option.value}`;
605
597
  return /* @__PURE__ */ jsxs("label", {
@@ -628,12 +620,12 @@ function PasteSpecialDialog({ isOpen, onClose, onPaste, defaultMode = "plainText
628
620
  className: DIALOG_FOOTER_CLASS,
629
621
  children: [/* @__PURE__ */ jsx(DialogClose, {
630
622
  className: DIALOG_SECONDARY_BUTTON_CLASS,
631
- children: "Cancel"
623
+ children: t("common.cancel")
632
624
  }), /* @__PURE__ */ jsx("button", {
633
625
  className: DIALOG_PRIMARY_BUTTON_CLASS,
634
626
  onClick: handlePaste,
635
627
  type: "button",
636
- children: "Paste"
628
+ children: t("paste")
637
629
  })]
638
630
  })
639
631
  ]
@@ -646,6 +638,8 @@ const MIN_PARTS = 1;
646
638
  const MAX_PARTS = 63;
647
639
  function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultColumns = 2 }) {
648
640
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
641
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
642
+ const t = useTranslations("folio");
649
643
  const id = useId();
650
644
  const [rows, setRows] = useState(defaultRows);
651
645
  const [columns, setColumns] = useState(defaultColumns);
@@ -679,15 +673,13 @@ function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultCol
679
673
  };
680
674
  return /* @__PURE__ */ jsx(Dialog, {
681
675
  open: isOpen,
682
- onOpenChange: (open) => {
683
- if (!open) onClose();
684
- },
676
+ onOpenChange: handleOpenChange,
685
677
  children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
686
678
  className: DIALOG_POPUP_CLASS,
687
679
  children: [
688
680
  /* @__PURE__ */ jsx(DialogTitle, {
689
681
  className: DIALOG_TITLE_CLASS,
690
- children: "Split Cell"
682
+ children: t("dialogs.splitCell.title")
691
683
  }),
692
684
  /* @__PURE__ */ jsxs("div", {
693
685
  className: DIALOG_BODY_CLASS,
@@ -698,7 +690,7 @@ function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultCol
698
690
  htmlFor: fieldIds.columns,
699
691
  children: [/* @__PURE__ */ jsx("span", {
700
692
  className: DIALOG_LABEL_CLASS,
701
- children: "Columns"
693
+ children: t("dialogs.insertTable.columnsLabel")
702
694
  }), /* @__PURE__ */ jsx("input", {
703
695
  className: DIALOG_INPUT_CLASS,
704
696
  id: fieldIds.columns,
@@ -713,13 +705,13 @@ function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultCol
713
705
  htmlFor: fieldIds.rows,
714
706
  children: [/* @__PURE__ */ jsx("span", {
715
707
  className: DIALOG_LABEL_CLASS,
716
- children: "Rows"
708
+ children: t("dialogs.insertTable.rowsLabel")
717
709
  }), /* @__PURE__ */ jsx("input", {
718
710
  className: DIALOG_INPUT_CLASS,
719
711
  id: fieldIds.rows,
720
712
  max: MAX_PARTS,
721
713
  min: MIN_PARTS,
722
- onChange: (e) => setRows(Number(e.target.value) || MIN_PARTS),
714
+ onChange: (e_0) => setRows(Number(e_0.target.value) || MIN_PARTS),
723
715
  type: "number",
724
716
  value: rows
725
717
  })]
@@ -730,11 +722,11 @@ function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultCol
730
722
  children: [/* @__PURE__ */ jsx("input", {
731
723
  checked: mergeBeforeSplit,
732
724
  id: fieldIds.mergeBeforeSplit,
733
- onChange: (e) => setMergeBeforeSplit(e.target.checked),
725
+ onChange: (e_1) => setMergeBeforeSplit(e_1.target.checked),
734
726
  type: "checkbox"
735
727
  }), /* @__PURE__ */ jsx("span", {
736
728
  className: DIALOG_LABEL_CLASS,
737
- children: "Merge selected cells before splitting"
729
+ children: t("dialogs.splitCell.mergeBeforeSplit")
738
730
  })]
739
731
  })]
740
732
  }),
@@ -742,13 +734,13 @@ function SplitCellDialog({ isOpen, onClose, onSplit, defaultRows = 1, defaultCol
742
734
  className: DIALOG_FOOTER_CLASS,
743
735
  children: [/* @__PURE__ */ jsx(DialogClose, {
744
736
  className: DIALOG_SECONDARY_BUTTON_CLASS,
745
- children: "Cancel"
737
+ children: t("common.cancel")
746
738
  }), /* @__PURE__ */ jsx("button", {
747
739
  className: DIALOG_PRIMARY_BUTTON_CLASS,
748
740
  disabled: !canSplit,
749
741
  onClick: handleSplit,
750
742
  type: "button",
751
- children: "Split"
743
+ children: t("dialogs.splitCell.splitButton")
752
744
  })]
753
745
  })
754
746
  ]
@@ -761,8 +753,12 @@ function clampInteger(value) {
761
753
  //#endregion
762
754
  //#region src/components/dialogs/WatermarkDialog.tsx
763
755
  const DEFAULT_TEXT_COLOR = "#C0C0C0";
764
- function WatermarkDialog({ isOpen, onClose, onApply, currentWatermark }) {
756
+ function WatermarkDialog(t0) {
757
+ const $ = c(127);
758
+ const { isOpen, onClose, onApply, currentWatermark } = t0;
765
759
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
760
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
761
+ const t = useTranslations("folio");
766
762
  const id = useId();
767
763
  const [mode, setMode] = useState("text");
768
764
  const [text, setText] = useState("CONFIDENTIAL");
@@ -775,289 +771,549 @@ function WatermarkDialog({ isOpen, onClose, onApply, currentWatermark }) {
775
771
  const [imageTargetExternal, setImageTargetExternal] = useState(false);
776
772
  const [scalePercent, setScalePercent] = useState(100);
777
773
  const [washout, setWashout] = useState(true);
778
- useEffect(() => {
779
- if (!isOpen) return;
780
- if (!currentWatermark) {
781
- setMode("text");
782
- setText("CONFIDENTIAL");
783
- setFont("Calibri");
784
- setColor(DEFAULT_TEXT_COLOR);
785
- setDiagonal(true);
786
- setOpacityPercent(50);
787
- setImageRId("");
788
- setImageTarget("");
789
- setImageTargetExternal(false);
790
- setScalePercent(100);
791
- setWashout(true);
792
- return;
793
- }
794
- setMode(currentWatermark.kind);
795
- if (currentWatermark.kind === "text") {
796
- setText(currentWatermark.text);
797
- setFont(currentWatermark.font ?? "Calibri");
798
- setColor(toColorInputValue(currentWatermark.color));
799
- setDiagonal(currentWatermark.diagonal ?? true);
800
- setOpacityPercent(Math.round((currentWatermark.opacity ?? .5) * 100));
801
- return;
802
- }
803
- setImageRId(currentWatermark.imageRId);
804
- setImageTarget(currentWatermark.imageTarget ?? "");
805
- setImageTargetExternal(currentWatermark.imageTargetExternal ?? false);
806
- setScalePercent(Math.round((currentWatermark.scale ?? 1) * 100));
807
- setWashout(currentWatermark.washout ?? true);
808
- }, [isOpen, currentWatermark]);
809
- const fieldIds = {
810
- mode: `${id}-watermark-mode`,
811
- text: `${id}-watermark-text`,
812
- font: `${id}-watermark-font`,
813
- color: `${id}-watermark-color`,
814
- diagonal: `${id}-watermark-diagonal`,
815
- opacity: `${id}-watermark-opacity`,
816
- imageRId: `${id}-watermark-image-rid`,
817
- imageTarget: `${id}-watermark-image-target`,
818
- imageTargetExternal: `${id}-watermark-image-external`,
819
- scale: `${id}-watermark-scale`,
820
- washout: `${id}-watermark-washout`
821
- };
822
- const canApply = mode === "none" || mode === "text" && text.trim().length > 0 || mode === "picture" && imageRId.trim().length > 0;
823
- const handleApply = () => {
824
- if (!canApply) return;
825
- if (mode === "none") {
826
- onApply(void 0);
827
- onClose();
828
- return;
829
- }
830
- if (mode === "text") {
774
+ let t1;
775
+ let t2;
776
+ if ($[0] !== currentWatermark || $[1] !== isOpen) {
777
+ t1 = () => {
778
+ if (!isOpen) return;
779
+ if (!currentWatermark) {
780
+ setMode("text");
781
+ setText("CONFIDENTIAL");
782
+ setFont("Calibri");
783
+ setColor(DEFAULT_TEXT_COLOR);
784
+ setDiagonal(true);
785
+ setOpacityPercent(50);
786
+ setImageRId("");
787
+ setImageTarget("");
788
+ setImageTargetExternal(false);
789
+ setScalePercent(100);
790
+ setWashout(true);
791
+ return;
792
+ }
793
+ setMode(currentWatermark.kind);
794
+ if (currentWatermark.kind === "text") {
795
+ setText(currentWatermark.text);
796
+ setFont(currentWatermark.font ?? "Calibri");
797
+ setColor(toColorInputValue(currentWatermark.color));
798
+ setDiagonal(currentWatermark.diagonal ?? true);
799
+ setOpacityPercent(Math.round((currentWatermark.opacity ?? .5) * 100));
800
+ return;
801
+ }
802
+ setImageRId(currentWatermark.imageRId);
803
+ setImageTarget(currentWatermark.imageTarget ?? "");
804
+ setImageTargetExternal(currentWatermark.imageTargetExternal ?? false);
805
+ setScalePercent(Math.round((currentWatermark.scale ?? 1) * 100));
806
+ setWashout(currentWatermark.washout ?? true);
807
+ };
808
+ t2 = [isOpen, currentWatermark];
809
+ $[0] = currentWatermark;
810
+ $[1] = isOpen;
811
+ $[2] = t1;
812
+ $[3] = t2;
813
+ } else {
814
+ t1 = $[2];
815
+ t2 = $[3];
816
+ }
817
+ useEffect(t1, t2);
818
+ const t3 = `${id}-watermark-mode`;
819
+ const t4 = `${id}-watermark-text`;
820
+ const t5 = `${id}-watermark-font`;
821
+ const t6 = `${id}-watermark-color`;
822
+ const t7 = `${id}-watermark-diagonal`;
823
+ const t8 = `${id}-watermark-opacity`;
824
+ const t9 = `${id}-watermark-image-rid`;
825
+ const t10 = `${id}-watermark-image-target`;
826
+ const t11 = `${id}-watermark-image-external`;
827
+ const t12 = `${id}-watermark-scale`;
828
+ const t13 = `${id}-watermark-washout`;
829
+ let t14;
830
+ if ($[4] !== t10 || $[5] !== t11 || $[6] !== t12 || $[7] !== t13 || $[8] !== t3 || $[9] !== t4 || $[10] !== t5 || $[11] !== t6 || $[12] !== t7 || $[13] !== t8 || $[14] !== t9) {
831
+ t14 = {
832
+ mode: t3,
833
+ text: t4,
834
+ font: t5,
835
+ color: t6,
836
+ diagonal: t7,
837
+ opacity: t8,
838
+ imageRId: t9,
839
+ imageTarget: t10,
840
+ imageTargetExternal: t11,
841
+ scale: t12,
842
+ washout: t13
843
+ };
844
+ $[4] = t10;
845
+ $[5] = t11;
846
+ $[6] = t12;
847
+ $[7] = t13;
848
+ $[8] = t3;
849
+ $[9] = t4;
850
+ $[10] = t5;
851
+ $[11] = t6;
852
+ $[12] = t7;
853
+ $[13] = t8;
854
+ $[14] = t9;
855
+ $[15] = t14;
856
+ } else t14 = $[15];
857
+ const fieldIds = t14;
858
+ let t15;
859
+ if ($[16] !== imageRId || $[17] !== mode || $[18] !== text) {
860
+ t15 = mode === "none" || mode === "text" && text.trim().length > 0 || mode === "picture" && imageRId.trim().length > 0;
861
+ $[16] = imageRId;
862
+ $[17] = mode;
863
+ $[18] = text;
864
+ $[19] = t15;
865
+ } else t15 = $[19];
866
+ const canApply = t15;
867
+ let t16;
868
+ if ($[20] !== canApply || $[21] !== color || $[22] !== diagonal || $[23] !== font || $[24] !== imageRId || $[25] !== imageTarget || $[26] !== imageTargetExternal || $[27] !== mode || $[28] !== onApply || $[29] !== onClose || $[30] !== opacityPercent || $[31] !== scalePercent || $[32] !== text || $[33] !== washout) {
869
+ t16 = () => {
870
+ if (!canApply) return;
871
+ if (mode === "none") {
872
+ onApply(void 0);
873
+ onClose();
874
+ return;
875
+ }
876
+ if (mode === "text") {
877
+ onApply({
878
+ kind: "text",
879
+ text: text.trim(),
880
+ ...font.trim() ? { font: font.trim() } : {},
881
+ color: stripHash(color),
882
+ diagonal,
883
+ opacity: clampPercent(opacityPercent) / 100
884
+ });
885
+ onClose();
886
+ return;
887
+ }
831
888
  onApply({
832
- kind: "text",
833
- text: text.trim(),
834
- ...font.trim() ? { font: font.trim() } : {},
835
- color: stripHash(color),
836
- diagonal,
837
- opacity: clampPercent(opacityPercent) / 100
889
+ kind: "picture",
890
+ imageRId: imageRId.trim(),
891
+ ...imageTarget.trim() ? { imageTarget: imageTarget.trim() } : {},
892
+ ...imageTarget.trim() ? { imageTargetExternal } : {},
893
+ scale: clampScalePercent(scalePercent) / 100,
894
+ washout
838
895
  });
839
896
  onClose();
840
- return;
841
- }
842
- onApply({
843
- kind: "picture",
844
- imageRId: imageRId.trim(),
845
- ...imageTarget.trim() ? { imageTarget: imageTarget.trim() } : {},
846
- ...imageTarget.trim() ? { imageTargetExternal } : {},
847
- scale: clampScalePercent(scalePercent) / 100,
848
- washout
897
+ };
898
+ $[20] = canApply;
899
+ $[21] = color;
900
+ $[22] = diagonal;
901
+ $[23] = font;
902
+ $[24] = imageRId;
903
+ $[25] = imageTarget;
904
+ $[26] = imageTargetExternal;
905
+ $[27] = mode;
906
+ $[28] = onApply;
907
+ $[29] = onClose;
908
+ $[30] = opacityPercent;
909
+ $[31] = scalePercent;
910
+ $[32] = text;
911
+ $[33] = washout;
912
+ $[34] = t16;
913
+ } else t16 = $[34];
914
+ const handleApply = t16;
915
+ let t17;
916
+ if ($[35] !== DialogBackdrop) {
917
+ t17 = /* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS });
918
+ $[35] = DialogBackdrop;
919
+ $[36] = t17;
920
+ } else t17 = $[36];
921
+ let t18;
922
+ if ($[37] !== t) {
923
+ t18 = t("dialogs.watermark.title");
924
+ $[37] = t;
925
+ $[38] = t18;
926
+ } else t18 = $[38];
927
+ let t19;
928
+ if ($[39] !== DialogTitle || $[40] !== t18) {
929
+ t19 = /* @__PURE__ */ jsx(DialogTitle, {
930
+ className: DIALOG_TITLE_CLASS,
931
+ children: t18
849
932
  });
850
- onClose();
851
- };
852
- return /* @__PURE__ */ jsx(Dialog, {
853
- open: isOpen,
854
- onOpenChange: (open) => {
855
- if (!open) onClose();
856
- },
857
- children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS }), /* @__PURE__ */ jsxs(DialogPopup, {
858
- className: DIALOG_POPUP_CLASS,
933
+ $[39] = DialogTitle;
934
+ $[40] = t18;
935
+ $[41] = t19;
936
+ } else t19 = $[41];
937
+ const t20 = fieldIds.mode;
938
+ let t21;
939
+ if ($[42] !== t) {
940
+ t21 = t("dialogs.watermark.type");
941
+ $[42] = t;
942
+ $[43] = t21;
943
+ } else t21 = $[43];
944
+ let t22;
945
+ if ($[44] !== t21) {
946
+ t22 = /* @__PURE__ */ jsx("span", {
947
+ className: DIALOG_LABEL_CLASS,
948
+ children: t21
949
+ });
950
+ $[44] = t21;
951
+ $[45] = t22;
952
+ } else t22 = $[45];
953
+ const t23 = fieldIds.mode;
954
+ let t24;
955
+ if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
956
+ t24 = (e) => setMode(toWatermarkMode(e.target.value));
957
+ $[46] = t24;
958
+ } else t24 = $[46];
959
+ let t25;
960
+ if ($[47] !== t) {
961
+ t25 = t("dialogs.watermark.textWatermark");
962
+ $[47] = t;
963
+ $[48] = t25;
964
+ } else t25 = $[48];
965
+ let t26;
966
+ if ($[49] !== t25) {
967
+ t26 = /* @__PURE__ */ jsx("option", {
968
+ value: "text",
969
+ children: t25
970
+ });
971
+ $[49] = t25;
972
+ $[50] = t26;
973
+ } else t26 = $[50];
974
+ let t27;
975
+ if ($[51] !== t) {
976
+ t27 = t("dialogs.watermark.pictureWatermark");
977
+ $[51] = t;
978
+ $[52] = t27;
979
+ } else t27 = $[52];
980
+ let t28;
981
+ if ($[53] !== t27) {
982
+ t28 = /* @__PURE__ */ jsx("option", {
983
+ value: "picture",
984
+ children: t27
985
+ });
986
+ $[53] = t27;
987
+ $[54] = t28;
988
+ } else t28 = $[54];
989
+ let t29;
990
+ if ($[55] !== t) {
991
+ t29 = t("dialogs.watermark.noWatermark");
992
+ $[55] = t;
993
+ $[56] = t29;
994
+ } else t29 = $[56];
995
+ let t30;
996
+ if ($[57] !== t29) {
997
+ t30 = /* @__PURE__ */ jsx("option", {
998
+ value: "none",
999
+ children: t29
1000
+ });
1001
+ $[57] = t29;
1002
+ $[58] = t30;
1003
+ } else t30 = $[58];
1004
+ let t31;
1005
+ if ($[59] !== fieldIds.mode || $[60] !== mode || $[61] !== t26 || $[62] !== t28 || $[63] !== t30) {
1006
+ t31 = /* @__PURE__ */ jsxs("select", {
1007
+ className: DIALOG_INPUT_CLASS,
1008
+ id: t23,
1009
+ onChange: t24,
1010
+ value: mode,
859
1011
  children: [
860
- /* @__PURE__ */ jsx(DialogTitle, {
861
- className: DIALOG_TITLE_CLASS,
862
- children: "Watermark"
1012
+ t26,
1013
+ t28,
1014
+ t30
1015
+ ]
1016
+ });
1017
+ $[59] = fieldIds.mode;
1018
+ $[60] = mode;
1019
+ $[61] = t26;
1020
+ $[62] = t28;
1021
+ $[63] = t30;
1022
+ $[64] = t31;
1023
+ } else t31 = $[64];
1024
+ let t32;
1025
+ if ($[65] !== fieldIds.mode || $[66] !== t22 || $[67] !== t31) {
1026
+ t32 = /* @__PURE__ */ jsxs("label", {
1027
+ className: "flex flex-col gap-1",
1028
+ htmlFor: t20,
1029
+ children: [t22, t31]
1030
+ });
1031
+ $[65] = fieldIds.mode;
1032
+ $[66] = t22;
1033
+ $[67] = t31;
1034
+ $[68] = t32;
1035
+ } else t32 = $[68];
1036
+ let t33;
1037
+ if ($[69] !== color || $[70] !== diagonal || $[71] !== fieldIds.color || $[72] !== fieldIds.diagonal || $[73] !== fieldIds.font || $[74] !== fieldIds.opacity || $[75] !== fieldIds.text || $[76] !== font || $[77] !== mode || $[78] !== opacityPercent || $[79] !== t || $[80] !== text) {
1038
+ t33 = mode === "text" && /* @__PURE__ */ jsxs("div", {
1039
+ className: "grid grid-cols-2 gap-3",
1040
+ children: [
1041
+ /* @__PURE__ */ jsxs("label", {
1042
+ className: "col-span-2 flex flex-col gap-1",
1043
+ htmlFor: fieldIds.text,
1044
+ children: [/* @__PURE__ */ jsx("span", {
1045
+ className: "text-muted-foreground text-[13px]",
1046
+ children: t("dialogs.watermark.text")
1047
+ }), /* @__PURE__ */ jsx("input", {
1048
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1049
+ id: fieldIds.text,
1050
+ onChange: (e_0) => setText(e_0.target.value),
1051
+ value: text
1052
+ })]
863
1053
  }),
864
- /* @__PURE__ */ jsxs("div", {
865
- className: DIALOG_BODY_CLASS,
866
- children: [
867
- /* @__PURE__ */ jsxs("label", {
868
- className: "flex flex-col gap-1",
869
- htmlFor: fieldIds.mode,
870
- children: [/* @__PURE__ */ jsx("span", {
871
- className: DIALOG_LABEL_CLASS,
872
- children: "Type"
873
- }), /* @__PURE__ */ jsxs("select", {
874
- className: DIALOG_INPUT_CLASS,
875
- id: fieldIds.mode,
876
- onChange: (e) => setMode(toWatermarkMode(e.target.value)),
877
- value: mode,
878
- children: [
879
- /* @__PURE__ */ jsx("option", {
880
- value: "text",
881
- children: "Text watermark"
882
- }),
883
- /* @__PURE__ */ jsx("option", {
884
- value: "picture",
885
- children: "Picture watermark"
886
- }),
887
- /* @__PURE__ */ jsx("option", {
888
- value: "none",
889
- children: "No watermark"
890
- })
891
- ]
892
- })]
893
- }),
894
- mode === "text" && /* @__PURE__ */ jsxs("div", {
895
- className: "grid grid-cols-2 gap-3",
896
- children: [
897
- /* @__PURE__ */ jsxs("label", {
898
- className: "col-span-2 flex flex-col gap-1",
899
- htmlFor: fieldIds.text,
900
- children: [/* @__PURE__ */ jsx("span", {
901
- className: "text-muted-foreground text-[13px]",
902
- children: "Text"
903
- }), /* @__PURE__ */ jsx("input", {
904
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
905
- id: fieldIds.text,
906
- onChange: (e) => setText(e.target.value),
907
- value: text
908
- })]
909
- }),
910
- /* @__PURE__ */ jsxs("label", {
911
- className: "flex flex-col gap-1",
912
- htmlFor: fieldIds.font,
913
- children: [/* @__PURE__ */ jsx("span", {
914
- className: "text-muted-foreground text-[13px]",
915
- children: "Font"
916
- }), /* @__PURE__ */ jsx("input", {
917
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
918
- id: fieldIds.font,
919
- onChange: (e) => setFont(e.target.value),
920
- value: font
921
- })]
922
- }),
923
- /* @__PURE__ */ jsxs("label", {
924
- className: "flex flex-col gap-1",
925
- htmlFor: fieldIds.color,
926
- children: [/* @__PURE__ */ jsx("span", {
927
- className: "text-muted-foreground text-[13px]",
928
- children: "Color"
929
- }), /* @__PURE__ */ jsx("input", {
930
- className: `border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none h-[34px]`,
931
- id: fieldIds.color,
932
- onChange: (e) => setColor(e.target.value),
933
- type: "color",
934
- value: color
935
- })]
936
- }),
937
- /* @__PURE__ */ jsxs("label", {
938
- className: "flex flex-col gap-1",
939
- htmlFor: fieldIds.opacity,
940
- children: [/* @__PURE__ */ jsx("span", {
941
- className: "text-muted-foreground text-[13px]",
942
- children: "Opacity"
943
- }), /* @__PURE__ */ jsx("input", {
944
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
945
- id: fieldIds.opacity,
946
- max: 100,
947
- min: 0,
948
- onChange: (e) => setOpacityPercent(Number(e.target.value) || 0),
949
- type: "number",
950
- value: opacityPercent
951
- })]
952
- }),
953
- /* @__PURE__ */ jsxs("label", {
954
- className: "flex items-center gap-2 pt-6",
955
- htmlFor: fieldIds.diagonal,
956
- children: [/* @__PURE__ */ jsx("input", {
957
- checked: diagonal,
958
- id: fieldIds.diagonal,
959
- onChange: (e) => setDiagonal(e.target.checked),
960
- type: "checkbox"
961
- }), /* @__PURE__ */ jsx("span", {
962
- className: "text-muted-foreground text-[13px]",
963
- children: "Diagonal"
964
- })]
965
- })
966
- ]
967
- }),
968
- mode === "picture" && /* @__PURE__ */ jsxs("div", {
969
- className: "grid grid-cols-2 gap-3",
970
- children: [
971
- /* @__PURE__ */ jsxs("label", {
972
- className: "col-span-2 flex flex-col gap-1",
973
- htmlFor: fieldIds.imageRId,
974
- children: [/* @__PURE__ */ jsx("span", {
975
- className: "text-muted-foreground text-[13px]",
976
- children: "Header image relationship id"
977
- }), /* @__PURE__ */ jsx("input", {
978
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
979
- id: fieldIds.imageRId,
980
- onChange: (e) => setImageRId(e.target.value),
981
- placeholder: "rId12",
982
- value: imageRId
983
- })]
984
- }),
985
- /* @__PURE__ */ jsxs("label", {
986
- className: "col-span-2 flex flex-col gap-1",
987
- htmlFor: fieldIds.imageTarget,
988
- children: [/* @__PURE__ */ jsx("span", {
989
- className: "text-muted-foreground text-[13px]",
990
- children: "Image target"
991
- }), /* @__PURE__ */ jsx("input", {
992
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
993
- id: fieldIds.imageTarget,
994
- onChange: (e) => setImageTarget(e.target.value),
995
- placeholder: "word/media/image1.png",
996
- value: imageTarget
997
- })]
998
- }),
999
- /* @__PURE__ */ jsxs("label", {
1000
- className: "flex flex-col gap-1",
1001
- htmlFor: fieldIds.scale,
1002
- children: [/* @__PURE__ */ jsx("span", {
1003
- className: "text-muted-foreground text-[13px]",
1004
- children: "Scale"
1005
- }), /* @__PURE__ */ jsx("input", {
1006
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1007
- id: fieldIds.scale,
1008
- max: 300,
1009
- min: 1,
1010
- onChange: (e) => setScalePercent(Number(e.target.value) || 1),
1011
- type: "number",
1012
- value: scalePercent
1013
- })]
1014
- }),
1015
- /* @__PURE__ */ jsxs("label", {
1016
- className: "flex items-center gap-2 pt-6",
1017
- htmlFor: fieldIds.washout,
1018
- children: [/* @__PURE__ */ jsx("input", {
1019
- checked: washout,
1020
- id: fieldIds.washout,
1021
- onChange: (e) => setWashout(e.target.checked),
1022
- type: "checkbox"
1023
- }), /* @__PURE__ */ jsx("span", {
1024
- className: "text-muted-foreground text-[13px]",
1025
- children: "Washout"
1026
- })]
1027
- }),
1028
- /* @__PURE__ */ jsxs("label", {
1029
- className: "col-span-2 flex items-center gap-2",
1030
- htmlFor: fieldIds.imageTargetExternal,
1031
- children: [/* @__PURE__ */ jsx("input", {
1032
- checked: imageTargetExternal,
1033
- id: fieldIds.imageTargetExternal,
1034
- onChange: (e) => setImageTargetExternal(e.target.checked),
1035
- type: "checkbox"
1036
- }), /* @__PURE__ */ jsx("span", {
1037
- className: "text-muted-foreground text-[13px]",
1038
- children: "Target is an external URL"
1039
- })]
1040
- })
1041
- ]
1042
- })
1043
- ]
1054
+ /* @__PURE__ */ jsxs("label", {
1055
+ className: "flex flex-col gap-1",
1056
+ htmlFor: fieldIds.font,
1057
+ children: [/* @__PURE__ */ jsx("span", {
1058
+ className: "text-muted-foreground text-[13px]",
1059
+ children: t("dialogs.watermark.font")
1060
+ }), /* @__PURE__ */ jsx("input", {
1061
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1062
+ id: fieldIds.font,
1063
+ onChange: (e_1) => setFont(e_1.target.value),
1064
+ value: font
1065
+ })]
1044
1066
  }),
1045
- /* @__PURE__ */ jsxs("div", {
1046
- className: DIALOG_FOOTER_CLASS,
1047
- children: [/* @__PURE__ */ jsx(DialogClose, {
1048
- className: DIALOG_SECONDARY_BUTTON_CLASS,
1049
- children: "Cancel"
1050
- }), /* @__PURE__ */ jsx("button", {
1051
- className: DIALOG_PRIMARY_BUTTON_CLASS,
1052
- disabled: !canApply,
1053
- onClick: handleApply,
1054
- type: "button",
1055
- children: "Apply"
1067
+ /* @__PURE__ */ jsxs("label", {
1068
+ className: "flex flex-col gap-1",
1069
+ htmlFor: fieldIds.color,
1070
+ children: [/* @__PURE__ */ jsx("span", {
1071
+ className: "text-muted-foreground text-[13px]",
1072
+ children: t("dialogs.watermark.color")
1073
+ }), /* @__PURE__ */ jsx("input", {
1074
+ className: `border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none h-[34px]`,
1075
+ id: fieldIds.color,
1076
+ onChange: (e_2) => setColor(e_2.target.value),
1077
+ type: "color",
1078
+ value: color
1079
+ })]
1080
+ }),
1081
+ /* @__PURE__ */ jsxs("label", {
1082
+ className: "flex flex-col gap-1",
1083
+ htmlFor: fieldIds.opacity,
1084
+ children: [/* @__PURE__ */ jsx("span", {
1085
+ className: "text-muted-foreground text-[13px]",
1086
+ children: t("dialogs.watermark.opacity")
1087
+ }), /* @__PURE__ */ jsx("input", {
1088
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1089
+ id: fieldIds.opacity,
1090
+ max: 100,
1091
+ min: 0,
1092
+ onChange: (e_3) => setOpacityPercent(Number(e_3.target.value) || 0),
1093
+ type: "number",
1094
+ value: opacityPercent
1095
+ })]
1096
+ }),
1097
+ /* @__PURE__ */ jsxs("label", {
1098
+ className: "flex items-center gap-2 pt-6",
1099
+ htmlFor: fieldIds.diagonal,
1100
+ children: [/* @__PURE__ */ jsx("input", {
1101
+ checked: diagonal,
1102
+ id: fieldIds.diagonal,
1103
+ onChange: (e_4) => setDiagonal(e_4.target.checked),
1104
+ type: "checkbox"
1105
+ }), /* @__PURE__ */ jsx("span", {
1106
+ className: "text-muted-foreground text-[13px]",
1107
+ children: t("dialogs.watermark.diagonal")
1056
1108
  })]
1057
1109
  })
1058
1110
  ]
1059
- })] })
1060
- });
1111
+ });
1112
+ $[69] = color;
1113
+ $[70] = diagonal;
1114
+ $[71] = fieldIds.color;
1115
+ $[72] = fieldIds.diagonal;
1116
+ $[73] = fieldIds.font;
1117
+ $[74] = fieldIds.opacity;
1118
+ $[75] = fieldIds.text;
1119
+ $[76] = font;
1120
+ $[77] = mode;
1121
+ $[78] = opacityPercent;
1122
+ $[79] = t;
1123
+ $[80] = text;
1124
+ $[81] = t33;
1125
+ } else t33 = $[81];
1126
+ let t34;
1127
+ if ($[82] !== fieldIds.imageRId || $[83] !== fieldIds.imageTarget || $[84] !== fieldIds.imageTargetExternal || $[85] !== fieldIds.scale || $[86] !== fieldIds.washout || $[87] !== imageRId || $[88] !== imageTarget || $[89] !== imageTargetExternal || $[90] !== mode || $[91] !== scalePercent || $[92] !== t || $[93] !== washout) {
1128
+ t34 = mode === "picture" && /* @__PURE__ */ jsxs("div", {
1129
+ className: "grid grid-cols-2 gap-3",
1130
+ children: [
1131
+ /* @__PURE__ */ jsxs("label", {
1132
+ className: "col-span-2 flex flex-col gap-1",
1133
+ htmlFor: fieldIds.imageRId,
1134
+ children: [/* @__PURE__ */ jsx("span", {
1135
+ className: "text-muted-foreground text-[13px]",
1136
+ children: t("dialogs.watermark.imageRelationshipId")
1137
+ }), /* @__PURE__ */ jsx("input", {
1138
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1139
+ id: fieldIds.imageRId,
1140
+ onChange: (e_5) => setImageRId(e_5.target.value),
1141
+ placeholder: "rId12",
1142
+ value: imageRId
1143
+ })]
1144
+ }),
1145
+ /* @__PURE__ */ jsxs("label", {
1146
+ className: "col-span-2 flex flex-col gap-1",
1147
+ htmlFor: fieldIds.imageTarget,
1148
+ children: [/* @__PURE__ */ jsx("span", {
1149
+ className: "text-muted-foreground text-[13px]",
1150
+ children: t("dialogs.watermark.imageTarget")
1151
+ }), /* @__PURE__ */ jsx("input", {
1152
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1153
+ id: fieldIds.imageTarget,
1154
+ onChange: (e_6) => setImageTarget(e_6.target.value),
1155
+ placeholder: "word/media/image1.png",
1156
+ value: imageTarget
1157
+ })]
1158
+ }),
1159
+ /* @__PURE__ */ jsxs("label", {
1160
+ className: "flex flex-col gap-1",
1161
+ htmlFor: fieldIds.scale,
1162
+ children: [/* @__PURE__ */ jsx("span", {
1163
+ className: "text-muted-foreground text-[13px]",
1164
+ children: t("dialogs.watermark.scale")
1165
+ }), /* @__PURE__ */ jsx("input", {
1166
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1167
+ id: fieldIds.scale,
1168
+ max: 300,
1169
+ min: 1,
1170
+ onChange: (e_7) => setScalePercent(Number(e_7.target.value) || 1),
1171
+ type: "number",
1172
+ value: scalePercent
1173
+ })]
1174
+ }),
1175
+ /* @__PURE__ */ jsxs("label", {
1176
+ className: "flex items-center gap-2 pt-6",
1177
+ htmlFor: fieldIds.washout,
1178
+ children: [/* @__PURE__ */ jsx("input", {
1179
+ checked: washout,
1180
+ id: fieldIds.washout,
1181
+ onChange: (e_8) => setWashout(e_8.target.checked),
1182
+ type: "checkbox"
1183
+ }), /* @__PURE__ */ jsx("span", {
1184
+ className: "text-muted-foreground text-[13px]",
1185
+ children: t("dialogs.watermark.washout")
1186
+ })]
1187
+ }),
1188
+ /* @__PURE__ */ jsxs("label", {
1189
+ className: "col-span-2 flex items-center gap-2",
1190
+ htmlFor: fieldIds.imageTargetExternal,
1191
+ children: [/* @__PURE__ */ jsx("input", {
1192
+ checked: imageTargetExternal,
1193
+ id: fieldIds.imageTargetExternal,
1194
+ onChange: (e_9) => setImageTargetExternal(e_9.target.checked),
1195
+ type: "checkbox"
1196
+ }), /* @__PURE__ */ jsx("span", {
1197
+ className: "text-muted-foreground text-[13px]",
1198
+ children: t("dialogs.watermark.targetIsExternalUrl")
1199
+ })]
1200
+ })
1201
+ ]
1202
+ });
1203
+ $[82] = fieldIds.imageRId;
1204
+ $[83] = fieldIds.imageTarget;
1205
+ $[84] = fieldIds.imageTargetExternal;
1206
+ $[85] = fieldIds.scale;
1207
+ $[86] = fieldIds.washout;
1208
+ $[87] = imageRId;
1209
+ $[88] = imageTarget;
1210
+ $[89] = imageTargetExternal;
1211
+ $[90] = mode;
1212
+ $[91] = scalePercent;
1213
+ $[92] = t;
1214
+ $[93] = washout;
1215
+ $[94] = t34;
1216
+ } else t34 = $[94];
1217
+ let t35;
1218
+ if ($[95] !== t32 || $[96] !== t33 || $[97] !== t34) {
1219
+ t35 = /* @__PURE__ */ jsxs("div", {
1220
+ className: DIALOG_BODY_CLASS,
1221
+ children: [
1222
+ t32,
1223
+ t33,
1224
+ t34
1225
+ ]
1226
+ });
1227
+ $[95] = t32;
1228
+ $[96] = t33;
1229
+ $[97] = t34;
1230
+ $[98] = t35;
1231
+ } else t35 = $[98];
1232
+ let t36;
1233
+ if ($[99] !== t) {
1234
+ t36 = t("common.cancel");
1235
+ $[99] = t;
1236
+ $[100] = t36;
1237
+ } else t36 = $[100];
1238
+ let t37;
1239
+ if ($[101] !== DialogClose || $[102] !== t36) {
1240
+ t37 = /* @__PURE__ */ jsx(DialogClose, {
1241
+ className: DIALOG_SECONDARY_BUTTON_CLASS,
1242
+ children: t36
1243
+ });
1244
+ $[101] = DialogClose;
1245
+ $[102] = t36;
1246
+ $[103] = t37;
1247
+ } else t37 = $[103];
1248
+ const t38 = !canApply;
1249
+ let t39;
1250
+ if ($[104] !== t) {
1251
+ t39 = t("common.apply");
1252
+ $[104] = t;
1253
+ $[105] = t39;
1254
+ } else t39 = $[105];
1255
+ let t40;
1256
+ if ($[106] !== handleApply || $[107] !== t38 || $[108] !== t39) {
1257
+ t40 = /* @__PURE__ */ jsx("button", {
1258
+ className: DIALOG_PRIMARY_BUTTON_CLASS,
1259
+ disabled: t38,
1260
+ onClick: handleApply,
1261
+ type: "button",
1262
+ children: t39
1263
+ });
1264
+ $[106] = handleApply;
1265
+ $[107] = t38;
1266
+ $[108] = t39;
1267
+ $[109] = t40;
1268
+ } else t40 = $[109];
1269
+ let t41;
1270
+ if ($[110] !== t37 || $[111] !== t40) {
1271
+ t41 = /* @__PURE__ */ jsxs("div", {
1272
+ className: DIALOG_FOOTER_CLASS,
1273
+ children: [t37, t40]
1274
+ });
1275
+ $[110] = t37;
1276
+ $[111] = t40;
1277
+ $[112] = t41;
1278
+ } else t41 = $[112];
1279
+ let t42;
1280
+ if ($[113] !== DialogPopup || $[114] !== t19 || $[115] !== t35 || $[116] !== t41) {
1281
+ t42 = /* @__PURE__ */ jsxs(DialogPopup, {
1282
+ className: DIALOG_POPUP_CLASS,
1283
+ children: [
1284
+ t19,
1285
+ t35,
1286
+ t41
1287
+ ]
1288
+ });
1289
+ $[113] = DialogPopup;
1290
+ $[114] = t19;
1291
+ $[115] = t35;
1292
+ $[116] = t41;
1293
+ $[117] = t42;
1294
+ } else t42 = $[117];
1295
+ let t43;
1296
+ if ($[118] !== DialogPortal || $[119] !== t17 || $[120] !== t42) {
1297
+ t43 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t17, t42] });
1298
+ $[118] = DialogPortal;
1299
+ $[119] = t17;
1300
+ $[120] = t42;
1301
+ $[121] = t43;
1302
+ } else t43 = $[121];
1303
+ let t44;
1304
+ if ($[122] !== Dialog || $[123] !== handleOpenChange || $[124] !== isOpen || $[125] !== t43) {
1305
+ t44 = /* @__PURE__ */ jsx(Dialog, {
1306
+ open: isOpen,
1307
+ onOpenChange: handleOpenChange,
1308
+ children: t43
1309
+ });
1310
+ $[122] = Dialog;
1311
+ $[123] = handleOpenChange;
1312
+ $[124] = isOpen;
1313
+ $[125] = t43;
1314
+ $[126] = t44;
1315
+ } else t44 = $[126];
1316
+ return t44;
1061
1317
  }
1062
1318
  function toWatermarkMode(value) {
1063
1319
  if (value === "none" || value === "picture" || value === "text") return value;