@stll/folio-react 0.20.2 → 0.21.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.
@@ -1,9 +1,10 @@
1
- import { d as containedHandler } from "./renderAsync-dUCMzc_W.js";
1
+ import { d as containedHandler } from "./renderAsync-D5P4hvJg.js";
2
2
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { CheckIcon, MoreVerticalIcon } from "lucide-react";
4
4
  import { useLocale, useTranslations } from "use-intl";
5
5
  import { closestHtmlElement, queryHtmlElement } from "@stll/folio-core/utils/domGuards";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { commentAnchorSelector } from "@stll/folio-core/render-dom/commentAnchorAttributes";
7
8
  //#region src/components/CommentsSidebar.tsx
8
9
  /**
9
10
  * Comments Sidebar
@@ -174,7 +175,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
174
175
  };
175
176
  for (const comment of visibleComments) {
176
177
  const cardId = `comment-${comment.id}`;
177
- const el = pagesEl.querySelector(`[data-comment-id="${CSS.escape(String(comment.id))}"]`);
178
+ const el = pagesEl.querySelector(commentAnchorSelector(comment.id));
178
179
  if (el) {
179
180
  pushPosition(cardId, el.getBoundingClientRect().top - containerRect.top + scrollTop, cardRefs.current.get(cardId)?.offsetHeight || DEFAULT_CARD_HEIGHT);
180
181
  continue;
@@ -5,6 +5,7 @@ import { c } from "react-compiler-runtime";
5
5
  import { useEffect, useId, useState } from "react";
6
6
  import { useTranslations } from "use-intl";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { TABLE_PROPERTY_JUSTIFICATIONS, toTablePropertyJustification } from "@stll/folio-core/utils/tableOperations";
8
9
  //#region src/components/dialogs/TablePropertiesDialog.tsx
9
10
  /**
10
11
  * Table Properties Dialog — width type, width value, alignment.
@@ -17,15 +18,15 @@ const editableWidthType = (value) => {
17
18
  default: return "auto";
18
19
  }
19
20
  };
20
- const editableJustification = (value) => {
21
- switch (value) {
22
- case "center":
23
- case "right": return value;
24
- default: return "left";
25
- }
21
+ const TABLE_JUSTIFICATION_LABEL_KEYS = {
22
+ center: "dialogs.tableProperties.alignOptions.center",
23
+ end: "dialogs.tableProperties.alignOptions.end",
24
+ left: "dialogs.tableProperties.alignOptions.left",
25
+ right: "dialogs.tableProperties.alignOptions.right",
26
+ start: "dialogs.tableProperties.alignOptions.start"
26
27
  };
27
28
  function TablePropertiesDialog(t0) {
28
- const $ = c(119);
29
+ const $ = c(107);
29
30
  const { isOpen, onClose, onApply, currentProps } = t0;
30
31
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
31
32
  const handleOpenChange = useCloseOnDialogOpenChange(onClose);
@@ -40,10 +41,10 @@ function TablePropertiesDialog(t0) {
40
41
  $[1] = t2;
41
42
  } else t2 = $[1];
42
43
  const [widthType, setWidthType] = useState(t2);
43
- const t3 = currentProps?.justification ?? "left";
44
+ const t3 = currentProps?.justification;
44
45
  let t4;
45
46
  if ($[2] !== t3) {
46
- t4 = editableJustification(t3);
47
+ t4 = toTablePropertyJustification(t3);
47
48
  $[2] = t3;
48
49
  $[3] = t4;
49
50
  } else t4 = $[3];
@@ -54,7 +55,7 @@ function TablePropertiesDialog(t0) {
54
55
  if (isOpen) {
55
56
  setWidth(currentProps?.width ?? 0);
56
57
  setWidthType(editableWidthType(currentProps?.widthType ?? "auto"));
57
- setJustification(editableJustification(currentProps?.justification ?? "left"));
58
+ setJustification(toTablePropertyJustification(currentProps?.justification));
58
59
  }
59
60
  };
60
61
  $[4] = currentProps?.justification;
@@ -74,7 +75,7 @@ function TablePropertiesDialog(t0) {
74
75
  let t7;
75
76
  if ($[12] !== justification || $[13] !== onApply || $[14] !== onClose || $[15] !== width || $[16] !== widthType) {
76
77
  t7 = () => {
77
- const props = { justification: justification === "left" || justification === "center" || justification === "right" ? justification : "left" };
78
+ const props = { justification };
78
79
  if (widthType === "auto") {
79
80
  props.width = null;
80
81
  props.widthType = "auto";
@@ -282,181 +283,139 @@ function TablePropertiesDialog(t0) {
282
283
  const t32 = fieldIds.align;
283
284
  let t33;
284
285
  if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
285
- t33 = (e_1) => setJustification(editableJustification(e_1.target.value));
286
+ t33 = (e_1) => setJustification(toTablePropertyJustification(e_1.target.value));
286
287
  $[66] = t33;
287
288
  } else t33 = $[66];
288
289
  let t34;
289
290
  if ($[67] !== t) {
290
- t34 = t("dialogs.tableProperties.alignOptions.left");
291
+ t34 = TABLE_PROPERTY_JUSTIFICATIONS.map((value) => /* @__PURE__ */ jsx("option", {
292
+ value,
293
+ children: t(TABLE_JUSTIFICATION_LABEL_KEYS[value])
294
+ }, value));
291
295
  $[67] = t;
292
296
  $[68] = t34;
293
297
  } else t34 = $[68];
294
298
  let t35;
295
- if ($[69] !== t34) {
296
- t35 = /* @__PURE__ */ jsx("option", {
297
- value: "left",
298
- children: t34
299
- });
300
- $[69] = t34;
301
- $[70] = t35;
302
- } else t35 = $[70];
303
- let t36;
304
- if ($[71] !== t) {
305
- t36 = t("dialogs.tableProperties.alignOptions.center");
306
- $[71] = t;
307
- $[72] = t36;
308
- } else t36 = $[72];
309
- let t37;
310
- if ($[73] !== t36) {
311
- t37 = /* @__PURE__ */ jsx("option", {
312
- value: "center",
313
- children: t36
314
- });
315
- $[73] = t36;
316
- $[74] = t37;
317
- } else t37 = $[74];
318
- let t38;
319
- if ($[75] !== t) {
320
- t38 = t("dialogs.tableProperties.alignOptions.right");
321
- $[75] = t;
322
- $[76] = t38;
323
- } else t38 = $[76];
324
- let t39;
325
- if ($[77] !== t38) {
326
- t39 = /* @__PURE__ */ jsx("option", {
327
- value: "right",
328
- children: t38
329
- });
330
- $[77] = t38;
331
- $[78] = t39;
332
- } else t39 = $[78];
333
- let t40;
334
- if ($[79] !== fieldIds.align || $[80] !== justification || $[81] !== t35 || $[82] !== t37 || $[83] !== t39) {
335
- t40 = /* @__PURE__ */ jsxs("select", {
299
+ if ($[69] !== fieldIds.align || $[70] !== justification || $[71] !== t34) {
300
+ t35 = /* @__PURE__ */ jsx("select", {
336
301
  className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
337
302
  id: t32,
338
303
  onChange: t33,
339
304
  value: justification,
340
- children: [
341
- t35,
342
- t37,
343
- t39
344
- ]
305
+ children: t34
345
306
  });
346
- $[79] = fieldIds.align;
347
- $[80] = justification;
348
- $[81] = t35;
349
- $[82] = t37;
350
- $[83] = t39;
351
- $[84] = t40;
352
- } else t40 = $[84];
353
- let t41;
354
- if ($[85] !== t31 || $[86] !== t40) {
355
- t41 = /* @__PURE__ */ jsxs("div", {
307
+ $[69] = fieldIds.align;
308
+ $[70] = justification;
309
+ $[71] = t34;
310
+ $[72] = t35;
311
+ } else t35 = $[72];
312
+ let t36;
313
+ if ($[73] !== t31 || $[74] !== t35) {
314
+ t36 = /* @__PURE__ */ jsxs("div", {
356
315
  className: "flex items-center gap-3",
357
- children: [t31, t40]
316
+ children: [t31, t35]
358
317
  });
359
- $[85] = t31;
360
- $[86] = t40;
361
- $[87] = t41;
362
- } else t41 = $[87];
363
- let t42;
364
- if ($[88] !== t27 || $[89] !== t28 || $[90] !== t41) {
365
- t42 = /* @__PURE__ */ jsxs("div", {
318
+ $[73] = t31;
319
+ $[74] = t35;
320
+ $[75] = t36;
321
+ } else t36 = $[75];
322
+ let t37;
323
+ if ($[76] !== t27 || $[77] !== t28 || $[78] !== t36) {
324
+ t37 = /* @__PURE__ */ jsxs("div", {
366
325
  className: "flex flex-col gap-3 px-5 py-4",
367
326
  children: [
368
327
  t27,
369
328
  t28,
370
- t41
329
+ t36
371
330
  ]
372
331
  });
373
- $[88] = t27;
374
- $[89] = t28;
375
- $[90] = t41;
376
- $[91] = t42;
377
- } else t42 = $[91];
378
- let t43;
379
- if ($[92] !== t) {
380
- t43 = t("common.cancel");
381
- $[92] = t;
382
- $[93] = t43;
383
- } else t43 = $[93];
384
- let t44;
385
- if ($[94] !== DialogClose || $[95] !== t43) {
386
- t44 = /* @__PURE__ */ jsx(DialogClose, {
332
+ $[76] = t27;
333
+ $[77] = t28;
334
+ $[78] = t36;
335
+ $[79] = t37;
336
+ } else t37 = $[79];
337
+ let t38;
338
+ if ($[80] !== t) {
339
+ t38 = t("common.cancel");
340
+ $[80] = t;
341
+ $[81] = t38;
342
+ } else t38 = $[81];
343
+ let t39;
344
+ if ($[82] !== DialogClose || $[83] !== t38) {
345
+ t39 = /* @__PURE__ */ jsx(DialogClose, {
387
346
  className: "border-input rounded border px-4 py-1.5 text-[13px]",
388
- children: t43
347
+ children: t38
389
348
  });
390
- $[94] = DialogClose;
391
- $[95] = t43;
392
- $[96] = t44;
393
- } else t44 = $[96];
394
- let t45;
395
- if ($[97] !== t) {
396
- t45 = t("common.apply");
397
- $[97] = t;
398
- $[98] = t45;
399
- } else t45 = $[98];
400
- let t46;
401
- if ($[99] !== handleApply || $[100] !== t45) {
402
- t46 = /* @__PURE__ */ jsx("button", {
349
+ $[82] = DialogClose;
350
+ $[83] = t38;
351
+ $[84] = t39;
352
+ } else t39 = $[84];
353
+ let t40;
354
+ if ($[85] !== t) {
355
+ t40 = t("common.apply");
356
+ $[85] = t;
357
+ $[86] = t40;
358
+ } else t40 = $[86];
359
+ let t41;
360
+ if ($[87] !== handleApply || $[88] !== t40) {
361
+ t41 = /* @__PURE__ */ jsx("button", {
403
362
  className: "bg-primary text-primary-foreground rounded px-4 py-1.5 text-[13px] font-medium",
404
363
  onClick: handleApply,
405
364
  type: "button",
406
- children: t45
365
+ children: t40
407
366
  });
408
- $[99] = handleApply;
409
- $[100] = t45;
410
- $[101] = t46;
411
- } else t46 = $[101];
412
- let t47;
413
- if ($[102] !== t44 || $[103] !== t46) {
414
- t47 = /* @__PURE__ */ jsxs("div", {
367
+ $[87] = handleApply;
368
+ $[88] = t40;
369
+ $[89] = t41;
370
+ } else t41 = $[89];
371
+ let t42;
372
+ if ($[90] !== t39 || $[91] !== t41) {
373
+ t42 = /* @__PURE__ */ jsxs("div", {
415
374
  className: "flex justify-end gap-2 border-t px-5 py-3",
416
- children: [t44, t46]
375
+ children: [t39, t41]
417
376
  });
418
- $[102] = t44;
419
- $[103] = t46;
420
- $[104] = t47;
421
- } else t47 = $[104];
422
- let t48;
423
- if ($[105] !== DialogPopup || $[106] !== t14 || $[107] !== t42 || $[108] !== t47) {
424
- t48 = /* @__PURE__ */ jsxs(DialogPopup, {
377
+ $[90] = t39;
378
+ $[91] = t41;
379
+ $[92] = t42;
380
+ } else t42 = $[92];
381
+ let t43;
382
+ if ($[93] !== DialogPopup || $[94] !== t14 || $[95] !== t37 || $[96] !== t42) {
383
+ t43 = /* @__PURE__ */ jsxs(DialogPopup, {
425
384
  className: "bg-popover fixed start-1/2 top-1/2 z-[10001] w-full max-w-[440px] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border shadow-xl",
426
385
  children: [
427
386
  t14,
428
- t42,
429
- t47
387
+ t37,
388
+ t42
430
389
  ]
431
390
  });
432
- $[105] = DialogPopup;
433
- $[106] = t14;
434
- $[107] = t42;
435
- $[108] = t47;
436
- $[109] = t48;
437
- } else t48 = $[109];
438
- let t49;
439
- if ($[110] !== DialogPortal || $[111] !== t12 || $[112] !== t48) {
440
- t49 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t12, t48] });
441
- $[110] = DialogPortal;
442
- $[111] = t12;
443
- $[112] = t48;
444
- $[113] = t49;
445
- } else t49 = $[113];
446
- let t50;
447
- if ($[114] !== Dialog || $[115] !== handleOpenChange || $[116] !== isOpen || $[117] !== t49) {
448
- t50 = /* @__PURE__ */ jsx(Dialog, {
391
+ $[93] = DialogPopup;
392
+ $[94] = t14;
393
+ $[95] = t37;
394
+ $[96] = t42;
395
+ $[97] = t43;
396
+ } else t43 = $[97];
397
+ let t44;
398
+ if ($[98] !== DialogPortal || $[99] !== t12 || $[100] !== t43) {
399
+ t44 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t12, t43] });
400
+ $[98] = DialogPortal;
401
+ $[99] = t12;
402
+ $[100] = t43;
403
+ $[101] = t44;
404
+ } else t44 = $[101];
405
+ let t45;
406
+ if ($[102] !== Dialog || $[103] !== handleOpenChange || $[104] !== isOpen || $[105] !== t44) {
407
+ t45 = /* @__PURE__ */ jsx(Dialog, {
449
408
  open: isOpen,
450
409
  onOpenChange: handleOpenChange,
451
- children: t49
410
+ children: t44
452
411
  });
453
- $[114] = Dialog;
454
- $[115] = handleOpenChange;
455
- $[116] = isOpen;
456
- $[117] = t49;
457
- $[118] = t50;
458
- } else t50 = $[118];
459
- return t50;
412
+ $[102] = Dialog;
413
+ $[103] = handleOpenChange;
414
+ $[104] = isOpen;
415
+ $[105] = t44;
416
+ $[106] = t45;
417
+ } else t45 = $[106];
418
+ return t45;
460
419
  }
461
420
  //#endregion
462
421
  export { TablePropertiesDialog_exports as n, TablePropertiesDialog as t };
@@ -1,4 +1,4 @@
1
- import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-yY4eNo9i.js";
1
+ import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-CpeG0afF.js";
2
2
  import { ReactNode } from "react";
3
3
  import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
4
4
  //#region src/compat/eigenpal.d.ts
@@ -1,4 +1,4 @@
1
- import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-dUCMzc_W.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-D5P4hvJg.js";
2
2
  import { t as messages_exports } from "../messages.js";
3
3
  import { c } from "react-compiler-runtime";
4
4
  import { forwardRef } from "react";
package/dist/dialogs.js CHANGED
@@ -5,5 +5,5 @@ import { t as ImagePositionDialog } from "./ImagePositionDialog-DNodkoI2.js";
5
5
  import { t as ImagePropertiesDialog } from "./ImagePropertiesDialog-CLsDIUWb.js";
6
6
  import { t as InsertSymbolDialog } from "./InsertSymbolDialog-DCFLmfzn.js";
7
7
  import { t as PageSetupDialog } from "./PageSetupDialog-COkgeOQn.js";
8
- import { t as TablePropertiesDialog } from "./TablePropertiesDialog-BW4RRZLZ.js";
8
+ import { t as TablePropertiesDialog } from "./TablePropertiesDialog-DOUiX1KZ.js";
9
9
  export { FindReplaceDialog, FootnotePropertiesDialog, HyperlinkDialog, ImagePositionDialog, ImagePropertiesDialog, InsertImageDialog, InsertSymbolDialog, InsertTableDialog, PageSetupDialog, PasteSpecialDialog, SplitCellDialog, TablePropertiesDialog, WatermarkDialog };